public member function
<string>
const_reverse_iterator crend() const noexcept;
Return const_reverse_iterator to reverse end
Returns a const_reverse_iterator pointing to the theoretical character preceding the first character of the string (which is considered its reverse end).
Return Value
A const_reverse_iterator to the reverse end of the string.
Member type const_reverse_iterator is a reverse random access iterator type that points to a const character.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13
|
// string::crbegin/crend
#include <iostream>
#include <string>
int main ()
{
std::string str ("lorem ipsum");
for (auto rit=str.crbegin(); rit!=str.crend(); ++rit)
std::cout << *rit;
std::cout << '\n';
return 0;
}
|
Output:
Complexity
Unspecified, but generally constant.
Iterator validity
No changes.
Data races
The object is accessed.
Exception safety
No-throw guarantee: this member function never throws exceptions.
The copy construction or assignment of the returned iterator is also guaranteed to never throw.