std::basic_format_parse_context_C++中文网
| 定义于头文件 |
||
| template<class CharT> |
(1) | (C++20 起) |
| using format_parse_context = basic_format_parse_context<char>; |
(2) | (C++20 起) |
| using wformat_parse_context = basic_format_parse_context<wchar_t>; |
(3) | (C++20 起) |
提供到分析由正在分析的格式字符串范围,和自动下标参数计数组成的格式字符串分析状态的访问。
分析格式说明时,传递 basic_format_parse_context 实例给格式化器 (Formatter) 。
成员类型
成员函数
| (构造函数) |
从格式字符串和参数计数构造 std::basic_format_parse_context (公开成员函数) |
| operator= [被删除] |
std::basic_format_parse_context 不可复制 (公开成员函数) |
| begin |
返回指向格式字符串范围起始的迭代器 (公开成员函数) |
| end |
返回指向格式字符串范围末尾的迭代器 (公开成员函数) |
| advance_to |
使起始迭代器前进到给定位置 (公开成员函数) |
| next_arg_id |
进入自动索引模式,并返回下一个参数下标 (公开成员函数) |
| check_arg_id |
进入手动索引模式,检查给定参数下标是否在范围中 (公开成员函数) |
std::basic_format_parse_context::basic_format_parse_context
| (1) | ||
| basic_format_parse_context(const basic_format_parse_context&) = delete; |
(2) | |
1) 构造 std::basic_format_parse_context 实例。初始化格式字符串范围为 [fmt.begin(), fmt.end()) ,并初始化参数计数为 num_args 。
2) 复制构造函数被删除。 std::basic_format_parse_context 不可复制。
std::basic_format_parse_context::begin
| constexpr const_iterator begin() const noexcept; |
||
返回指向格式字符串范围起始的迭代器。
std::basic_format_parse_context::end
| constexpr const_iterator end() const noexcept; |
||
返回指向格式字符串范围末尾的迭代器。
std::basic_format_parse_context::advance_to
| constexpr void advance_to(const_iterator it); |
||
设置格式字符串范围的起始为 it 。调用 advance_to 后,对 begin() 的后继调用将返回 it 的副本。
若 end() 从 it 不可达则行为未定义。
std::basic_format_parse_context::next_arg_id
进入自动参数索引模式,并返回从 0 开始的下个参数下标。
若 *this 已进入手动参数索引模式,则抛出 std::format_error 。
std::basic_format_parse_context::check_arg_id
进入手动参数索引模式。
若 *this 以进入自动参数索引模式,则抛出 std::format_error 。
若 id 大于或等于构造函数中提供的参数数量,则该调用不是常量表达式。