std::basic_string<CharT,Traits,Allocator>::end, std::basic_string<CharT,Traits,Allocator>::cend
ja.cppreference.net より
iterator end();
|
(1) | (C++11 から noexcept) (C++20 から constexpr) |
const_iterator end() const;
|
(2) | (C++11 から noexcept) (C++20 から constexpr) |
const_iterator cend() const noexcept;
|
(3) | (C++11 以降) (C++20 から constexpr) |
文字列の最後の文字の次の文字を指すイテレータを返します。この文字はプレースホルダとして機能し、これにアクセスしようとすると未定義動作になります。
パラメータ
(なし)
戻り値
最後の文字の次の文字へのイテレータ。
計算量
定数。
注記
libc++はC++98モードに
cend()
をバックポートします。
例
このコードを実行
#include <algorithm> #include <iostream> #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
関連項目
|
(C++11)
|
先頭へのイテレータを返す
(公開メンバ関数) |
|
終端へのイテレータを返す
( std::basic_string_view<CharT,Traits>の公開メンバ関数)
|