(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) | ||||
span::rbeginspan::crbegin (C++23) | ||||
(C++23) | ||||
| Observers | ||||
| Subviews | ||||
| Non-member functions | ||||
| Non-member constant | ||||
| Deduction guides |
constexpr reverse_iterator rbegin()constnoexcept; | (1) | (since C++20) |
constexpr const_reverse_iterator crbegin()constnoexcept; | (2) | (since C++23) |
Returns a reverse iterator to the first element of the reversed*this. It corresponds to the last element of the non-reversed*this.
If*this is empty, the returned iterator is equal torend().
Contents |
Reverse iterator to the first element.
Constant.
Theunderlying iterator of the returned reverse iterator is theend iterator. Hence the returned iterator is invalidated if and when the end iterator is invalidated.
#include <algorithm>#include <iostream>#include <iterator>#include <span> int main(){constexprstd::span<constchar> code{"@droNE_T0P_w$s@s#_SECRET_a,p^42!"}; auto hack=[](constunsigned O){return O-0141<120;}; std::copy_if(code.rbegin(), code.rend(),std::ostream_iterator<constchar>(std::cout), hack); std::cout<<'\n';}
Output:
password
(C++23) | returns a reverse iterator to the end (public member function)[edit] |
(C++14) | returns a reverse iterator to the beginning of a container or array (function template)[edit] |