std::begin(std::initializer_list) - cppreference.com (original) (raw)
From cppreference.com
< cpp | utility | initializer list
| Member functions |
|---|
| initializer_list::initializer_list |
| Capacity |
| initializer_list::size |
| Iterators |
| initializer_list::begin |
| initializer_list::end |
| Non-member functions |
| begin(std::initializer_list) |
| end(std::initializer_list) |
| Defined in header <initializer_list> | | | | ------------------------------------------------------------------------------------------------------------- | | ------------------------------------- | | template< class E > const E* begin( std::initializer_list<E> il ) noexcept; | | (since C++11) (constexpr since C++14) |
The overload of std::begin for initializer_list returns a pointer to the first element of il.
Contents
[edit] Parameters
| il | - | an initializer_list |
|---|
[edit] Return value
il.begin()
[edit] Example
Run this code
#include #include #include #include int main() { std::initializer_list ϕ = {'1', '.', '6', '1', '8', '0'}; std::copy(std::begin(ϕ), std::end(ϕ), std::ostream_iterator(std::cout, "")); std::cout << '\n'; }
Output:
1.6180
[edit] See also
| begin | returns a pointer to the first element (public member function) [edit] |
|---|
Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/initializer_list/begin2&oldid=177193"