std::basic_string_view<CharT,Traits>::rend, std::basic_string_view<CharT,Traits>::crend
出自cppreference.com
| |
(C++17 起) | |
| |
(C++17 起) | |
返回指向逆向視圖末字符的後一字符的逆向迭代器。它對應非逆向視圖的首字符的前趨字符。此字符表現為佔位符,試圖訪問它會導致未定義行為。
參數
(無)
返回值
指向逆向視圖末字符後繼字符的 const_reverse_iterator
複雜度
常數
示例
運行此代碼
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string_view>
int main()
{
std::ostream_iterator<char> out_it(std::cout);
std::string_view str_view("abcdef");
std::copy(str_view.rbegin(), str_view.rend(), out_it);
*out_it = '\n';
std::copy(str_view.crbegin(), str_view.crend(), out_it);
*out_it = '\n';
}
輸出:
fedcba
fedcba
參閱
| 返回指向起始的反向迭代器 (公開成員函數) | |
(C++11) |
返回指向末尾的逆向迭代器 ( std::basic_string<CharT,Traits,Allocator> 的公開成員函數)
|