std::basic_string_view<CharT,Traits>::rend, std::basic_string_view<CharT,Traits>::crend
From cppreference.com
< cpp | string | basic string view
| 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
[編集] 関連項目
| 先頭への逆イテレータを返す (public member function) | |
| (C++11) |
末尾への逆イテレータを返す (public member function of std::basic_string<CharT,Traits,Allocator>) |