Namespaces
Variants

std::basic_string_view<CharT,Traits>::rend, std::basic_string_view<CharT,Traits>::crend

ja.cppreference.net から
 
 
 
 
constexpr const_reverse_iterator rend() const noexcept;
(C++17 から)
constexpr const_reverse_iterator crend() 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(), 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>の公開メンバ関数)