Namespaces
Variants
Views
Actions

std::rend

From cppreference.com
< cpp‎ | iterator
Revision as of 07:48, 16 May 2013 by P12 (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <iterator>
</td>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template< class C >
auto rend( C& c ) -> decltype(c.rend());
</td>

<td > (1) </td> <td > (since C++14) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template< class C >
auto rend( const C& c ) -> decltype(c.rend());
</td>

<td > (1) </td> <td > (since C++14) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template< class T, size_t N >
T* rend( T (&array)[N] );
</td>

<td > (2) </td> <td > (since C++14) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template< class C >
auto crend( const C& c ) -> decltype(std::rend(c));
</td>

<td > (3) </td> <td > (since C++14) </td> </tr> Template:ddcl list end

Returns an iterator to the reverse-end of the given container c or array array.

1) Returns a possibly const-qualified iterator to the reverse-end of the container c.
2) Returns a pointer to the reverse-end of the array array.
3) Returns a const-qualified iterator to the reverse-end of the container c.

range-rbegin-rend.svg

Contents

Parameters

c - a container with a rend method
array - an array of arbitrary type

Return value

An iterator to the reverse-end of c or array

Notes

In addition to being included in <iterator>, std::rend is guaranteed to become available if any of the following headers are included: <array>, <deque>, <forward_list>, <list>, <map>, <regex>, <set>, <string>, <unordered_map>, <unordered_set>, and <vector>.

Specializations

Custom specializations of std::rend may be provided for classes that do not expose a suitable rend() member function, yet can be iterated. The following specializations are already provided by the standard library:

Template:cpp/utility/initializer list/dcl list rend2Template:cpp/numeric/valarray/dcl list rend2

Example

See also

Template:cpp/iterator/dcl list rend