std::basic_string<CharT,Traits,Allocator>::end, std::basic_string<CharT,Traits,Allocator>::cend
From cppreference.com
< cpp | string | basic string
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) |
先頭へのイテレータを返す (public member function) |
| 末尾へのイテレータを返す (public member function of std::basic_string_view<CharT,Traits>) |