C++ String 库 - rend
描述
它将反向迭代器返回到反向端。
声明
以下是 std::string::rend 的声明。
reverse_iterator rend(); const_reverse_iterator rend() const;
C++11
reverse_iterator rend() noexcept; const_reverse_iterator rend() const noexcept;
参数
none
返回值
它返回一个反向迭代器到字符串的反向端。
异常
从不抛出任何异常。
示例
在下面的 std::string::rend 示例中。
#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

