- format[meta header]
- function[meta id-type]
- std[meta namespace]
- cpp20[meta cpp]
namespace std {
template<class Out>
Out vformat_to(Out out, string_view fmt, format_args args); // (1)
template<class Out>
Out vformat_to(Out out, wstring_view fmt, wformat_args args); // (2)
template<class Out>
Out vformat_to(Out out, const locale& loc, string_view fmt, format_args args); // (3)
template<class Out>
Out vformat_to(Out out, const locale& loc, wstring_view fmt, wformat_args args); // (4)
}- string_view[link /reference/string_view/basic_string_view.md]
- wstring_view[link /reference/string_view/basic_string_view.md]
- format_args[link /reference/format/basic_format_args.md]
- wformat_args[link /reference/format/basic_format_args.md]
- locale[link /reference/locale/locale.md]
書式文字列fmtに従ったフォーマットでargsの文字列表現を出力イテレータoutに出力する。
- (1): マルチバイト文字列版
- (2): ワイド文字列版
- (3): マルチバイト文字列版 (ロケール指定あり)
- (4): ワイド文字列版 (ロケール指定あり)
format_toのフォーマット引数を型消去したバージョンであり、内部的に使用される。文字列をフォーマットする目的で直接利用する必要はない。
ただし、format_toのような関数を自作する場合は、vformat_toを使って実装すると便利である。
Outは以下の制約を満たす。
- (1),(3):
OutputIterator<const char&> - (2),(4):
OutputIterator<const wchar_t&>
outは以下の制約を満たす型の有効なオブジェクトである。
- (1),(3):
OutputIterator<const char&> - (2),(4):
OutputIterator<const wchar_t&>
書式文字列fmtに従ったフォーマットでargsの文字列表現を出力イテレータoutの[out, out + N)のイテレータ範囲に出力する。ロケールlocが指定された場合は、ロケール依存のフォーマットにおいて使用される。
(ただし、N=formatted_size(fmt, args...) または formatted_size(loc, fmt, args...))
out + N (ただし、N=formatted_size(fmt, args...) または formatted_size(loc, fmt, args...))
書式文字列が正しくなかったり、フォーマット実行時に失敗したりした場合、format_errorを投げる。
- C++20
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??