C++ String 库 - end
描述
它返回一个指向字符串第一个字符的迭代器。
声明
以下是 std::string::end 的声明。
iterator end(); const_iterator end() const;
C++11
iterator end() noexcept; const_iterator end() const noexcept;
参数
none
返回值
它返回一个指向字符串末尾的迭代器。
异常
从不抛出任何异常。
示例
在下面的 std::string::end 示例中。
#include <iostream>
#include <string>
int main () {
std::string str ("Tutorials Point");
for ( std::string::iterator it=str.begin(); it!=str.end(); ++it)
std::cout << *it;
std::cout << '\n';
return 0;
}
示例输出应该是这样的 −
Tutorials point

