Skip to content

Commit d548d89

Browse files
committed
補足説明を追加
1 parent f71ba40 commit d548d89

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

reference/format/basic_format_context.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ namespace std {
2626
## テンプレートパラメータ制約
2727
- `Out`は`OutputIterator<const charT&>`であること
2828
29+
## 備考
30+
31+
出力イテレータの型はフォーマット関数に指定したイテレータである必要はない。内部でバッファリングを行う実装が可能である。
2932
3033
## メンバ関数
3134
@@ -51,26 +54,33 @@ namespace std {
5154
class basic_format_context {
5255
basic_format_args<basic_format_context> args_;
5356
Out out_;
57+
std::optional<std::locale> locale;
5458
5559
public:
5660
using iterator = Out;
5761
using char_type = charT;
5862
template<class T> using formatter_type = formatter<T, charT>;
5963
60-
basic_format_arg<basic_format_context> arg(size_t id) const
64+
basic_format_context(iterator out, std::basic_format_args<basic_format_context> args, std::optional<std::locale> locale = std::nullopt)
65+
:args_(args)
66+
,out_(out)
67+
,locale_(locale)
6168
{
69+
}
70+
71+
basic_format_arg<basic_format_context> arg(size_t id) const {
6272
return args_.get(id);
6373
}
6474
65-
std::locale locale();
75+
std::locale locale() {
76+
return locale_.value_or(std::locale());
77+
}
6678
67-
iterator out();
68-
{
79+
iterator out() {
6980
return out_;
7081
}
7182
72-
void advance_to(iterator it)
73-
{
83+
void advance_to(iterator it) {
7484
out_ = it;
7585
}
7686
};

0 commit comments

Comments
 (0)