std::basic_string<CharT,Traits,Allocator>::end, std::basic_string<CharT,Traits,Allocator>::cend
来自cppreference.com
| (1) | (C++11 起为 noexcept) (C++20 起为 constexpr) |
|
| (2) | (C++11 起为 noexcept) (C++20 起为 constexpr) |
|
| (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
