public member function
<string>
const_reverse_iterator crbegin() const noexcept;
返回指向反向起始位置的 const_reverse_iterator
返回一個const_reverse_iteratorpointing to the last character of the string (i.e., its reverse beginning).
返回值
Aconst_reverse_iteratorto the reverse beginning of the string.
成員型別const_reverse_iterator是一個反向隨機訪問迭代器型別,它指向一個常量字元。
示例
1 2 3 4 5 6 7 8 9 10 11 12 13
|
// string::crbegin/crend
#include <iostream>
#include <string>
int main ()
{
std::string str ("lorem ipsum");
for (auto rit=str.crbegin(); rit!=str.crend(); ++rit)
std::cout << *rit;
std::cout << '\n';
return 0;
}
|
輸出
異常安全
無異常保證:此成員函式從不丟擲異常。
還可以保證返回的迭代器的複製構造或賦值永遠不會引發異常。