std::initializer_list::end(3)
π std::initializer_list::end(3) π
okay so this is the C++ Standard Libary page, bestie β manual name folded in, no cap. We're talking about std::initializer_list::end(3) and it's lowkey iconic.
π NAME π
std::initializer_list::end β std::initializer_list::end. That's the name, fr fr. The page is named after itself and honestly? main character energy.
β¨ Synopsis β¨
Two flavors, depending on your C++ era π:
const T* end() const noexcept; (since C++11)
(until C++14)
constexpr const T* end() const noexcept; (since C++14)
So the synopsis says: returns a pointer to one past the last element in the initializer list, i.e. begin()+size().
If the initializer list is empty, the values of begin() and end() are unspecified, but will be identical. Read that again: unspecified but identical β that's the rule, periodt.
π«Ά Parameters π«Ά
(none) β literally no parameters. Not me checking twice π.
πΈ Return value πΈ
a pointer to one past the last element in the initializer list. That's the whole vibe.
π¦ Complexity π¦
Constant β that's it, no extra lore.
π₯ Example π₯
Run this code, bestie (// Run this code energy):
#include <numeric>
#include <initializer_list>
int main()
{
static constexpr auto l = {15, 14};
static_assert(std::accumulate(l.begin(), l.end(), 13) == 42);
}
π See also π
beginβ returns a pointer to the first element (public member function).
mwah π source/version and date, folded into a cute sign-off: http://cppreference.com, 2024.06.10, for std::initializer_list::end(3). slay π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms