std::formattable
来自cppreference.com
<tbody>
</tbody>
| 在标头 <format> 定义
|
||
template< class T, class CharT > concept formattable = /* formattable_with */< std::remove_reference_t<T>, std::basic_format_context</* fmt_iter_for */<CharT>, CharT> >; |
(1) | (C++23 起) |
| 辅助模板 |
||
template< class CharT > using /* fmt_iter_for */ = /* 未指明 */; |
(2) | (仅用于阐述*) |
template< class T, class Context, class Formatter = typename Context::template formatter_type<std::remove_const_t<T>> > concept /* formattable_with */ = std::semiregular<Formatter> && requires (Formatter& f, const Formatter& cf, T&& t, Context fc, std::basic_format_parse_context< typename Context::char_type > pc) { { f.parse(pc) } -> std::same_as<typename decltype(pc)::iterator>; { cf.format(t, fc) } -> std::same_as<typename Context::iterator>; }; |
(3) | (仅用于阐述*) |
概念 formattable 指定 std::formatter<std::remove_cvref_t<T>, CharT> 满足基本格式化器 (BasicFormatter) 和(当 std::remove_reference_t<T> 有 const 限定时)格式化器 (Formatter) 的要求。
仅用于阐释的别名模板 /* fmt_iter_for */ 产生满足 std::output_iterator<const CharT&> 的未指明类型。
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
| 缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
|---|---|---|---|
| LWG 3925 | C++23 | 未提供 std::basic_format_context 的第二模板实参 | 已提供 |
参阅
(C++20) |
定义针对给定类型的格式化规则 (类模板) |
(C++20) |
针对给定格式化参数类型和字符类型抽象格式化操作 (具名要求) |
(C++20) |
定义格式化库使用的函数 (具名要求) |