Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<format> : range_formatとformat_kindを追加 #1085
- Loading branch information
1 parent
333f723
commit dc3a27e
Showing
42 changed files
with
128 additions
and
49 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
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
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,64 @@ | ||
# format_kind | ||
* format[meta header] | ||
* std[meta namespace] | ||
* variable[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template <class R> | ||
constexpr unspecified format_kind = unspecified; // (1) C++23 | ||
|
||
template <ranges::input_range R> | ||
requires same_as<R, remove_cvref_t<R>> | ||
constexpr range_format format_kind<R> = see below; // (2) C++23 | ||
} | ||
``` | ||
* range_format[link range_format.md] | ||
* ranges::input_range[link /reference/ranges/input_range.md] | ||
## 概要 | ||
Rangeの書式種別を取得する変数テンプレート。 | ||
- (1) プライマリテンプレート。これがインスタンス化されたらプログラムは不適格となる | ||
- (2) 入力Rangeの型Rに応じて、書式種別を取得する | ||
## 適格要件 | ||
- (2) : 入力Rangeの型`R`は、const/volatileおよび参照で修飾されていないこと | ||
## 効果 | ||
以下、(2)について記載する。 | ||
- [`same_as`](/reference/concepts/same_as.md)`<`[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<`[`ranges::range_reference_t`](/reference/ranges/range_reference_t.md)`<R>>, R>`が`true`である場合、値[`range_format::disabled`](range_format.md)をもつ | ||
- 例として、[`std::filesystem::path`](/reference/filesystem/path.md)のような再帰的な型がこれに相当する | ||
- `R::key_type`が有効な式である場合 ([`std::map`](/reference/map/map.md)や[`std::set`](/reference/set/set.md)が相当する)、 | ||
- `R::mapped_type`が有効な式であり、[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<`[`ranges::range_reference_t`](/reference/ranges/range_reference_t.md)`<R>>`を`U`として、`U`が[`std::pair`](/reference/utility/pair.md)の特殊化もしくは`U`が[`std::tuple`](/reference/tuple/tuple.md)の特殊化で要素数が2の場合、値[`range_format::map`](range_format.md)をもつ | ||
- そうでない場合、値[`range_format::set`](range_format.md)をもつ | ||
- そうでない場合、値[`range_format::sequence`](range_format.md)をもつ | ||
## 備考 | ||
- ユーザーは、この型の特殊化を定義できる | ||
- ただし、その特殊化は定数式であり、型として`const` [`range_format`](range_format.md)をもつこと | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
## 関連項目 | ||
- [`format_kind`](range_format.md) | ||
- [`formatter`](formatter.md) | ||
## 参照 | ||
- [P2286R8 Formatting Ranges](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2286r8.html) | ||
- [P2585R1 Improve default container formatting](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2585r1.html) |
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,55 @@ | ||
# range_format | ||
* format[meta header] | ||
* std[meta namespace] | ||
* enum[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
enum class range_format { | ||
disabled, | ||
map, | ||
set, | ||
sequence, | ||
string, | ||
debug_string | ||
}; | ||
} | ||
``` | ||
## 概要 | ||
Rangeの書式種別を表す列挙型。 | ||
| 列挙値 | 説明 | | ||
|----------------|------| | ||
| `disabled` | 書式化ができないRangeであることを表す値 | | ||
| `map` | [`std::map`](/reference/map/map.md)や[`std::flat_map`](/reference/flat_map/flat_map.md.nolink)向けの書式。`{k1: v1, k2: v2}` | | ||
| `set` | [`std::set`](/reference/set/set.md)や[`std::flat_set`](/reference/flat_set/flat_set.md.nolink)向けの書式。`{v1, v2}` | | ||
| `sequence` | [`std::vector`](/reference/vector/vector.md)や[`std::array`](/reference/array/array.md)向けの書式。`[v1, v2]`| | ||
| `string` | 文字列向けの書式。`abc` | | ||
| `debug_string` | デバッグ文字列向けの書式。`\nabc` | | ||
## 備考 | ||
- `disable`は値0であるため、`bool`型に変換して有効かどうかを判定するための使用できる | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? | ||
## 関連項目 | ||
- [`format_kind`](format_kind.md) | ||
- [`formatter`](formatter.md) | ||
## 参照 | ||
- [P2286R8 Formatting Ranges](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2286r8.html) | ||
- [P2585R1 Improve default container formatting](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2585r1.html) |
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
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
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
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
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
Oops, something went wrong.