std::vformat
格式化函数 | ||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)
|
||||
vformat
(C++20)
|
||||
(C++20)
|
||||
格式化概念 | ||||
(C++23)
|
||||
格式化器 | ||||
(C++20)
|
||||
(C++23)
|
||||
(C++20)(C++20)(C++20)
|
||||
(C++20)(C++20)(C++20)
|
||||
(C++23)
|
||||
(C++23)
|
||||
格式化参数 | ||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)(C++20)(C++20)
|
||||
(C++20)(C++20)(C++20)
|
||||
(C++20)
(C++26
中弃用)
|
||||
(C++20)(C++20)
|
||||
格式错误 | ||||
(C++20)
|
在标头
<format>
定义
|
||
std::string
vformat(std::string_view
fmt, std::format_args
args);
|
(1) | (C++20 起) |
std::wstring
vformat(std::wstring_view
fmt, std::wformat_args
args);
|
(2) | (C++20 起) |
std::string
vformat(const
std::locale&
loc, std::string_view
fmt, std::format_args
args);
|
(3) | (C++20 起) |
std::wstring
vformat(const
std::locale&
loc, std::wstring_view
fmt, std::wformat_args
args);
|
(4) | (C++20 起) |
按照格式字符串 fmt
格式化 args
,并返回作为 string 的结果。
loc
若存在,则用于本地环境特定的格式化。
参数
fmt | - |
每个替换域拥有下列格式:
arg-id 指定用于格式化其值的
格式说明由对应参数特化的 std::formatter 定义。
|
args... | - | 要格式化的参数 |
loc | - | 用于本地环境特定格式化的 std::locale |
返回值
保有格式化结果的 string 对象。
异常
若 fmt
对于提供的参数不是合法的格式字符串则抛出 std::format_error ,在分配失败时抛出 std::bad_alloc
。并传播格式化器或迭代器操作所抛的任何异常。
示例
本节未完成 原因:暂无示例 |