std:: range-default-formatter <std::range_format::string> , std:: range-default-formatter <std::range_format::debug_string>
|
定义于头文件
<format>
|
||
|
template
<
std::
range_format
K,
ranges::
input_range
R,
class
CharT
>
requires
(
K
==
std
::
range_format
::
string
||
K
==
std
::
range_format
::
debug_string
)
|
(C++23 起)
( 仅用于说明* ) |
|
类模板 /*range-default-formatter*/ 针对范围类型进行了特化,当 std:: format_kind < R > 为 std :: range_format :: string 或 std :: range_format :: debug_string 时,会将范围格式化为字符串或转义字符串。
目录 |
数据成员
| 成员 | td> 定义|
underlying_
(私有)
|
底层格式化器,类型为
std::
formatter
<
std::
basic_string
<
CharT
>
, CharT
>
( 仅用于说明的成员对象* ) |
成员函数
|
(构造函数)
(隐式声明)
|
构造
range-default-formatter
(公开成员函数) |
|
parse
|
按照
std-format-spec
解析格式说明符
(公开成员函数) |
|
format
|
按照
std-format-spec
写入格式化输出
(公开成员函数) |
std::
range-default-formatter
<std::range_format::string>::
parse
std::
range-default-formatter
<std::range_format::debug_string>::
parse
|
template
<
class
ParseContext
>
constexpr auto parse ( ParseContext & ctx ) - > ParseContext :: iterator ; |
||
等价于:
auto
i
=
underlying_.
parse
(
ctx
)
;
if
constexpr
(
K
==
std
::
range_format
::
debug_string
)
underlying_.
set_debug_format
(
)
;
return
i
;
返回指向 std-format-spec 末尾之后的迭代器。
std::
range-default-formatter
<std::range_format::string>::
format
std::
range-default-formatter
<std::range_format::debug_string>::
format
|
template
<
class
FormatContext
>
auto format ( /* see below */ & r, FormatContext & ctx ) const - > FormatContext :: iterator ; |
||
如果 ranges:: input_range < const R > 为 true ,则 r 的类型为 const R & 。否则,类型为 R & 。
令 s 为通过 std:: basic_string < CharT > ( std:: from_range , r ) 构造的 std:: basic_string < CharT > ,使得 ranges:: equal ( s, r ) 为 true 。
等价于 return underlying_. format ( s, ctx ) ; 。
返回输出范围末尾的迭代器。
参见
|
(C++20)
|
为给定类型定义格式化规则
(类模板) |
|
(C++23)
|
辅助实现范围类型的
std::formatter
特化的类模板
(类模板) |