名前空間
変種
操作

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

提供: cppreference.com
 
 
 
 
constexpr const_reverse_iterator rend() const noexcept;
(C++17以上)
constexpr const_reverse_iterator crend() const noexcept;
(C++17以上)

逆になったビューの最後の文字の次の文字を指す逆イテレータを返します。 これは逆になっていないビューの最初の文字の前の文字に対応します。 この文字はプレースホルダの役割を持ちます。 この文字にアクセスを試みると未定義動作になります。

range-rbegin-rend.svg

目次

[編集] 引数

(なし)

[編集] 戻り値

最後の文字の次の文字を指す 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

[編集] 関連項目

先頭を指す逆イテレータを返します
(パブリックメンバ関数) [edit]