名前空間
変種
操作

std::basic_string<CharT,Traits,Allocator>::end, std::basic_string<CharT,Traits,Allocator>::cend

提供: cppreference.com
< cpp‎ | string‎ | basic string
 
 
 
std::basic_string
 
(1)
iterator end();
(C++11未満)
iterator end() noexcept;
(C++11以上)
(C++20未満)
constexpr iterator end() noexcept;
(C++20以上)
(2)
const_iterator end() const;
(C++11未満)
const_iterator end() const noexcept;
(C++11以上)
(C++20未満)
constexpr const_iterator end() const noexcept;
(C++20以上)
(3)
const_iterator cend() const noexcept;
(C++11以上)
(C++20未満)
constexpr const_iterator cend() const noexcept;
(C++20以上)

文字列の最後の文字の次の文字を指すイテレータを返します。 この文字はプレースホルダの役割を持ちます。 この文字にアクセスを試みると未定義動作になります。

range-begin-end.svg

目次

[編集] 引数

(なし)

[編集] 戻り値

最後の文字の次の文字を指すイテレータ。

[編集] 計算量

一定。

[編集]

#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
 
int main()
{
    std::string s("Exemparl");
    std::next_permutation(s.begin(), s.end());
 
    std::string c;
    std::copy(s.cbegin(), s.cend(), std::back_inserter(c));
    std::cout << c <<'\n'; // "Exemplar"
}

出力:

Exemplar

[編集] 関連項目

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