class template
std::basic_format_context(C++20)
namespace std {
template<class Out, class charT>
class basic_format_context; // (1)
using format_context = basic_format_context<unspecified, char>; // (2)
using wformat_context = basic_format_context<unspecified, wchar_t>; // (3)
}
概要
実際に渡されたフォーマット引数を含む、フォーマット実行中の状態を保持するクラス。
- (1): テンプレートの定義
- (2): マルチバイト文字列版の別名 (出力イテレータの型は未規定)
- (3): ワイド文字列版の別名 (出力イテレータの型は未規定)
Out
はOutputIterator<const charT&>
であること
メンバ関数
名前 |
説明 |
対応バージョン |
arg |
フォーマット引数を取得する |
C++20 |
out |
出力イテレータを取得する |
C++20 |
advance_to |
出力イテレータを指定したイテレータに設定する |
C++20 |
locale |
ロケールを取得する |
C++20 |
メンバ型
名前 |
説明 |
対応バージョン |
iterator |
出力イテレータ(Out と等しい) (type-alias) |
C++20 |
char_type |
文字の型(charT と等しい) (type-alias) |
C++20 |
formatter_type |
型T に対応するフォーマッターの型 (alias-template) |
C++20 |
実装例
namespace std {
template<class Out, class charT>
class basic_format_context {
basic_format_args<basic_format_context> args_;
Out out_;
public:
using iterator = Out;
using char_type = charT;
template<class T> using formatter_type = formatter<T, charT>;
basic_format_arg<basic_format_context> arg(size_t id) const
{
return args_.get(id);
}
std::locale locale();
iterator out();
{
return out_;
}
void advance_to(iterator it)
{
out_ = it;
}
};
}
バージョン
言語
処理系
参照