名前空間
変種

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

提供: cppreference.com
 
 
 
 
<tbody> </tbody>
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()
{
    std::string_view str_view("abcd");

    auto end = str_view.end();
    auto cend = str_view.cend();

    std::cout << *std::prev(end) << '\n';
    std::cout << *std::prev(cend) << '\n';

    std::cout << std::boolalpha << (end == cend) << '\n';
}

出力:

d
d
true

関連項目

先頭を指すイテレータを返します
(パブリックメンバ関数) [edit]