std::basic_string_view<CharT,Traits>:: rbegin, std::basic_string_view<CharT,Traits>:: crbegin
From cppreference.net
<
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>
の公開メンバ関数)
|