std::basic_string_view<CharT,Traits>:: end, std::basic_string_view<CharT,Traits>:: cend
From cppreference.net
<
cpp
|
string
|
basic string view
|
constexpr
const_iterator end
(
)
const
noexcept
;
|
(自 C++17 起) | |
|
constexpr
const_iterator cend
(
)
const
noexcept
;
|
(自 C++17 起) | |
返回指向视图最后一个字符之后字符的迭代器。该字符作为占位符存在,尝试访问它将导致未定义行为。
目录 |
参数
(无)
返回值
const_iterator
指向最后一个字符之后的字符。
复杂度
常量。
示例
运行此代码
#include <iostream> #include <iterator> #include <string_view> int main() { constexpr std::string_view str_view("abcd"); constexpr auto end = str_view.end(); constexpr auto cend = str_view.cend(); static_assert ( *std::prev(end) == 'd' && 'd' == *std::prev(cend) and end == cend ); }
参见
|
返回指向起始位置的迭代器
(公开成员函数) |
|
|
(C++11)
|
返回指向末尾的迭代器
(
std::basic_string<CharT,Traits,Allocator>
的公开成员函数)
|