std::basic_string_view<CharT,Traits>::end, std::basic_string_view<CharT,Traits>::cend
From cppreference.com
< cpp | string | basic string view
| constexpr const_iterator end() const noexcept; |
(C++17以降) | |
| constexpr const_iterator cend() const noexcept; |
(C++17以降) | |
ビューの最後の文字の次の文字を指すイテレータを返します。この文字はプレースホルダーとして機能し、アクセスしようとすると未定義の動作が発生します。
目次 |
[編集] パラメータ
(なし)
[編集] 戻り値
最後の文字の次の文字へのconst_iterator。
[編集] 計算量
定数。
[編集] 例
このコードを実行
#include <iostream> #include <iterator> #include <string_view> int main() { constexpr std::string_view str_view("abcd"); constexpr auto end = str_view.end(); constexpr auto cend = str_view.cend(); static_assert ( *std::prev(end) == 'd' && 'd' == *std::prev(cend) and end == cend ); }
[編集] 関連項目
| 先頭へのイテレータを返す (public member function) | |
| (C++11) |
末尾へのイテレータを返す (public member function of std::basic_string<CharT,Traits,Allocator>) |