Namespaces
Variants

std:: formatter <std::priority_queue>

From cppreference.net

定义于头文件 <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

- > FormatContext :: iterator ;

等价于 return underlying_  . format ( r. c , ctx ) ;

返回值

指向输出范围末尾的迭代器。

示例

参见

(C++20)
为给定类型定义格式化规则
(类模板)
用于帮助实现 std::formatter 对范围类型的特化的类模板
(类模板)