std::basic_string<CharT,Traits,Allocator>:: end, std::basic_string<CharT,Traits,Allocator>:: cend
From cppreference.net
<
cpp
|
string
|
basic string
C++
Strings library
| Classes | ||||
|
(C++17)
|
||||
std::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++ 向后移植
cend()
至 C++98 模式。
示例
运行此代码
#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>
的公开成员函数)
|