namespace std {
template<class Context>
class basic_format_arg {
private:
using char_type = typename Context::char_type; // exposition only
variant<monostate, bool, char_type,
int, unsigned int, long long int, unsigned long long int,
float, double, long double,
const char_type*, basic_string_view<char_type>,
const void*, handle> value; // exposition only
template<class T> explicit basic_format_arg(T& v) noexcept; // (2) exposition only
public:
basic_format_arg() noexcept; // (1)
};
}
概要
- (1): 空の
basic_format_arg
を構築する - (2): (説明専用)
make_format_args
の内部で使用され、引数からbasic_format_args
を構築する。
テンプレートパラメーター制約
- (2):
T
はフォーマットできる型であること
事前条件
- (2): もし
decay_t<T>
がchar_type*
またはconst char_type*
である場合、static_cast<const char_type*>(v)
はヌル終端されたchar_type
の配列を指すこと。
事後条件
- (1):
!(*this)
例外
投げない。
効果
-
(1):
value
をmonostate
で初期化する。 -
(2):
TD
をremove_const<T>
として、以下の順にvalue
を初期化する。TD
がbool
なら、v
で初期化TD
がchar
かつchar_type
がwchar_t
なら、value
をstatic_cast<wchar_t>(v)
で初期化TD
がchar
かつchar_type
がwchar_t
なら、value
をstatic_cast<wchar_t>(static_cast<unsigned char>(v))
で初期化TD
が符号つき整数型かつsizeof(TD) <= sizeof(int)
なら、value
をstatic_cast<int>(v)
で初期化TD
が符号なし整数型かつsizeof(TD) <= sizeof(unsigned int)
なら、value
をstatic_cast<unsigned int>(v)
で初期化TD
が符号つき整数型かつsizeof(TD) <= sizeof(long long int)
なら、value
をstatic_cast<long long int>(v)
で初期化TD
が符号なし整数型かつsizeof(TD) <= sizeof(unsigned long long int)
なら、value
をstatic_cast<unsigned long long int>(v)
で初期化TD
が浮動小数点数なら、v
で初期化TD
がbasic_string_view
またはbasic_string
の特殊化で、TD::value_type
がchar_type
と等しければ、value
をbasic_string_view<char_type>(v.data(), v.size())
で初期化decay_t<T>
がchar_type*
またはconst char_type*
なら、value
をstatic_cast<const char_type*>(v)
で初期化is_void_v<remove_pointer_t<TD>>
がtrue
、またはis_null_pointer_v<TD>
がtrue
なら、value
をstatic_cast<const void*>(v)
で初期化- それ以外なら、
value
をhandle(v)
で初期化
バージョン
言語
- C++20
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??