std::rend(std::initializer_list)
| Defined in header <iterator> | ||
|---|---|---|
| template <class E> std::reverse_iterator<const E*> rend( std::initializer_list<E> il ); | (since C++14) | 
The overload of std::rend for initializer_list returns an std::reverse_iterator pointing at the first element of il.
Parameters
| il | - | an initializer_list | 
Return value
std::reverse_iterator<const E*>(il.begin()).
Exceptions
(none).
Notes
This overload is necessary because std::initializer_list does not have a member function rend. No overload is needed for std::crend because it is implemented in terms of std::rend.
Example
#include <iostream>
#include <iterator>
 
int main() 
{
    auto il = { 3, 1, 4 };
    for (auto it = std::rbegin(il); it != std::rend(il); ++it)
        std::cout << *it << '\n'; 
}Output:
4 1 3
See also
| (C++14) | returns a reverse iterator to a container or array (function template) | 
| (C++14) | returns a reverse end iterator for a container or array (function template) | 
    © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
    http://en.cppreference.com/w/cpp/utility/initializer_list/rend2