template< class E > const E* begin( initializer_list<E> il ); | (since C++11) (until C++14) | |
template< class E > constexpr const E* begin( initializer_list<E> il ); | (since C++14) |
The overload of std::begin
for initializer_list
returns a pointer to the first element of il
.
il | - | an initializer_list |
il.begin()
.
noexcept
specification: noexcept
#include <iostream> #include <initializer_list> int main() { std::initializer_list<int> il = {3, 1, 4, 1}; for(auto it = std::begin(il); it != std::end(il); ++it) { std::cout << *it << '\n'; } }
Output:
3 1 4 1
returns a pointer to the first element (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/initializer_list/begin2