C++ 参考手册
- C++11
- C++14
- C++17
- C++20
- C++ 编译器支持情况表
- 独立与宿主实现
- C++ 语言
- C++ 关键词
- 预处理器
- C++ 标准库头文件
- 具名要求
- 功能特性测试 (C++20)
- 工具库
- 类型支持(基本类型、RTTI、类型特性)
- 概念库 (C++20)
- 错误处理
- 动态内存管理
- 日期和时间工具
- 字符串库
- std::basic_string
- std::basic_string_view
- std::basic_string_view<CharT,Traits>::operator=
- std::basic_string_view<CharT,Traits>::begin, std::basic_string_view<CharT,Traits>::cbegin
- std::basic_string_view<CharT,Traits>::end, std::basic_string_view<CharT,Traits>::cend
- std::basic_string_view<CharT,Traits>::basic_string_view
- std::basic_string_view<CharT,Traits>::copy
- std::hash (std::string_view, std::wstring_view, std::u16string_view, std::u32string_view)
- std::basic_string_view<CharT,Traits>::rbegin, std::basic_string_view<CharT,Traits>::crbegin
- std::basic_string_view<CharT,Traits>::rend, std::basic_string_view<CharT,Traits>::crend
- std::basic_string_view<CharT,Traits>::at
- std::basic_string_view<CharT,Traits>::operator[]
- std::basic_string_view<CharT,Traits>::front
- std::basic_string_view<CharT,Traits>::back
- std::basic_string_view<CharT,Traits>::data
- std::basic_string_view<CharT,Traits>::size, std::basic_string_view<CharT,Traits>::length
- std::basic_string_view<CharT,Traits>::max_size
- std::basic_string_view<CharT,Traits>::empty
- std::basic_string_view<CharT,Traits>::remove_prefix
- std::basic_string_view<CharT,Traits>::remove_suffix
- std::basic_string_view<CharT,Traits>::swap
- std::basic_string_view<CharT,Traits>::substr
- std::basic_string_view<CharT,Traits>::compare
- std::basic_string_view<CharT,Traits>::starts_with
- std::basic_string_view<CharT,Traits>::ends_with
- std::basic_string_view<CharT,Traits>::find
- std::basic_string_view<CharT,Traits>::rfind
- std::basic_string_view<CharT,Traits>::find_first_of
- std::basic_string_view<CharT,Traits>::find_last_of
- std::basic_string_view<CharT,Traits>::find_first_not_of
- std::basic_string_view<CharT,Traits>::find_last_not_of
- std::basic_string_view<CharT,Traits>::npos
- operator==,!=,<,<=,>,>=,<=>(std::basic_string_view)
- operator<<(std::basic_string_view)
- std::literals::string_view_literals::operator""sv
- std::basic_string_view 的推导指引
- 空终止字节字符串
- 空终止多字节字符串
- 空终止宽字符串
- std::char_traits
- 注释
- 容器库
- 迭代器库
- 范围库 (C++20)
- 算法库
- 数值库
- 输入/输出库
- 文件系统库
- 本地化库
- 正则表达式库
- 原子操作库
- 线程支持库
- 实验性 C++ 特性
- 有用的资源
- 索引
- std 符号索引
- 协程支持 (C++20)
- C++ 关键词
位置:首页 > C++ 参考手册 >字符串库 >std::basic_string_view > std::basic_string_view<CharT,Traits>::end, std::basic_string_view<CharT,Traits>::cend
std::basic_string_view<CharT,Traits>::end, std::basic_string_view<CharT,Traits>::cend
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() { std::string_view str_view("abcd"); auto end = str_view.end(); auto cend = str_view.cend(); std::cout << *std::prev(end) << '\n'; std::cout << *std::prev(cend) << '\n'; std::cout << std::boolalpha << (end == cend) << '\n'; }
输出:
d d true
参阅
返回指向起始位置的迭代器 (公开成员函数) |