std::formatter<std::stack>
来自 cppreference.cn
定义于头文件 <stack> |
||
template< class CharT, class T, std::formattable<CharT> Container, class... U > struct formatter<std::stack<T, Container, U...>, CharT>; |
(C++23 起) | |
std::formatter 对容器适配器类型 std::stack 的模板特化允许用户使用格式化函数将底层容器转换为其元素集合的文本表示。
当 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::stack<T, Container, U...>>(仅供说明的成员类型*) |
[编辑] 数据成员
名称 | 定义 |
underlying_ |
类型为 std::formatter<ranges::ref_view<maybe-const-container >, CharT> 的底层格式化器(仅用于阐释的成员对象*) |
[编辑] 成员函数
parse |
按 range-format-spec 指定解析格式说明符 (公开成员函数) |
format |
按 range-format-spec 指定写入范围格式化输出 (公开成员函数) |
std::formatter<std::stack>::parse
template< class ParseContext > constexpr auto parse( ParseContext& ctx ) -> ParseContext::iterator; |
||
等价于 return
underlying_
.parse(ctx);。
返回值
指向底层容器的 range-format-spec 尾后位置的迭代器。
std::formatter<std::stack>::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 特化的类模板 (类模板) |