Skip to content

Commit 6b4433b

Browse files
committed
chrono: C++26対応としてハッシュサポートを追加 (close #1180)
1 parent 3af3684 commit 6b4433b

20 files changed

+259
-23
lines changed

lang/cpp26.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ C++26とは、2026年中に改訂される予定の、C++バージョンの通
139139

140140

141141
### 日付・時間
142-
- [`<chrono>`](/reference/chrono.md)の以下のクラスに[`std::hash`](/reference/functional/hash.md)のサポートを追加
142+
- [`<chrono>`](/reference/chrono.md)の以下のクラスに、ハッシュ値サポートとして[`std::hash`](/reference/functional/hash.md)の特殊化を追加
143143
- [`std::chrono::duration`](/reference/chrono/duration.md)
144144
- [`std::chrono::time_point`](/reference/chrono/time_point.md)
145145
- [`std::chrono::day`](/reference/chrono/day.md)

reference/chrono/day.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ namespace std::chrono {
102102
| [`d`](day/op_d.md) | 日リテラル | C++20 |
103103
104104
105-
## 文字列フォーマット
105+
## 文字列フォーマットサポート
106106
107107
| 名前 | 説明 | 対応バージョン |
108108
|------|------|----------------|
109109
| [`formatter`](day/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
110110
111111
112+
## ハッシュサポート
113+
114+
| 名前 | 説明 | 対応バージョン |
115+
|-------|--------------------|----------------|
116+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
117+
| `template<> struct hash<chrono::day>;` | `hash`クラスの`day`に対する特殊化 | C++26 |
118+
119+
112120
## 例
113121
```cpp example
114122
#include <iostream>
@@ -150,3 +158,7 @@ Mar/01
150158
- [GCC](/implementation.md#gcc): 9.2 [mark noimpl]
151159
- [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl]
152160

161+
162+
## 参照
163+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
164+
- C++26でハッシュサポートが追加された

reference/chrono/duration.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,26 @@ namespace chrono {
144144
| [`h`](duration/op_h.md) | 時リテラル | C++14 |
145145
146146
147-
## 特殊化
147+
## 共通型サポート
148148
149149
| 名前 | 説明 | 対応バージョン |
150150
|-------|--------------------|----------------|
151-
| [`common_type`](common_type.md) | 異なる`duration`間の共通の型を求める | C++11 |
152-
| [`formatter`](duration/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化。文字列フォーマットの許可 | C++20 |
151+
| [`common_type`](common_type.md) | 異なる`duration`間の共通の型を求める[`std::common_type`](/reference/type_traits/common_type.md)の特殊化 | C++11 |
152+
153+
154+
## 文字列フォーマットサポート
155+
156+
| 名前 | 説明 | 対応バージョン |
157+
|-------|--------------------|----------------|
158+
| [`formatter`](duration/formatter.md) | 文字列フォーマットの許可。[`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
159+
160+
161+
## ハッシュサポート
162+
163+
| 名前 | 説明 | 対応バージョン |
164+
|-------|--------------------|----------------|
165+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
166+
| `template<class Rep, class Period>`<br/> `struct hash<chrono::duration<Rep, Period>>;` | `hash`クラスの`duration`に対する特殊化。`hash<Rep>`が有効な場合のみ有効 | C++26 |
153167
154168
155169
## 例
@@ -208,3 +222,5 @@ Tue Oct 16 16:25:11 2012
208222
- [Visual C++](/implementation.md#visual_cpp): 2012 [mark verified], 2013 [mark verified], 2015 [mark verified]
209223

210224
## 参照
225+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
226+
- C++26でハッシュサポートが追加された

reference/chrono/leap_second.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ namespace std::chrono {
4747
| [`operator>=`](leap_second/op_greater_equal.md) | 左辺が右辺以上を判定する | C++20 |
4848
4949
50+
## ハッシュサポート
51+
52+
| 名前 | 説明 | 対応バージョン |
53+
|-------|--------------------|----------------|
54+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
55+
| `template<> struct hash<chrono::leap_second>;` | `hash`クラスの`leap_second`に対する特殊化 | C++26 |
56+
57+
5058
## 例
5159
```cpp example
5260
#include <iostream>
@@ -117,4 +125,5 @@ int main()
117125
- [P1981R0 Rename `leap` to `leap_second`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1981r0.html)
118126
- C++20の策定中、National Body Commentとして`leap`というクラス名は一般的すぎて説明的ではないと指摘があり、`leap_second`に名称変更された
119127
- [LWG Issue 3359. `<chrono>` leap second support should allow for negative leap seconds](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2117r0.html#3359)
120-
128+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
129+
- C++26でハッシュサポートが追加された

reference/chrono/month.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,21 @@ namespace std::chrono {
9494
| [`from_stream`](month/from_stream.md) | フォーマット指定して入力ストリームから入力する | C++20 |
9595
9696
97-
## 文字列フォーマット
97+
## 文字列フォーマットサポート
9898
9999
| 名前 | 説明 | 対応バージョン |
100100
|------|------|----------------|
101101
| [`formatter`](month/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
102102
103103
104+
## ハッシュサポート
105+
106+
| 名前 | 説明 | 対応バージョン |
107+
|-------|--------------------|----------------|
108+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
109+
| `template<> struct hash<chrono::month>;` | `hash`クラスの`month`に対する特殊化 | C++26 |
110+
111+
104112
## 例
105113
```cpp example
106114
#include <iostream>
@@ -140,3 +148,8 @@ Jun
140148

141149
## 関連項目
142150
- [月の定数](month_constants.md)
151+
152+
153+
## 参照
154+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
155+
- C++26でハッシュサポートが追加された

reference/chrono/month_day.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,21 @@ namespace std::chrono {
7171
| [`from_stream`](month_day/from_stream.md) | フォーマット指定して入力ストリームから入力する | C++20 |
7272
7373
74-
## 文字列フォーマット
74+
## 文字列フォーマットサポート
7575
7676
| 名前 | 説明 | 対応バージョン |
7777
|------|------|----------------|
7878
| [`formatter`](month_day/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
7979
8080
81+
## ハッシュサポート
82+
83+
| 名前 | 説明 | 対応バージョン |
84+
|-------|--------------------|----------------|
85+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
86+
| `template<> struct hash<chrono::month_day>;` | `hash`クラスの`month_day`に対する特殊化 | C++26 |
87+
88+
8189
## 例
8290
```cpp example
8391
#include <iostream>
@@ -127,3 +135,8 @@ Mar/01
127135
- [Clang](/implementation.md#clang): 8.0 (入出力ストリームなし) [mark verified]
128136
- [GCC](/implementation.md#gcc): 9.2 [mark noimpl]
129137
- [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl]
138+
139+
140+
## 参照
141+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
142+
- C++26でハッシュサポートが追加された

reference/chrono/month_day_last.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,21 @@ namespace std::chrono {
7171
| [`operator<<`](month_day_last/op_ostream.md) | 出力ストリームに出力する | C++20 |
7272
7373
74-
## 文字列フォーマット
74+
## 文字列フォーマットサポート
7575
7676
| 名前 | 説明 | 対応バージョン |
7777
|------|------|----------------|
7878
| [`formatter`](month_day_last/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
7979
8080
81+
## ハッシュサポート
82+
83+
| 名前 | 説明 | 対応バージョン |
84+
|-------|--------------------|----------------|
85+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
86+
| `template<> struct hash<chrono::month_day_last>;` | `hash`クラスの`month_day_last`に対する特殊化 | C++26 |
87+
88+
8189
## 例
8290
```cpp example
8391
#include <iostream>
@@ -121,3 +129,8 @@ Mar/last
121129
- [Clang](/implementation.md#clang): 8.0 (出力ストリームなし) [mark verified]
122130
- [GCC](/implementation.md#gcc): 11.1 (出力ストリームなし) [mark verified]
123131
- [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl]
132+
133+
134+
## 参照
135+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
136+
- C++26でハッシュサポートが追加された

reference/chrono/month_weekday.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,21 @@ namespace std::chrono {
6767
| [`operator<<`](month_weekday/op_ostream.md) | 出力ストリームに出力する | C++20 |
6868
6969
70-
## 文字列フォーマット
70+
## 文字列フォーマットサポート
7171
7272
| 名前 | 説明 | 対応バージョン |
7373
|------|------|----------------|
7474
| [`formatter`](month_weekday/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
7575
7676
77+
## ハッシュサポート
78+
79+
| 名前 | 説明 | 対応バージョン |
80+
|-------|--------------------|----------------|
81+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
82+
| `template<> struct hash<chrono::month_weekday>;` | `hash`クラスの`month_weekday`に対する特殊化 | C++26 |
83+
84+
7785
## 例
7886
```cpp example
7987
#include <iostream>
@@ -135,3 +143,8 @@ Mar/Sun[1]
135143
- [Clang](/implementation.md#clang): 8.0 (出力ストリームなし) [mark verified]
136144
- [GCC](/implementation.md#gcc): 11.1 (出力ストリームなし) [mark verified]
137145
- [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl]
146+
147+
148+
## 参照
149+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
150+
- C++26でハッシュサポートが追加された

reference/chrono/month_weekday_last.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,21 @@ namespace std::chrono {
6767
| [`operator<<`](month_weekday_last/op_ostream.md) | 出力ストリームに出力する | C++20 |
6868
6969
70-
## 文字列フォーマット
70+
## 文字列フォーマットサポート
7171
7272
| 名前 | 説明 | 対応バージョン |
7373
|------|------|----------------|
7474
| [`formatter`](month_weekday_last/formatter.md) | [`std::formatter`](/reference/format/formatter.md)クラスの特殊化 | C++20 |
7575
7676
77+
## ハッシュサポート
78+
79+
| 名前 | 説明 | 対応バージョン |
80+
|-------|--------------------|----------------|
81+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
82+
| `template<> struct hash<chrono::month_weekday_last>;` | `hash`クラスの`month_weekday_last`に対する特殊化 | C++26 |
83+
84+
7785
## 例
7886
```cpp example
7987
#include <iostream>
@@ -135,3 +143,8 @@ Mar/Sun[last]
135143
- [Clang](/implementation.md#clang): 8.0 (出力ストリームなし) [mark verified]
136144
- [GCC](/implementation.md#gcc): 11.1 (出力ストリームなし) [mark verified]
137145
- [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl]
146+
147+
148+
## 参照
149+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
150+
- C++26でハッシュサポートが追加された

reference/chrono/time_point.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,19 @@ namespace chrono {
9191
| [`operator>`](time_point/op_greater.md) | 左辺が右辺より大きいか比較を行う | C++11 |
9292
| [`operator>=`](time_point/op_greater_equal.md) | 左辺が右辺以上かの比較を行う | C++11 |
9393
94-
### common_type特殊化
94+
## 共通型サポート
9595
9696
| 名前 | 説明 | 対応バージョン |
9797
|-------|--------------------|----------------|
9898
| [`common_type`](common_type.md) | 異なる`time_point`間の共通の型を求める | C++11 |
9999
100+
## ハッシュサポート
101+
102+
| 名前 | 説明 | 対応バージョン |
103+
|-------|--------------------|----------------|
104+
| `template <class T> struct hash;` | `hash`クラスの先行宣言 | C++26 |
105+
| `template<class Clock, class Duration>`<br/> `struct hash<chrono::time_point<Clock, Duration>>;` | `hash`クラスの`time_point`に対する特殊化。`hash<Duration>`が有効な場合のみ有効 | C++26 |
106+
100107
101108
## 例
102109
```cpp example
@@ -138,4 +145,5 @@ Thu Jul 18 13:46:26 2013
138145
- [Visual C++](/implementation.md#visual_cpp): 2012 [mark verified], 2013 [mark verified], 2015 [mark verified]
139146

140147
## 参照
141-
148+
- [P2592R3 Hashing support for `std::chrono` value classes](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2592r3.html)
149+
- C++26でハッシュサポートが追加された

0 commit comments

Comments
 (0)