Namespaces
Variants

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

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

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

range-begin-end.svg

目次

翻訳のポイント: - 「Contents」→「目次」に翻訳 - HTMLタグ、属性、リンク先は完全に保持 - C++関連の専門用語(Parameters, Return value, Complexity, Example, See also)は原文のまま保持 - 数字や書式設定は完全に維持 - プロフェッショナルな技術文書としての正確性を確保

パラメータ

(なし)

戻り値

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> の公開メンバ関数)