std::range-default-formatter<std::range_format::set>
来自 cppreference.cn
< cpp | utility | format | ranges formatter
定义于头文件 <format> |
||
template< ranges::input_range R, class CharT > struct /*range-default-formatter*/<range_format::set, R, CharT>; |
(自 C++23 起) (仅为说明目的的定义*) |
|
类模板 /*range-default-formatter*/ 为范围类型特化,用于将范围格式化为键的集合,如果 std::format_kind<R> 为 std::range_format::set。
内容 |
[编辑] 成员类型
成员 | 定义 |
maybe-const-set (私有) |
fmt-maybe-const <R, CharT>(仅为说明目的的成员类型*) |
[编辑] 数据成员
成员 | 定义 |
underlying_ (私有) |
类型为以下的底层格式器 std::range_formatter<std::remove_cvref_t< |
[编辑] 成员函数
(构造函数) |
构造一个 range-default-formatter (公有成员函数) |
parse |
解析由 range-format-spec 指定的格式说明符 (公有成员函数) |
format |
写入由 range-format-spec 指定的范围格式化输出 (公有成员函数) |
std::range-default-formatter<std::range_format::set>::range-default-formatter
constexpr /*range-default-formatter*/(); |
||
等价于调用 underlying_.set_brackets(STATICALLY_WIDEN<CharT>("{"), STATICALLY_WIDEN<CharT>("}"))
其中 STATICALLY_WIDEN<CharT>("...") 是 "..." 如果 CharT
为 char,并且是 L"..." 如果 CharT
为 wchar_t。
std::range-default-formatter<std::range_format::set>::parse
template< class ParseContext > constexpr auto parse( ParseContext& ctx ) -> ParseContext::iterator; |
||
等价于 return underlying_.parse(ctx);。
返回一个迭代器,指向 range-format-spec 的末尾之后。
std::range-default-formatter<std::range_format::set>::format
template< class FormatContext > auto format( maybe-const-set& r, FormatContext& ctx ) const -> FormatContext::iterator; |
||
等价于 return underlying_.format(r, ctx);。
返回一个迭代器,指向输出范围的末尾之后。
[编辑] 参见
(C++20) |
定义给定类型的格式化规则 (类模板) |
(C++23) |
类模板,帮助为范围类型实现 std::formatter 特化 (类模板) |