Namespaces
Variants

std::basic_string_view<CharT,Traits>::rbegin, std::basic_string_view<CharT,Traits>::crbegin

ja.cppreference.net から
 
 
 
 
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

関連項目

末尾を指す逆イテレータを返す
(公開メンバ関数)
先頭を指す逆イテレータを返す
(std::basic_string<CharT,Traits,Allocator>の公開メンバ関数)