public member function
<string>

std::string::crbegin

const_reverse_iterator crbegin() const noexcept;
Return const_reverse_iterator to reverse beginning
Returns a const_reverse_iterator pointing to the last character of the string (i.e., its reverse beginning).

Parameters

none

Return Value

A const_reverse_iterator to the reverse beginning 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:
muspi merol


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.

See also