Namespaces
Variants

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

From ja.cppreference.net
 
 
 
 
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
    );
}

関連項目

先頭へのイテレータを返す
(公開メンバ関数)
(C++11)
終端へのイテレータを返す
(std::basic_string<CharT,Traits,Allocator>の公開メンバ関数)