Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
373f49d
commit 74662b4
Showing
8 changed files
with
198 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# format | ||
* format[meta header] | ||
* function[meta id-type] | ||
* std[meta namespace] | ||
* range_formatter[meta class] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
template <ranges::input_range R, class FormatContext> | ||
requires formattable<ranges::range_reference_t<R>, charT> && | ||
same_as<remove_cvref_t<ranges::range_reference_t<R>>, T> | ||
typename FormatContext::iterator | ||
format(R&& r, FormatContext& ctx) const; // (1) | ||
``` | ||
* FormatContext[link /reference/format/basic_format_context.md] | ||
* ranges::input_range[link /reference/ranges/input_range.md] | ||
* ranges::range_reference_t[link /reference/ranges/range_reference_t.md] | ||
## 概要 | ||
受け取ったRangeオブジェクト`R`を書式化する。 | ||
## 効果 | ||
- [`parse()`](parse.md)メンバ関数で解析した書式文字列の指定に基づいて、`r`の値を文字列に変換し、以下を[`ctx.out()`](/reference/format/basic_format_context/out.md)に出力する: | ||
- Range書式として[`s` (文字列として出力)](/reference/format/format.md#range-format-options)が指定された場合、[`basic_string`](/reference/string/basic_string.md)`<charT>(`[`from_range`](/reference/ranges/from_range_t.md.nolink)`, r)`を出力する | ||
- そうでなく、Range書式として[`?s` (デバッグ文字列として出力)](/reference/format/format.md#range-format-options)が指定された場合、[`basic_string`](/reference/string/basic_string.md)`<charT>(`[`from_range`](/reference/ranges/from_range_t.md.nolink)`, r)`に引用符を付け、エスケープシーケンスをエスケープして出力する | ||
- そうでなければ、 | ||
- 開きカッコを出力する | ||
- Range `r`の各要素`e`について、 | ||
- [`underlying()`](underlying.md)の[`formatter`](/reference/format/formatter.md)で`e`を書式化して出力する | ||
- 最後の要素でなければ、区切り文字を出力する | ||
- 閉じカッコを出力する | ||
## 戻り値 | ||
出力がおわった位置の出力イテレータを返す。 | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# parse | ||
* format[meta header] | ||
* function[meta id-type] | ||
* std[meta namespace] | ||
* range_formatter[meta class] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
template <class ParseContext> | ||
constexpr typename ParseContext::iterator | ||
parse(ParseContext& ctx); | ||
``` | ||
* ParseContext[link /reference/format/basic_format_parse_context.md] | ||
## 概要 | ||
書式文字列の範囲`[ctx.begin(), ctx.end())`を解析する。 | ||
## 効果 | ||
- [`std::format()`](/reference/format/format.md)関数ページに記載されている「[Range・シーケンスコンテナの書式](/reference/format/format.md#range-format-options)」および「[連想コンテナの書式](/reference/format/format.md#assoc-format-options)」を解析する | ||
- このとき、書式によって以下を設定する | ||
- `n`オプション (囲み文字をなくす) が指定されなければ、全体の囲み文字を、[`set_brackets()`](set_brackets.md)メンバ関数で設定する | ||
- 要素の区切り文字を、[`set_separator()`](set_separator.md)メンバ関数で設定する | ||
- 要素に対する書式が空でなければ、各要素の[`formatter`](/reference/format/formatter.md)を`e`として、[`e.set_debug_format()`](/reference/format/formatter/set_debug_format.md)が有効な式であれば、それを呼び出してデバッグ書式を有効にする | ||
## 戻り値 | ||
`ctx`のうち、解析がおわった位置を指すイテレータを返す。 | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# set_brackets | ||
* format[meta header] | ||
* function[meta id-type] | ||
* std[meta namespace] | ||
* range_formatter[meta class] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr void | ||
set_brackets(basic_string_view<charT> opening, | ||
basic_string_view<charT> closing); // (1) | ||
``` | ||
## 概要 | ||
全体の囲み文字を設定する。 | ||
このメンバ関数は、[`std::format()`](/reference/format/format.md)関数の「[Range・シーケンスコンテナの書式](/reference/format/format.md#range-format-options)」および「[連想コンテナの書式](/reference/format/format.md#assoc-format-options)」において囲み文字を変更するオプションを指定することで自動的に呼び出される。 | ||
- Range・シーケンスコンテナのデフォルトの開きカッコは`"["`、閉じカッコは`"]"` | ||
- 連想コンテナのデフォルトの開きカッコは`"{"`、閉じカッコは`"}"` | ||
## 効果 | ||
`opening`を開きカッコ、`closing`を閉じカッコとして設定する。 | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# set_separator | ||
* format[meta header] | ||
* function[meta id-type] | ||
* std[meta namespace] | ||
* range_formatter[meta class] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr void | ||
set_separator(basic_string_view<charT> sep); // (1) | ||
``` | ||
## 概要 | ||
要素の区切り文字を設定する。 | ||
このメンバ関数は、[`std::format()`](/reference/format/format.md)関数の「[Range・シーケンスコンテナの書式](/reference/format/format.md#range-format-options)」および「[連想コンテナの書式](/reference/format/format.md#assoc-format-options)」において区切り文字を変更するオプションを指定することで自動的に呼び出される。 | ||
デフォルトの区切り文字は`", "`である。 | ||
## 効果 | ||
`sep`を区切り文字として設定する。 | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# underlying | ||
* format[meta header] | ||
* function[meta id-type] | ||
* std[meta namespace] | ||
* range_formatter[meta class] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr formatter<T, charT>& underlying(); // (1) C++23 | ||
constexpr const formatter<T, charT>& underlying() const; // (2) C++23 | ||
``` | ||
* formatter[link /reference/format/formatter.md] | ||
|
||
## 概要 | ||
Rangeの要素型に対する[`formatter`](/reference/format/formatter.md)を取得する。 | ||
|
||
- (1) : 非const版 | ||
- (2) : const版 | ||
|
||
|
||
## 戻り値 | ||
メンバ変数として保持している、Rangeの要素型に対する[`formatter`](/reference/format/formatter.md)を返す。 | ||
|
||
|
||
## バージョン | ||
### 言語 | ||
- C++23 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
|