std::end(st...alizer_list)(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

okay so this is std::end(std::initializer_list)(3), and the manual name is C++ Standard Libary β€” yes, spelled like that in the header, and we respect her πŸ’….

✨ NAME ✨

std::end(std::initializer_list) β€” std::end(std::initializer_list). She said it twice and honestly? Consistent queen behavior. πŸ‘‘

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <initializer_list> β€” periodt.

template< class E >
(since C++11)
const E* end( std::initializer_list<E> il ) noexcept;
(until C++14)
template< class E >
(since C++14)
constexpr const E* end( std::initializer_list<E> il ) noexcept;

The overload of std::end for initializer_list returns a pointer to one past the last element of il. It’s giving pointer-to-one-past-the-end energy, and it’s noexcept, bestie. No cap. ✨

πŸŽ€ Parameters πŸŽ€

  • il β€” an initializer_list. That’s the whole parameter. Slay.

🧚 Return value 🧚

il.end() β€” literally that. It returns il.end(). Iconic.

🌸 Example 🌸

// Run this code

#include <iostream>
#include <iterator>
#include <algorithm>
#include <initializer_list>

int main()
{
    std::initializer_list il = {3, 1, 4, 1, 5, 9};

    std::reverse_copy(std::begin(il),
                      std::end(il),
                      std::ostream_iterator<int>(std::cout, " "));
}

Output:

9 5 1 4 1 3

🌈 See also 🌈

  • end β€” returns a pointer to one past the last element (public member function). Bestie, it’s right there in the name. 🫢

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::end(st...alizer_list)(3) β€” bye bestie, drink water and close your iterators πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from