Skip to content

Commit 054ed84

Browse files
authored
Merge pull request #1489 from cpprefjp/p3557r3
execution: C++26 P3557R3対応
2 parents 715c5f9 + 7b6fa9e commit 054ed84

40 files changed

+744
-267
lines changed

reference/execution/execution.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ namespace std::execution {
8282
| [`execution::default_domain`](execution/default_domain.md) | デフォルト実行ドメイン (class) | C++26 |
8383
| [`execution::sender`](execution/sender.md) | Sender型 (concept) | C++26 |
8484
| [`execution::sender_in`](execution/sender_in.md) | 指定環境で有効なSender (concept) | C++26 |
85+
| [`execution::dependent_sender`](execution/dependent_sender.md) | 依存Sender (concept) | C++26 |
8586
| [`execution::sender_to`](execution/sender_to.md) | 指定Receiverに接続可能なSender (concept) | C++26 |
86-
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md) | Senderの完了シグネチャ集合を取得 (customization point object) | C++26 |
87-
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderの完了シグネチャ集合を取得 (alias template) | C++26 |
8887
| [`execution::value_types_of_t`](execution/value_types_of_t.md) | Senderの値完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
8988
| [`execution::error_types_of_t`](execution/error_types_of_t.md) | Senderのエラー完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
9089
| [`execution::sends_stopped`](execution/sends_stopped.md) | Senderが停止完了を送信しうるか否か (variable template) | C++26 |
@@ -142,6 +141,9 @@ Senderコンシューマは名前空間 `std::this_thread` で定義される。
142141
| 名前 | 説明 | 対応バージョン |
143142
|------|------|----------------|
144143
| [`execution::completion_signatures`](execution/completion_signatures.md) | 完了シグネチャ集合を表現する型 (class template) | C++26 |
144+
| [`execution::dependent_sender_error`](execution/dependent_sender_error.md) | 依存Senderを表す例外クラス(class) | C++26 |
145+
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md) | Senderの完了シグネチャ集合を取得 (function template) | C++26 |
146+
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderの完了シグネチャ集合を取得 (alias template) | C++26 |
145147
| [`execution::run_loop`](execution/run_loop.md) | 単一スレッド上でのループ実行 (class) | C++26 |
146148
147149
### コルーチンユーティリティ

reference/execution/execution/basic-operation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace std::execution {
3939
```
4040
* operation_state_t[link operation_state.md]
4141
* tag_of_t[link tag_of_t.md]
42+
* indices-for[link basic-sender.md]
4243
* impls-for[link impls-for.md]
4344
* std::move[link /reference/utility/move.md]
4445

@@ -60,6 +61,7 @@ is_nothrow_constructible_v<basic-state<Self, Rcvr>, Self, Rcvr> &&
6061
noexcept(connect-all(this, std::forward<Sndr>(sndr), indices-for<Sndr>()))
6162
```
6263
* is_nothrow_constructible_v[link /reference/type_traits/is_nothrow_constructible.md]
64+
* indices-for[link basic-sender.md]
6365
6466
`basic-state`コンストラクタ`noexcept`節の式は下記の通り。
6567
@@ -101,13 +103,11 @@ constexpr auto connect-all = see below; // exposition only
101103
template<class Sndr, class Rcvr>
102104
using connect-all-result = call-result-t< // exposition only
103105
decltype(connect-all), basic-state<Sndr, Rcvr>*, Sndr, indices-for<Sndr>>;
104-
105-
template<class Sndr>
106-
using indices-for = remove_reference_t<Sndr>::indices-for; // exposition only
107106
```
108107
* call-result-t[link /reference/functional/call-result-t.md]
109108
* impls-for[link impls-for.md]
110109
* tag_of_t[link tag_of_t.md]
110+
* indices-for[link basic-sender.md]
111111
112112
説明専用の定数`connect-all`は、下記ラムダ式と等価な関数呼び出し可能なオブジェクトとして初期化される。
113113

reference/execution/execution/basic-sender.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ namespace std::execution {
2222
return {std::forward<Self>(self), std::move(rcvr)};
2323
}
2424

25-
template<decays-to<basic-sender> Self, class Env>
26-
auto get_completion_signatures(this Self&& self, Env&& env) noexcept
27-
-> completion-signatures-for<Self, Env> {
28-
return {};
29-
}
25+
template<decays-to<basic-sender> Self, class... Env>
26+
static constexpr auto get_completion_signatures();
3027
};
3128
}
3229
```
@@ -62,19 +59,35 @@ is_nothrow_constructible_v<basic-operation<Self, Rcvr>, Self, Rcvr>
6259
* is_nothrow_constructible_v[link /reference/type_traits/is_nothrow_constructible.md]
6360
* basic-operation[link basic-operation.md]
6461

65-
説明専用のエイリアステンプレート`completion-signatures-for`は、下記の通り定義される。
62+
### `get_completion_signatures`メンバ関数
63+
```cpp
64+
template<class Tag, class Data, class... Child>
65+
template<class Sndr, class... Env>
66+
constexpr auto basic-sender<Tag, Data, Child...>::get_completion_signatures();
67+
```
68+
69+
型`E`をリスト`Env...,` [`env<>`](env.md)における先頭の型としたとき、[環境](../queryable.md)`E`をもつ[Receiver](receiver.md)型を`Rcvr`とする。式`CHECK-TYPE()`を[`impls-for`](impls-for.md)`<Tag>::template check-types<Sndr, E>()`とし、型`CS`を下記の通り定義する。
70+
71+
- `CHECK-TYPE()`がコア定数式のとき、`op`を[`connect_result_t`](connect_result_t.md)`<Sndr, Rcvr>`型の左辺値とする。`CS`は[`completion_signatures`](completion_signatures.md)の特殊化となり、そのテンプレート引数の集合は評価`op.`[`start()`](start.md)の結果結果として得られる完了操作の集合に対応する。
72+
- そうでなければ、`CS`は[`completion_signatures<>`](completion_signatures.md)となる。
73+
74+
テンプレートパラメータ制約 : 式`CHECK-TYPES()`が適格であること。
75+
76+
効果:下記と等価。
6677
6778
```cpp
68-
template<class Sndr, class Env>
69-
using completion-signatures-for = see below; // exposition only
79+
CHECK-TYPES();
80+
return CS();
7081
```
7182

72-
説明用の`sndr`を`decltype((sndr))`が`Sndr`型となる式、`rcvr`を[`sender_in`](sender_in.md)`<Sndr, Env> == true`となる[環境](../queryable.md)`Env`に関連付けられた[`Receiver`](receiver.md)とする。
7383

74-
`completion-signatures-for<Sndr, Env>`は[`completion_signatures`](completion_signatures.md)の特殊化であり、そのテンプレート引数は `sndr`と`rcvr`との[接続(connect)](connect.md)結果[Operation State](operation_state.md)を[開始(start)](start.md)して得られる可能性のある結果の完了シグネチャ集合となる。
84+
## 説明専用エンティティ
85+
説明専用のエイリアステンプレート`indices-for`を下記の通り定義する。
7586

76-
[`sender_in`](sender_in.md)`<Sndr, Env> == false`となる場合、`completion-signatures-for<Sndr, Env>`は[`completion_signatures`](completion_signatures.md)の特殊化ではない別の型となる。
77-
処理系(標準ライブラリ実装者)は、この型を用いてユーザにエラー理由を通知することが推奨される。
87+
```cpp
88+
template<class Sndr>
89+
using indices-for = remove_reference_t<Sndr>::indices-for; // exposition only
90+
```
7891

7992

8093
## バージョン
@@ -84,10 +97,12 @@ using completion-signatures-for = see below; // exposition only
8497

8598
## 関連項目
8699
- [`make-sender`](make-sender.md)
100+
- [`impls-for`](impls-for.md)
87101
- [`basic-operation`](basic-operation.md)
88102
- [`execution::sender`](sender.md)
89103

90104

91105
## 参照
92106
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
93107
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
108+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)

reference/execution/execution/bulk.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ namespace std::execution {
4444
template<>
4545
struct impls-for<bulk_t> : default-impls {
4646
static constexpr auto complete = see below;
47+
48+
template<class Sndr, class... Env>
49+
static consteval void check-types();
4750
};
4851
}
4952
```
@@ -75,6 +78,26 @@ namespace std::execution {
7578

7679
`Tag`[`set_value_t`](set_value.md)以外の型であるとき、もしくは式`f(auto(shape), args...)`が適格なときに限って、上記ラムダ式のrequires節が満たされる。
7780

81+
メンバ関数`impls-for<bulk_t>::check-types`の効果は下記の通り。
82+
83+
```cpp
84+
auto cs = get_completion_signatures<child-type<Sndr>, FWD-ENV-T(Env)...>();
85+
auto fn = []<class... Ts>(set_value_t(*)(Ts...)) {
86+
if constexpr (!invocable<remove_cvref_t<data-type<Sndr>>, Ts&...>)
87+
throw unspecified-exception();
88+
};
89+
cs.for-each(overload-set{fn, [](auto){}});
90+
```
91+
* get_completion_signatures[link get_completion_signatures.md]
92+
* child-type[link child-type.md]
93+
* FWD-ENV-T[link ../forwarding_query.md]
94+
* set_value_t[link set_value.md]
95+
* data-type[link data-type.md]
96+
* for-each[link completion_signatures.md]
97+
* overload-set[link overload-set.md]
98+
99+
`unspecified-exception`は[`exception`](/reference/exception/exception.md)から派生した型となる。
100+
78101
79102
## カスタマイゼーションポイント
80103
Senderアルゴリズム構築時および[Receiver](receiver.md)接続時に、関連付けられた実行ドメインに対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
@@ -133,3 +156,4 @@ int main()
133156
## 参照
134157
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
135158
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
159+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)

reference/execution/execution/child-type.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ namespace std::execution {
2222
2323
## 関連項目
2424
- [`execution::schedule_from`](schedule_from.md)
25+
- [`execution::let_value`](let_value.md)
2526
- [`execution::into_variant`](into_variant.md)
27+
- [`execution::stopped_as_optional`](stopped_as_optional.md)
28+
- [`write-env`](write-env.md)
2629
2730
2831
## 参照

reference/execution/execution/completion_signatures.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,31 @@
77
```cpp
88
namespace std::execution {
99
template<completion-signature... Fns>
10-
struct completion_signatures {};
10+
struct completion_signatures {
11+
template<class Tag>
12+
static constexpr size_t count-of(Tag) { return see below; }
13+
14+
template<class Fn>
15+
static constexpr void for-each(Fn&& fn) { // exposition only
16+
(std::forward<Fn>(fn)(static_cast<Fns*>(nullptr)), ...);
17+
}
18+
};
1119
}
1220
```
1321

1422
## 概要
1523
`completion_signatures`クラステンプレートは、完了シグネチャの集合をテンプレートパラメータとして表現する。
1624

17-
実行制御ライブラリ仕様定義では、説明専用のコンセプト`valid-completion-signatures`を利用する
25+
`tag`[decayed](/reference/type_traits/decay.md)型を`Tag`としたとき、説明専用のメンバ関数`count-of``Fns`中の`Tag(Ts...)`形式で表される関数型の個数を返す
1826

27+
28+
### 説明専用のコンセプト `valid-completion-signatures`
1929
```cpp
2030
template<class Sigs>
2131
concept valid-completion-signatures = see below;
2232
```
2333

24-
`Sigs`[`completion_signatures`](completion_signatures.md)クラステンプレートの特殊化であるとき、`Sigs`は説明専用コンセプト`valid-completion-signatures`のモデルである。
34+
`Sigs``completion_signatures`クラステンプレートの特殊化であるとき、`Sigs`は説明専用コンセプト`valid-completion-signatures`のモデルである。
2535

2636

2737
## テンプレートパラメータ制約
@@ -80,11 +90,12 @@ int main()
8090

8191

8292
## 関連項目
83-
- [`execution::receiver`](receiver.md)
93+
- [`execution::get_completion_signatures`](get_completion_signatures.md)
8494
- [`execution::set_value_t`](set_value.md)
8595
- [`execution::set_error_t`](set_error.md)
8696
- [`execution::set_stopped_t`](set_stopped.md)
8797

8898

8999
## 参照
90100
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
101+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)

reference/execution/execution/completion_signatures_of_t.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
```cpp
88
namespace std::execution {
9-
template<class Sndr, class Env = env<>>
10-
requires sender_in<Sndr, Env>
11-
using completion_signatures_of_t = call-result-t<get_completion_signatures_t, Sndr, Env>;
9+
template<class Sndr, class... Env>
10+
requires sender_in<Sndr, Env...>
11+
using completion_signatures_of_t = decltype(get_completion_signatures<Sndr, Env...>());
1212
}
1313
```
14-
* env<>[link env.md]
1514
* sender_in[link sender_in.md]
16-
* call-result-t[link /reference/functional/call-result-t.md]
17-
* get_completion_signatures_t[link get_completion_signatures.md]
15+
* get_completion_signatures[link get_completion_signatures.md]
1816
1917
## 概要
2018
[Sender型](sender.md)`Sndr`から[環境](../queryable.md)`Env`における[完了シグネチャ集合](completion_signatures.md)を取得する。
@@ -37,3 +35,4 @@ namespace std::execution {
3735
3836
## 参照
3937
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
38+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)

reference/execution/execution/connect.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace std::execution {
2323
2424
## 効果
2525
説明用の型`Sndr`を`decltype((sndr))`、型`Rcvr`を`decltype((rcvr))`とし、式`new_sndr`を次の通りとする。
26-
このとき[`sender`](sender.md)`<Sndr> &&` [`receiver`](receiver.md)`<Rcvr> == true`であること。
2726
2827
```cpp
2928
transform_sender(decltype(get-domain-late(sndr, get_env(rcvr))){}, sndr, get_env(rcvr))
@@ -37,6 +36,11 @@ transform_sender(decltype(get-domain-late(sndr, get_env(rcvr))){}, sndr, get_env
3736
- 適格であるならば、式`new_sndr.connect(rcvr)`
3837
- そうでなければ、式`connect-awaitable(new_sndr, rcvr)`
3938

39+
このとき下記が全て`true`であること。
40+
41+
- [`sender_in`](sender_in.md)`<Sndr,` [`env_of_t`](env_of_t.md)`<Rcvr>>`
42+
- [`receiver_of`](receiver_of.md)`<Rcvr,` [`completion_signatures_of_t`](completion_signatures_of_t.md)`<Sndr,` [`env_of_t`](env_of_t.md)`<Rcvr>>>`
43+
4044

4145
### Awaitable接続用へルパ
4246
説明用のクラス`connect-awaitable-promise`, `operation-state-task`をそれぞれ下記の通り定義する。
@@ -108,7 +112,7 @@ namespace std::execution {
108112
* destroy()[link /reference/coroutine/coroutine_handle/destroy.md]
109113
* resume()[link /reference/coroutine/coroutine_handle/resume.md]
110114

111-
`C`型の`c`[コルーチンPromise型](/lang/cpp20/coroutines.md)の左辺値`p`に対して、`await-result-type<C, Promise>``decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c, p).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とする。
115+
`C`型の`c`[コルーチンPromise型](/lang/cpp20/coroutines.md)の左辺値`p`に対して、`await-result-type<C, Promise>``decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c, p).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とし、`await-result-type<C>``decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とする。
112116
`V``await-result-type<DS, connect-awaitable-promise>`とする。
113117

114118
[完了シグネチャ集合型](completion_signatures.md)`Sigs`を下記の通り定義する。
@@ -238,4 +242,5 @@ int main()
238242
## 参照
239243
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
240244
- [P3396R1 std::execution wording fixes](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3396r1.html)
245+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
241246
- [LWG 4208. Wording needs to ensure that in `connect(sndr, rcvr)` that `rcvr` expression is only evaluated once](https://cplusplus.github.io/LWG/issue4208)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# data-type
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* type-alias[meta id-type]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std::execution {
9+
template<class Sndr>
10+
using data-type = decltype(declval<Sndr>().template get<1>()); // exposition only
11+
}
12+
```
13+
* template get[link product-type.md]
14+
15+
## 概要
16+
[Senderアルゴリズム型](basic-sender.md)`Sndr`のデータ型を取得する説明専用のエイリアステンプレート。
17+
18+
19+
## バージョン
20+
### 言語
21+
- C++26
22+
23+
## 関連項目
24+
- [`execution::read_env`](read_env.md)
25+
- [`execution::schedule_from`](schedule_from.md)
26+
- [`execution::then`](then.md)
27+
- [`execution::let_value`](let_value.md)
28+
- [`execution::bulk`](bulk.md)
29+
- [`write-env`](write-env.md)
30+
31+
32+
## 参照
33+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
34+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# decay-copyable-result-datums
2+
* execution[meta header]
3+
* function template[meta id-type]
4+
* std::execution[meta namespace]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
constexpr void decay-copyable-result-datums(auto cs) {
9+
cs.for-each([]<class Tag, class... Ts>(Tag(*)(Ts...)) {
10+
if constexpr (!(is_constructible_v<decay_t<Ts>, Ts> &&...))
11+
throw unspecified-exception();
12+
});
13+
}
14+
```
15+
* for-each[link completion_signatures.md]
16+
* is_constructible_v[link /reference/type_traits/is_constructible.md]
17+
18+
## 概要
19+
`decay-copyable-result-datums`は、Senderアルゴリズム動作仕様定義で用いられる説明専用の関数テンプレートである。
20+
21+
`unspecified-exception`[`exception`](/reference/exception/exception.md)から派生した型となる。
22+
23+
24+
## バージョン
25+
### 言語
26+
- C++26
27+
28+
### 処理系
29+
- [Clang](/implementation.md#clang): ??
30+
- [GCC](/implementation.md#gcc): ??
31+
- [ICC](/implementation.md#icc): ??
32+
- [Visual C++](/implementation.md#visual_cpp): ??
33+
34+
35+
## 関連項目
36+
- [`execution::schedule_from`](schedule_from.md)
37+
- [`execution::when_all`](when_all.md)
38+
- [`execution::into_variant`](into_variant.md)
39+
40+
41+
## 参照
42+
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)

0 commit comments

Comments
 (0)