Namespaces
Variants
Views
Actions

std::end(std::initializer_list)

From cppreference.com
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (C++20)
Dynamic memory management
Program utilities
Coroutine support (C++20)
Variadic functions
Debugging support
(C++26)
Three-way comparison
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)

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

The overload of std::end for initializer_list returns a pointer to one past the last element of il.

Contents

[edit] Parameters

il - an initializer_list

[edit] Return value

il.end()

[edit] Example

#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

[edit] See also

returns a pointer to one past the last element
(public member function) [edit]