C++ String Library - rbegin


Advertisements


Description

It return reverse iterator to reverse beginning.

Declaration

Following is the declaration for std::string::rbegin.

reverse_iterator rbegin();
const_reverse_iterator rbegin() const;

C++11

    reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;

Parameters

none

Return Value

It returns a reverse iterator to the reverse beginning of the string.

Exceptions

Never throw any exceptions.

Example

In below example for std::string::rbegin.

Live Demo
#include <iostream>
#include <string>

int main () {
   std::string str ("Tutorials Point...");
   for (std::string::reverse_iterator rit=str.rbegin(); rit!=str.rend(); ++rit)
      std::cout << *rit;
   return 0;
}

The sample output should be like this −

...tnioP slairotuT 

string.htm

Advertisements