C++ 字串庫 - rbegin



描述

它返回指向字串反向開頭的反向迭代器。

宣告

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

reverse_iterator rbegin();
const_reverse_iterator rbegin() const;

C++11

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

引數

返回值

它返回一個指向字串反向開頭的反向迭代器。

異常

從不丟擲任何異常。

示例

以下是 std::string::rbegin 的示例。

#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;
}

示例輸出應如下所示:

...tnioP slairotuT 
string.htm
廣告