名前空間
変種
操作

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

提供: 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()
{
    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]