std::formatter<std::priority_queue>
来自 cppreference.cn
定义于头文件 <queue> |
||
template< class CharT, class T, std::formattable<CharT> Container, class... U > struct formatter<std::priority_queue<T, Container, U...>, CharT>; |
(自 C++23 起) | |
std::formatter 的模板特化对于容器适配器类型 std::priority_queue 允许用户使用格式化函数将其底层容器转换为元素的文本表示形式。
如果 std::formattable<Container, CharT> 为 true,则启用此特化。
内容 |
[编辑] 成员类型
名称 | 定义 |
maybe-const-container
|
fmt-maybe-const <Container, CharT>(仅为说明目的的定义*,实现不需要以这种方式定义实体。此实体的名称未指定。) |
maybe-const-adaptor
|
maybe-const < std::is_const_v<maybe-const-container >, std::priority_queue<T, Container, U...>>(仅为说明目的的定义*,实现不需要以这种方式定义实体。此实体的名称未指定。) |
[编辑] 数据成员
名称 | 定义 |
underlying_ |
类型为 std::formatter<ranges::ref_view<maybe-const-container >, CharT> 的底层格式器(仅为说明目的的成员对象*,实现不需要以这种方式定义实体。此实体的名称未指定。) |
[编辑] 成员函数
parse |
解析由 range-format-spec 指定的格式说明符 (公有成员函数) |
format |
写入由 range-format-spec 指定的范围格式化输出 (公有成员函数) |
std::formatter<std::priority_queue>::parse
template< class ParseContext > constexpr auto parse( ParseContext& ctx ) -> ParseContext::iterator; |
||
等价于 return
underlying_
.parse(ctx);。
返回值
一个迭代器,指向底层容器的 range-format-spec 的末尾之后。
std::formatter<std::priority_queue>::format
template< class FormatContext > auto format( /*maybe-const-adaptor*/& r, FormatContext& ctx ) const |
||
等价于 return
underlying_
.format(r.c, ctx);。
返回值
一个迭代器,指向输出范围的末尾之后。
[编辑] 示例
本节不完整 原因:没有示例 |
[编辑] 参见
(C++20) |
为给定类型定义格式化规则 (类模板) |
(C++23) |
帮助实现 std::formatter 对范围类型特化的类模板 (类模板) |