Namespaces
Variants

std:: formattable

From cppreference.net
定義済みヘッダー <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 および Formatter の要件を満たすことを指定します( std:: remove_reference_t < T > が const 修飾されている場合)。

説明専用のエイリアステンプレート /* fmt_iter_for */ は、 std:: output_iterator < const CharT & > を満たす未規定の型を生成する。

欠陥報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 3925 C++23 std::basic_format_context の第2テンプレート引数が提供されていなかった 提供される

関連項目

(C++20)
指定された型のフォーマット規則を定義する
(クラステンプレート)
指定されたフォーマット引数型と文字型に対するフォーマット操作を抽象化する
(名前付き要件)
(C++20)
フォーマットライブラリ で使用される関数を定義する
(名前付き要件)