Skip to content

Commit 60b2958

Browse files
committed
execution: get_completion_signatures (#1384)
1 parent 6f4510e commit 60b2958

6 files changed

Lines changed: 153 additions & 22 deletions

File tree

reference/execution/execution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ namespace std::execution {
8383
| [`execution::sender`](execution/sender.md) | Sender型 (concept) | C++26 |
8484
| [`execution::sender_in`](execution/sender_in.md) | 指定環境で有効なSender (concept) | C++26 |
8585
| [`execution::sender_to`](execution/sender_to.md) | 指定Receiverに接続可能なSender (concept) | C++26 |
86-
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md.nolink) | 完了シグネチャ集合取得のクエリオブジェクト (customization point object) | C++26 |
87-
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderから完了シグネチャ集合を取得 (alias template) | 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 |
8888
| [`execution::value_types_of_t`](execution/value_types_of_t.md.nolink) | Senderの値完了型を取得 (alias template) | C++26 |
8989
| [`execution::error_types_of_t`](execution/error_types_of_t.md.nolink) | Senderのエラー完了型を取得 (alias template) | C++26 |
9090
| [`execution::sends_stopped`](execution/value_types_of_t.md.nolink) | Senderが停止完了に対応するか否か (variable template) | C++26 |

reference/execution/execution/completion_signatures_of_t.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ namespace std::execution {
1414
* env<>[link env.md]
1515
* sender_in[link sender_in.md]
1616
* call-result-t[link call-result-t.md.nolink]
17-
* sender_in[link sender_in.md]
17+
* get_completion_signatures_t[link get_completion_signatures.md]
1818
1919
## 概要
20-
2120
[Sender型](sender.md)`Sndr`から[環境](../queryable.md)`Env`における[完了シグネチャ集合](completion_signatures.md)を取得する。
2221
2322
@@ -32,5 +31,9 @@ namespace std::execution {
3231
- [Visual C++](/implementation.md#visual_cpp): ??
3332
3433
34+
## 関連項目
35+
- [`execution::get_completion_signatures`](get_completion_signatures.md)
36+
37+
3538
## 参照
3639
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# env-promise
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 Env>
10+
struct env-promise : with-await-transform<env-promise<Env>> { // exposition only
11+
unspecified get_return_object() noexcept;
12+
unspecified initial_suspend() noexcept;
13+
unspecified final_suspend() noexcept;
14+
void unhandled_exception() noexcept;
15+
void return_void() noexcept;
16+
coroutine_handle<> unhandled_stopped() noexcept;
17+
18+
const Env& get_env() const noexcept;
19+
};
20+
}
21+
```
22+
* with-await-transform[link with-await-transform.md]
23+
* coroutine_handle<>[link /reference/coroutine/coroutine_handle.md]
24+
* unspecified[italic]
25+
26+
## 概要
27+
`env-promise`は、実行制御ライブラリの仕様定義で用いられる説明専用のクラステンプレートである。
28+
29+
30+
## 備考
31+
`env-promise`の特殊化は型導出のみで利用されるため、各メンバ関数の定義は必要ない。
32+
33+
34+
## バージョン
35+
### 言語
36+
- C++26
37+
38+
39+
## 関連項目
40+
- [`execution::sender`](sender.md)
41+
- [`execution::get_completion_signatures`](get_completion_signatures.md)
42+
43+
44+
## 参照
45+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# get_completion_signatures
2+
* execution[meta header]
3+
* cpo[meta id-type]
4+
* std::execution[meta namespace]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std::execution {
9+
struct get_completion_signatures_t;
10+
inline constexpr get_completion_signatures_t get_completion_signatures{};
11+
}
12+
```
13+
14+
## 概要
15+
`get_completion_signatures`は、[Sender](sender.md)の[完了シグネチャ集合](completion_signatures.md)を取得するカスタマイゼーションポイントオブジェクトである。
16+
17+
18+
## 効果
19+
説明用の`sndr`を`decltype((sndr))`が`Sndr`型となる式、`env`を`decltype((env))`が`Env`型となる式とする。
20+
式`new_sndr`を[`transform_sender`](transform_sender.md)`(decltype(`[`get-domain-late`](get-domain-late.md)`(sndr, env)){}, sndr, env)`とし、型`NewSndr`を`decltype((new_sndr))`とする。
21+
22+
式`get_completion_signatures(sndr, env)`は、`void(sndr)`と`void(env)`が不定順で序列化(indeterminately sequenced)されることを除いて`(void(sndr), void(env), CS())`と等価である。
23+
24+
ここで、説明用の型`CS`は下記の通り定義される。
25+
26+
- 型が適格であるならば、`decltype(new_sndr.get_completion_signatures(env))`
27+
- そうではなく、型が適格であるならば[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)`<NewSndr>::completion_signatures`
28+
- そうではなく、[`is-awaitable`](../is-awaitable.md)`<NewSndr,` [`env-promise`](env-promise.md)`<Env>> == true`ならば
29+
30+
```cpp
31+
completion_signatures<
32+
SET-VALUE-SIG(await-result-type<NewSndr, env-promise<Env>>),
33+
set_error_t(exception_ptr),
34+
set_stopped_t()>
35+
```
36+
* completion_signatures[link completion_signatures.md]
37+
* SET-VALUE-SIG[link connect.md]
38+
* await-result-type[link connect.md]
39+
* env-promise[link env-promise.md]
40+
* set_error_t[link set_error.md]
41+
* exception_ptr[link /reference/exception/exception_ptr.md]
42+
* set_stopped_t[link set_stopped.md]
43+
44+
- そうでなければ、`CS`は不適格となる。
45+
46+
47+
## カスタマイゼーションポイント
48+
- Sender`sndr`[変換後](transform_sender.md)の`new_sndr`に対して、`new_sndr.get_completion_signatures(env)`が返す型。
49+
- 変換後Senderの型`NewSndr`に対して、メンバ型`completion_signatures`。
50+
51+
52+
## 例
53+
```cpp
54+
#include <print>
55+
#include <execution>
56+
namespace ex = std::execution;
57+
58+
int main()
59+
{
60+
// 値42を送信するSender
61+
ex::sender auto sndr = ex::just(42);
62+
63+
// 値完了シグネチャ set_value_t(int)
64+
auto sigs = ex::get_completion_signatures(sndr, ex::env<>{});
65+
static_assert(std::same_as<decltype(sigs),
66+
ex::completion_signatures<ex::set_value_t(int)>>);
67+
}
68+
```
69+
* ex::get_completion_signatures[color ff0000]
70+
* ex::sender[link sender.md]
71+
* ex::just[link just.md.nolink]
72+
* ex::completion_signatures[link completion_signatures.md]
73+
* ex::env<>[link env.md]
74+
* ex::set_value_t[link set_value.md]
75+
76+
### 出力
77+
```
78+
```
79+
80+
81+
## バージョン
82+
### 言語
83+
- C++26
84+
85+
### 処理系
86+
- [Clang](/implementation.md#clang): ??
87+
- [GCC](/implementation.md#gcc): ??
88+
- [ICC](/implementation.md#icc): ??
89+
- [Visual C++](/implementation.md#visual_cpp): ??
90+
91+
92+
## 関連項目
93+
- [`execution::sender`](sender.md)
94+
95+
96+
## 参照
97+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

reference/execution/execution/sender.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace std::execution {
2323
2424
2525
## 要件
26-
説明専用コンセプト`is-sender`, `enable-sender`、説明用クラステンプレート`env-promise`を以下のように定義する。
26+
説明専用コンセプト`is-sender`, `enable-sender`を以下のように定義する。
2727
2828
```cpp
2929
template<class Sndr>
@@ -34,25 +34,11 @@ template<class Sndr>
3434
concept enable-sender =
3535
is-sender<Sndr> ||
3636
is-awaitable<Sndr, env-promise<env<>>>;
37-
38-
template<class Env>
39-
struct env-promise : with-await-transform<env-promise<Env>> {
40-
unspecified get_return_object() noexcept;
41-
unspecified initial_suspend() noexcept;
42-
unspecified final_suspend() noexcept;
43-
void unhandled_exception() noexcept;
44-
void return_void() noexcept;
45-
coroutine_handle<> unhandled_stopped() noexcept;
46-
47-
const Env& get_env() const noexcept;
48-
};
4937
```
38+
* derived_from[link /reference/concepts/derived_from.md]
5039
* is-awaitable[link ../is-awaitable.md]
40+
* env-promise[link env-promise.md]
5141
* env<>[link env.md]
52-
* derived_from[link /reference/concepts/derived_from.md]
53-
* with-await-transform[link with-await-transform.md]
54-
* coroutine_handle<>[link /reference/coroutine/coroutine_handle.md]
55-
* unspecified[italic]
5642

5743
`sender`コンセプトは、以下のように定義される。
5844

reference/execution/execution/sender_in.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace std::execution {
1919
* env<>[link env.md]
2020
* sender[link sender.md]
2121
* queryable[link ../queryable.md]
22-
* get_completion_signatures[link get_completion_signatures.md.nolink]
22+
* get_completion_signatures[link get_completion_signatures.md]
2323
2424
## 概要
2525
`sender_in`は、[Sender型](sender.md)`Sndr`が[環境](../queryable.md)`Env`において非同期操作を作成できることを表すコンセプトである。

0 commit comments

Comments
 (0)