Skip to content

Commit 9bdfb06

Browse files
committed
execution: with-await-transform (#1384)
1 parent 252f026 commit 9bdfb06

6 files changed

Lines changed: 60 additions & 6 deletions

File tree

reference/execution/execution/connect.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ namespace std {
1616
1717
カスタマイゼーションポイントオブジェクトの呼び出し式`connect(sndr, rcvr)`は、下記の動作となる。
1818
19-
- [`transform_sender`](transform_sender.md)を呼び出して、`sndr`を新しいSender`new_sndr`に変換する。大半のケースでは無変換。
20-
- 呼び出し式が適格であるならば、`return new_sndr.connect(rcvr)`相当
19+
- [`transform_sender`](transform_sender.md)により`sndr`から新しいSender`new_sndr`へ変換する。(多くのケースで無変換)
20+
- 呼び出し式が適格であるならば、`new_sndr.connect(rcvr)`を返す
2121
- そうでなければ、`new_sndr`を[コルーチンのAwaitable型](/lang/cpp20/coroutines.md)とみなして`rcvr`と接続した結果を返す。
2222
2323
@@ -72,9 +72,12 @@ namespace std::execution {
7272
};
7373
}
7474
```
75+
* with-await-transform[link with-await-transform.md]
7576
* suspend_always[link /reference/coroutine/suspend_always.md]
77+
* terminate()[link /reference/exception/terminate.md]
7678
* coroutine_handle[link /reference/coroutine/coroutine_handle.md]
7779
* set_stopped[link set_stopped.md]
80+
* std::move[link /reference/utility/move.md]
7881
* noop_coroutine()[link /reference/coroutine/noop_coroutine.md]
7982
* from_promise[link /reference/coroutine/coroutine_handle/from_promise.md]
8083
* env_of_t[link env_of_t.md]
@@ -100,6 +103,7 @@ namespace std::execution {
100103
}
101104
```
102105
* operation_state_t[link operation_state.md]
106+
* promise_type[link /lang/cpp20/coroutines.md]
103107
* coroutine_handle<>[link /reference/coroutine/coroutine_handle.md]
104108
* destroy()[link /reference/coroutine/coroutine_handle/destroy.md]
105109
* resume()[link /reference/coroutine/coroutine_handle/resume.md]
@@ -117,7 +121,7 @@ completion_signatures<
117121
set_stopped_t()>
118122
```
119123
* set_error_t[link set_error.md]
120-
* set_stopped[link set_stopped.md]
124+
* set_stopped_t[link set_stopped.md]
121125
* exception_ptr[link /reference/exception/exception_ptr.md]
122126
* SET-VALUE-SIG[italic]
123127
@@ -159,8 +163,10 @@ namespace std::execution {
159163
* unreachable()[link /reference/utility/unreachable.md]
160164
* receiver_of[link receiver_of.md]
161165
* exception_ptr[link /reference/exception/exception_ptr.md]
166+
* std::move[link /reference/utility/move.md]
162167
* current_exception()[link /reference/exception/current_exception.md]
163168

169+
164170
## カスタマイゼーションポイント
165171
Sender`sndr`[変換後](transform_sender.md)`new_sndr`に対して、式`new_sndr.connect(rcvr)`が呼び出される。
166172

reference/execution/execution/connect_result_t.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace std::execution {
1414
* connect[link connect.md]
1515
1616
## 概要
17-
[Sender型](sender.md)`Sndr`と[Receiver型]`Rcvr`を[接続](connect.md)した結果の[Operation State型](operation_state.md)を取得する。
17+
[Sender型](sender.md)`Sndr`と[Receiver型](receiver.md)`Rcvr`を[接続(connect)](connect.md)した結果の[Operation State型](operation_state.md)を取得する。
1818
1919
2020
## バージョン

reference/execution/execution/sender.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct env-promise : with-await-transform<env-promise<Env>> {
5050
* is-awaitable[link ../is-awaitable.md]
5151
* env<>[link env.md]
5252
* derived_from[link /reference/concepts/derived_from.md]
53+
* with-await-transform[link with-await-transform.md]
5354
* coroutine_handle<>[link /reference/coroutine/coroutine_handle.md]
5455
* unspecified[italic]
5556

reference/execution/execution/sender_in.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ concept valid-completion-signatures = see below;
3838

3939
また、ある完了操作の完了シグネチャが[`completion_signatures_of_t`](completion_signatures_of_t.md)`<Sndr, Env>`で取得される[`completion_signatures`](completion_signatures.md)リストに含まれるとき、`Sndr`と`Env`における許容可能完了(permissible completion)となる。
4040

41-
`sndr`と`rcvr`の接続後に[Operation State](operation_state.md)を開始することで評価されうる完了操作が、全て許容可能完了(permissible completion)である場合、`Sndr`と`Env`は`sender_in<Sndr, Env>`のモデルとなる。
41+
`sndr`と`rcvr`の[接続](connect.md)後に[Operation State](operation_state.md)を開始することで評価されうる完了操作が、全て許容可能完了(permissible completion)である場合、`Sndr`と`Env`は`sender_in<Sndr, Env>`のモデルとなる。
4242

4343

4444
## 例

reference/execution/execution/transform_sender.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace std::execution {
1818
1919
## 概要
2020
[実行ドメイン](default_domain.md)に応じて[Sender](sender.md)を変換する。
21-
Senderオブジェクトの構築時、Senderと[Receiver](receiver.md)間[接続(connect)](../connect.md.nolink)のカスタマイゼーションポイントとして機能する
21+
Senderオブジェクトの構築時、Senderと[Receiver](receiver.md)間[接続(connect)](connect.md)時のカスタマイゼーションポイントとして機能する
2222
2323
型変換ではSender型の変換が行われなくなる(恒等変換となる)まで、下記のカスタマイゼーションポイントを再帰的に呼び出す。
2424
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# with-await-transform
2+
* execution[meta header]
3+
* class template[meta id-type]
4+
* std::execution[meta namespace]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std::execution {
9+
template<class T, class Promise>
10+
concept has-as-awaitable = // exposition only
11+
requires (T&& t, Promise& p) {
12+
{ std::forward<T>(t).as_awaitable(p) } -> is-awaitable<Promise&>;
13+
};
14+
15+
template<class Derived>
16+
struct with-await-transform { // exposition only
17+
template<class T>
18+
T&& await_transform(T&& value) noexcept {
19+
return std::forward<T>(value);
20+
}
21+
22+
template<has-as-awaitable<Derived> T>
23+
decltype(auto) await_transform(T&& value)
24+
noexcept(noexcept(std::forward<T>(value).as_awaitable(declval<Derived&>())))
25+
{
26+
return std::forward<T>(value).as_awaitable(static_cast<Derived&>(*this));
27+
}
28+
};
29+
}
30+
```
31+
* is-awaitable[link ../is-awaitable.md]
32+
33+
## 概要
34+
`with-await-transform`は、実行制御ライブラリの仕様定義で用いられる説明専用のクラステンプレートである。
35+
36+
37+
## バージョン
38+
### 言語
39+
- C++26
40+
41+
## 関連項目
42+
- [`execution::sender`](sender.md)
43+
- [`execution::connect`](connect.md)
44+
45+
46+
## 参照
47+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

0 commit comments

Comments
 (0)