std::basic_string_view<CharT,Traits>::rbegin, std::basic_string_view<CharT,Traits>::crbegin
從 cppreference.com
< cpp | string | basic string view
constexpr const_reverse_iterator rbegin() const noexcept; |
(C++17 起) | |
constexpr const_reverse_iterator crbegin() const noexcept; |
(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(), std::next(str_view.rbegin(), 3), out_it); *out_it = '\n'; std::copy(str_view.crbegin(), std::next(str_view.crbegin(), 3), out_it); *out_it = '\n'; }
輸出:
fed fed
[編輯] 參閱
返回指向結尾的反向迭代器 (公開成員函數) | |
(C++11) |
返回指向起始的逆向迭代器 ( std::basic_string<CharT,Traits,Allocator> 的公開成員函數)
|