Skip to content

Commit

Permalink
optional, tuple, pair, variant : C++26対応としてテンプレートパラメータ制約を整理 #1340
Browse files Browse the repository at this point in the history
  • Loading branch information
faithandbrave committed Sep 17, 2024
1 parent 9437e4e commit fe9f6f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions reference/optional/optional/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace std {
`optional`オブジェクトの等値比較を行う。
## 要件
- (1), (3), (4) : 型`T`が`==`で比較可能であること
## テンプレートパラメータ制約
- (1), (3), (4) : 型`T`が`==`で比較可能であり、その戻り値型が`bool`に変換可能であること
## 戻り値
Expand Down Expand Up @@ -114,3 +114,5 @@ int main()
- [LWG Issue 2934. `optional<const T>` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934)
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- [P2944R3 Comparisons for `reference_wrapper`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2944r3.html)
- C++26でテンプレートパラメータ制約が整理された
4 changes: 3 additions & 1 deletion reference/tuple/tuple/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace std {
2つの[`tuple`](../tuple.md)オブジェクトの等値比較を行う。また、[`tuple-like`](../tuple-like.md)なオブジェクトとの等値比較を行う。(C++23以降)
## 要件
## テンプレートパラメータ制約
- (1) :
- 2つの[`tuple`](../tuple.md)オブジェクトの要素数が同じであること。(具体的には`sizeof...(TTypes) == sizeof...(UTypes)`であること。)
- [`tuple`](../tuple.md)の要素`std::`[`get`](get.md)`<i>(t)`と`std::`[`get`](get.md)`<i>(u)`において、すべての要素の比較 `std::`[`get`](get.md)`<i>(t) == std::`[`get`](get.md)`<i>(u)` の比較結果が`bool`に変換可能な型(C++23 以降は[`boolean-testable`](/reference/concepts/boolean-testable.md)を満たせばよい)であること。
Expand Down Expand Up @@ -94,3 +94,5 @@ false
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- [P2165R4 Compatibility between `tuple`, `pair` and *tuple-like* objects](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2165r4.pdf)
- [P2944R3 Comparisons for `reference_wrapper`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2944r3.html)
- C++26でテンプレートパラメータ制約が整理された
6 changes: 6 additions & 0 deletions reference/utility/pair/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ namespace std {
2つの`pair`の等値比較を行う
## テンプレートパラメータ制約
- 式`x.first == y.first`と`x.second == y.second`が妥当であり、型`decltype(x.first == y.first)`と`decltype(x.second == y.second)`が[boolean-testable](/reference/concepts/boolean-testable.md)のモデルであること
## 戻り値
```cpp
return x.first == y.first && x.second == y.second;
Expand Down Expand Up @@ -65,3 +69,5 @@ false
- [N3471 Constexpr Library Additions: utilities, v3](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3471.html)
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
- C++20での三方比較演算子の追加と、関連する演算子の自動導出
- [P2944R3 Comparisons for `reference_wrapper`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2944r3.html)
- C++26でテンプレートパラメータ制約が整理された
2 changes: 2 additions & 0 deletions reference/variant/variant/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ int main()

## 参照
- [P0393R3 Making Variant Greater Equal](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0393r3.html)
- [P2944R3 Comparisons for `reference_wrapper`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2944r3.html)
- C++26でテンプレートパラメータ制約が整理された

0 comments on commit fe9f6f7

Please sign in to comment.