(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 | ||||
| Element access | ||||
(C++26) | ||||
| Iterators | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
span::rendspan::crend (C++23) | ||||
| Observers | ||||
| Subviews | ||||
| Non-member functions | ||||
| Non-member constant | ||||
| Deduction guides |
constexpr reverse_iterator rend()constnoexcept; | (1) | (since C++20) |
constexpr const_reverse_iterator crend()constnoexcept; | (2) | (since C++23) |
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.
#include <algorithm>#include <iostream>#include <span>#include <string_view> void ascending(conststd::span<conststd::string_view> data,conststd::string_view term){std::for_each(data.begin(), data.end(),[](conststd::string_view x){std::cout<< x<<' ';});std::cout<< term;} void descending(conststd::span<conststd::string_view> data,conststd::string_view term){std::for_each(data.rbegin(), data.rend(),[](conststd::string_view x){std::cout<< x<<' ';});std::cout<< term;} int main(){constexprstd::string_view bars[]{"▁","▂","▃","▄","▅","▆","▇","█"}; ascending(bars," "); descending(bars,"\n");}
Output:
▁ ▂ ▃ ▄ ▅ ▆ ▇ █ █ ▇ ▆ ▅ ▄ ▃ ▂ ▁
(C++23) | 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] |