##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::rend

From cppreference.com
< cpp‎ | iterator

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 > reverse_iterator<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 std::reverse_iterator<T*> to the reverse-end of the array `array`.
3) Returns a const-qualified iterator to the reverse-end of the container `c`.

### [edit] Parameters

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

### [edit] Return value

An iterator to the reverse-end of `c` or `array`

### [edit] 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>`.

### [edit] 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:

rend(std::initializer_list) (C++14) | specializes std::rend (function) [edit]

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

rbegin crbegin (C++14) | returns a reverse iterator to a container or array (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/iterator/rend&oldid=66726"
Category:

- Todo no example