(C++17) | ||||
Sequence | ||||
(C++11) | ||||
(C++26) | ||||
(C++26) | ||||
(C++11) | ||||
Associative | ||||
Unordered associative | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
Adaptors | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
Views | ||||
(C++20) | ||||
(C++23) | ||||
Tables | ||||
Iterator invalidation | ||||
Member function table | ||||
Non-member function table |
Member functions | |||||||
Non-member functions | |||||||
| |||||||
Deduction guides(C++17) |
reverse_iterator rend(); | (1) | (noexcept since C++11) (constexpr since C++26) |
const_reverse_iterator rend()const; | (2) | (noexcept since C++11) (constexpr since C++26) |
const_reverse_iterator crend()constnoexcept; | (3) | (since C++11) (constexpr since C++26) |
Returns a reverse iterator past the last element of the reversed*this. It corresponds to the element preceding the first element of the non-reversed*this.
This returned iterator only acts as a sentinel. It is not guaranteed to bedereferenceable.
Contents |
Reverse iterator to the element following the last element.
Constant.
libc++ backportscrend()
to C++98 mode.
#include <chrono>#include <iomanip>#include <iostream>#include <string_view>#include <map> usingnamespace std::chrono; int main(){conststd::multimap<year_month_day,int> messages{{February/17/2023,10},{February/17/2023,20},{February/16/2022,30},{October/22/2022,40},{June/14/2022,50},{November/23/2021,60},{December/10/2022,55},{December/12/2021,45},{April/1/2020,42},{April/1/2020,24}}; std::cout<<"Messages received (date order is reversed):\n";for(auto it= messages.crbegin(); it!= messages.crend();++it)std::cout<< it->first<<" : "<< it->second<<'\n';}
Possible output:
Messages received (date order is reversed):2023-02-17 : 202023-02-17 : 102022-12-10 : 552022-10-22 : 402022-06-14 : 502022-02-16 : 302021-12-12 : 452021-11-23 : 602020-04-01 : 242020-04-01 : 42
(C++11) | returns a reverse iterator to the beginning (public member function)[edit] |
(C++14) | returns a reverse end iterator for a container or array (function template)[edit] |