C++ String Library - crend


Advertisements

Description

It return const_reverse_iterator to reverse end.

Declaration

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

const_reverse_iterator crend() const noexcept;

C++11

const_reverse_iterator crend() const noexcept;

Parameters

none

Return Value

It returns a const_reverse_iterator to the reverse end of the string.

Exceptions

Never throw any exceptions.

Example

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

#include <iostream>
#include <string>

int main () {
   std::string str ("Tutorials Point");
   for (auto rit=str.crbegin(); rit!=str.crend(); ++rit)
      std::cout << *rit;
   std::cout << '\n';

   return 0;
}

The sample output should be like this −

tnioP slairotuT
string.htm
Advertisements