Scroll to navigation

std::end(std::initializer_list)(3) C++ Standard Libary std::end(std::initializer_list)(3)

NAME

std::end(std::initializer_list) - std::end(std::initializer_list)

Synopsis


Defined in header <initializer_list>
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.

Parameters


il - an initializer_list

Return value


il.end()

Example

// Run this code


#include <iostream>


int main()
{
// range-based for uses std::begin and std::end to iterate
// over a given range; in this case, it's an initializer list
for (int i : {3, 1, 4, 1}) {
std::cout << i << '\n';
}
}

Output:


3
1
4
1

See also


end returns a pointer to one past the last element
(public member function)

2022.07.31 http://cppreference.com