Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/iterator/rend"

From cppreference.com
< cpp‎ | iterator
m (Update links.)
(fix see also)
Line 58: Line 58:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/iterator/dsc rend}}
+
{{dsc inc | cpp/iterator/dsc rbegin}}
 
{{dsc end}}
 
{{dsc end}}

Revision as of 22:46, 5 June 2013

 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
rendcrend
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
Defined in header <iterator>
template< class C >
auto rend( C& c ) -> decltype(c.rend());
(1) (since C++14)
template< class C >
auto rend( const C& c ) -> decltype(c.rend());
(1) (since C++14)
template< class T, size_t N >
T* rend( T (&array)[N] );
(2) (since C++14)
template< class C >
auto crend( const C& c ) -> decltype(std::rend(c));
(3) (since C++14)

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:

specializes std::rend
(function) [edit]
specializes std::rend()
(function) [edit]

Example

See also

returns a reverse iterator to the beginning of a container or array
(function template) [edit]