std::basic_format_arg
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <format>
  | 
||
|   template<class Context> class basic_format_arg;  | 
(C++20 起) | |
提供到格式化参数的访问。
basic_format_arg 对象通常由 std::make_format_args 创建并通过 std::visit_format_arg 访问。
basic_format_arg 对象表现为如同存储一个下列类型的 std::variant :
- std::monostate (仅若对象为默认构造的)
 - bool
 - Context::char_type
 - int
 - unsigned int
 - long long int
 - unsigned long long int
 - float
 - double
 - long double
 - const Context::char_type*
 - std::basic_string_view<Context::char_type>
 - const void*
 - basic_format_arg::handle
 
成员类
| 类型 | 定义 | 
|    handle  | 
   允许格式化用户定义类型的对象的类型擦除包装   (类)  | 
成员函数
|    (构造函数)  | 
  构造 std::basic_format_arg (公开成员函数)  | 
|    operator bool  | 
   检查当前对象是否保有格式化参数   (公开成员函数)  | 
非成员函数
|    (C++20)  | 
  用户定义格式化器的参数观览接口  (函数模板)  | 
std::basic_format_arg::handle
|   template<class Context> class basic_format_arg<Context>::handle;  | 
||
允许格式化用户定义类型的对象。
成员函数
|    format  | 
   以给定的环境格式化被引用对象   (公开成员函数)  | 
std::basic_format_arg::handle::format
|   void format(std::basic_format_parse_context<Context::char_type>& parse_ctx, Context& format_ctx) const;  | 
||
令 T 为关联的格式化参数的类型, ref 为指代该格式化参数的 const T& 。等价于:
typename Context::template formatter_type<T> f;
parse_ctx.advance_to(f.parse(parse_ctx));
format_ctx.advance_to(f.format(ref, format_ctx));
std::basic_format_arg::basic_format_arg
|   basic_format_arg() noexcept;  | 
||
默认构造函数。构造不保有格式化参数的 basic_format_arg 。存储的对象拥有 std::monostate 类型。
为创建保有格式化参数的 basic_format_arg ,必须使用 std::make_format_args 。
std::basic_format_arg::operator bool
|   explicit operator bool() const noexcept;  | 
||
检查 *this 是否保有格式化参数。
若 *this 保有格式化参数(即存储的对象不拥有 std::monostate 类型)则返回 true ,否则返回 false 。
示例
| 本节未完成 原因:暂无示例  |