名前空間
変種
操作

std::basic_string_view<CharT,Traits>::end, std::basic_string_view<CharT,Traits>::cend

From cppreference.com
 
 
 
 
constexpr const_iterator end() const noexcept;
(C++17以降)
constexpr const_iterator cend() const noexcept;
(C++17以降)

ビューの最後の文字の次の文字を指すイテレータを返します。この文字はプレースホルダーとして機能し、アクセスしようとすると未定義の動作が発生します。

range-begin-end.svg

目次

[編集] パラメータ

(なし)

[編集] 戻り値

最後の文字の次の文字への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>) [編集]
English 日本語 中文(简体) 中文(繁體)