Skip to content

Commit 80530ff

Browse files
committed
expectedのコンストラクタ : 制約を見直し
1 parent 89b841a commit 80530ff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

reference/expected/expected/op_constructor.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ constexpr bool converts-from-any-cvref =
7373
- (4) : 次の制約を全て満たすこと
7474
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<T, const U&> == true`
7575
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<E, const G&> == true`
76-
- `converts-from-any-cvref<T, expected<U, G>> == false`
76+
- `T`が cv `bool` でない場合、`converts-from-any-cvref<T, expected<U, G>> == false`
7777
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, expected<U, G>&> == false`
7878
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, expected<U, G>> == false`
7979
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, const expected<U, G>&> == false`
8080
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, const expected<U, G>> == false`
8181
- (5) : 次の制約を全て満たすこと
8282
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<T, U> == true`
8383
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<E, G> == true`
84-
- `converts-from-any-cvref<T, expected<U, G>> == false`
84+
- `T`が cv `bool` でない場合、`converts-from-any-cvref<T, expected<U, G>> == false`
8585
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, expected<U, G>&> == false`
8686
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, expected<U, G>> == false`
8787
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<`[`unexpected`](../unexpected.md)`<E>, const expected<U, G>&> == false`
@@ -91,6 +91,7 @@ constexpr bool converts-from-any-cvref =
9191
- [`is_same_v`](/reference/type_traits/is_same.md)`<expected,` [`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<U>> == false`
9292
- [`is_same_v`](/reference/type_traits/is_same.md)`<`[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<U>,` [`unexpect_t`](../unexpect_t.md)`> == false`
9393
- [`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<U>`[`unexpected`](../unexpected.md)の特殊化でない
94+
- `T`が cv `bool` の場合、[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<U>``expected`の特殊化でない
9495
- [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<T, U> == true`
9596
- (7) : [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<E, const G&> == true`
9697
- (8) : [`is_constructible_v`](/reference/type_traits/is_constructible.md)`<E, G> == true`
@@ -320,5 +321,7 @@ int main()
320321
321322
## 参照
322323
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
324+
- [LWG Issue 3836. `std::expected<bool, E1>` conversion constructor `expected(const expected<U, G>&)` should take precedence over `expected(U&&)` with operator bool](https://cplusplus.github.io/LWG/issue3836)
325+
- C++23で、`T`が cv `bool` のときに変換コンストラクタ(4)(5)が単一値コンストラクタ(6)に優先されるよう、(4)(5)の`converts-from-any-cvref`制約に「`T`が cv `bool` でない場合」の条件を付け、(6)に「`T`が cv `bool` の場合、`remove_cvref_t<U>`は`expected`の特殊化でない」制約を追加した
323326
- [LWG Issue 4222. `expected` constructor from a single value missing a constraint](https://cplusplus.github.io/LWG/issue4222)
324327
- C++26で、(6)の制約に[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<U>`が[`unexpect_t`](../unexpect_t.md)でないことが追加された

0 commit comments

Comments
 (0)