Namespaces
Variants
Views
Actions

std::end(std::initializer_list)

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
Defined in header <initializer_list>
template< class E >
const E* end( std::initializer_list<E> il ) noexcept;
(since C++11)
(constexpr 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 <cassert>
#include <initializer_list>
#include <iterator>
#include <numeric>
 
int main()
{
    std::initializer_list e = {2, 7, 1, 8, 2, 8, 1};
    assert(std::accumulate(std::begin(e), std::end(e), 13) == 42);
}

[edit] See also

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