std::format_to
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <format> で定義
|
||
template<class OutputIt, class... Args> OutputIt format_to(OutputIt out, std::string_view fmt, const Args&... args); |
(1) | (C++20以上) |
template<class OutputIt, class... Args> OutputIt format_to(OutputIt out, std::wstring_view fmt, const Args&... args); |
(2) | (C++20以上) |
template<class OutputIt, class... Args> OutputIt format_to(OutputIt out, const std::locale& loc, std::string_view fmt, const Args&... args); |
(3) | (C++20以上) |
template<class OutputIt, class... Args> OutputIt format_to(OutputIt out, const std::locale& loc, std::wstring_view fmt, const Args&... args); |
(4) | (C++20以上) |
書式文字列 fmt に従って args を書式化し、結果を出力イテレータ out に出力します。 存在する場合、ロケール固有の書式化のために loc が使用されます。
CharT を decltype(fmt)::char_type (オーバーロード (1,3) の場合は char、オーバーロード (2,4) の場合は wchar_t) とします。
これらのオーバーロードは、
OutputIt がコンセプト std::output_iterator<const CharT&> を満たす
場合にのみ、オーバーロード解決に参加します。
OutputIt がコンセプト std::output_iterator<const CharT&> をモデル化しない (意味論の要件を満たさない) 場合、または std::formatter<Ti, CharT> が Args 内の任意の Ti について Formatter の要件を満たさない場合、動作は未定義です。
引数
| out | - | 出力バッファを指すイテレータ。 |
| fmt | - | 書式文字列を表す文字列ビュー。
置換フィールドは以下の形式を持ちます。
arg-id は書式化に使用する値を持つ 書式指定は対応する引数のための std::formatter の特殊化によって定義されます。
|
| args... | - | 書式化する引数。 |
| loc | - | ロケール固有の書式化のために使用される std::locale。 |
戻り値
出力範囲の終端を指すイテレータ。
例外
fmt が有効な書式文字列でない場合、 std::format_error を投げます。 フォーマッタによって投げられた例外も伝播されます。
例
| This section is incomplete Reason: no example |