std::formatted_size_C++中文网
| 定义于头文件 |
||
| template<class... Args> |
(1) | (C++20 起) |
| template<class... Args> |
(2) | (C++20 起) |
| template<class... Args> |
(3) | (C++20 起) |
| template<class... Args> |
(4) | (C++20 起) |
确定按照格式字符串 fmt 格式化 args 得到的有格式字符串的总字符数。 loc 若存在则用于本地环境特定的格式化。
若对 Args 中任何 Ti , std::formatter<Ti, CharT> 不满足格式化器 (Formatter) 要求则行为未定义。
参数
| fmt | - | 表示格式字符串的字符串视图。
格式字符串由以下内容组成:
每个替换域拥有下列格式:
arg-id 指定用于格式化其值的 格式说明由对应参数特化的 std::formatter 定义。
|
| args... | - | 要格式化的参数 |
| loc | - | 用于本地环境特定的格式化的 std::locale |
返回值
有格式字符串中的总字符数。
异常
若 fmt 对于提供的参数不是合法的格式字符串则抛出 std::format_error 。并且会传播格式化器所抛的任何异常。