Namespaces
Variants

std:: range-default-formatter <std::range_format::set>

From cppreference.net
定义于头文件 <format>
template < ranges:: input_range R, class CharT >
struct /*range-default-formatter*/ < range_format :: set , R, CharT > ;
(C++23 起)
( 仅用于阐释* )

std:: format_kind < R > std :: range_format :: set 时,针对范围类型的类模板 /*range-default-formatter*/ 会特化为将范围格式化为键集合的形式。

目录

成员类型

成员 定义
maybe-const-set (私有) fmt-maybe-const < R, CharT >
( 仅用于说明的成员类型* )

数据成员

td> 定义
成员
underlying_ (私有) 底层格式化器,类型为:

std:: range_formatter < std:: remove_cvref_t <
ranges:: range_reference_t < maybe-const-set >> , CharT >

( 仅用于说明的成员对象* )

成员函数

(constructor)
构造 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 时等于 "..." ,在 CharT wchar_t 时等于 L "..."

std:: range-default-formatter <std::range_format::set>:: parse

template < class ParseContext >
constexpr auto parse ( ParseContext & ctx ) - > ParseContext :: iterator ;

等价于 return underlying_. parse ( ctx ) ;

返回一个指向 范围格式规范 末尾之后的迭代器。

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)
为给定类型定义格式化规则
(类模板)
用于帮助实现范围类型的 std::formatter 特化的类模板
(类模板)