C++ 字串庫 - crend



描述

它返回 const_reverse_iterator 到反向結束。

宣告

以下是 std::string::crend 的宣告。

const_reverse_iterator crend() const noexcept;

C++11

const_reverse_iterator crend() const noexcept;

引數

返回值

它返回一個指向字串反向末端的 const_reverse_iterator。

異常

從不丟擲任何異常。

示例

以下為 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;
}

示例輸出應如下所示:

tnioP slairotuT
string.htm
廣告