Skip to content

Commit a285ffa

Browse files
committed
execution: value_type_of_t,error_type_of_t,sends_stopped (#1384)
1 parent ebdeeed commit a285ffa

File tree

6 files changed

+281
-4
lines changed

6 files changed

+281
-4
lines changed

reference/execution/execution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ namespace std::execution {
8585
| [`execution::sender_to`](execution/sender_to.md) | 指定Receiverに接続可能なSender (concept) | C++26 |
8686
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md) | Senderの完了シグネチャ集合を取得 (customization point object) | C++26 |
8787
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderの完了シグネチャ集合を取得 (alias template) | C++26 |
88-
| [`execution::value_types_of_t`](execution/value_types_of_t.md.nolink) | Senderの値完了型を取得 (alias template) | C++26 |
89-
| [`execution::error_types_of_t`](execution/error_types_of_t.md.nolink) | Senderのエラー完了型を取得 (alias template) | C++26 |
90-
| [`execution::sends_stopped`](execution/value_types_of_t.md.nolink) | Senderが停止完了に対応するか否か (variable template) | C++26 |
88+
| [`execution::value_types_of_t`](execution/value_types_of_t.md) | Senderの値完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
89+
| [`execution::error_types_of_t`](execution/error_types_of_t.md) | Senderのエラー完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
90+
| [`execution::sends_stopped`](execution/sends_stopped.md) | Senderが停止完了を送信しうるか否か (variable template) | C++26 |
9191
| [`execution::tag_of_t`](execution/tag_of_t.md.nolink) | Senderのタグ型を取得 (alias template) | C++26 |
9292
| [`execution::transform_sender`](execution/transform_sender.md) | Senderを変換 (function template) | C++26 |
9393
| [`execution::transform_env`](execution/transform_env.md) | 環境を変換 (function template) | C++26 |
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# error_types_of_t
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, class Env = env<>,
10+
template<class...> class Variant = variant-or-empty>
11+
requires sender_in<Sndr, Env>
12+
using error_types_of_t =
13+
gather-signatures<set_error_t, completion_signatures_of_t<Sndr, Env>, type_identity_t, Variant>;
14+
}
15+
```
16+
* env<>[link env.md]
17+
* sender_in[link sender_in.md]
18+
* variant-or-empty[link variant-or-empty.md.nolink]
19+
* gather-signatures[link gather-signatures.md]
20+
* set_error_t[link set_error.md]
21+
* completion_signatures_of_t[link completion_signatures_of_t.md]
22+
* type_identity_t[link /reference/type_traits/type_identity.md]
23+
24+
## 概要
25+
[Sender型](sender.md)`Sndr`が[環境](receiver.md)`Env`において非同期操作を作成できるとき、[完了シグネチャ集合](completion_signatures.md)のうち[エラー完了シグネチャ](set_error.md)の引数型集合に対して型情報の変換操作を適用し、新たな型を取得する。
26+
27+
エラー完了シグネチャの引数型集合を`{E0, E1, ... EN}`としたとき、変換操作をテンプレートパラメータ`Variant`で指定する。
28+
29+
- `Variant` : 引数型集合に適用する型変換操作。
30+
31+
`error_types_of_t`のデフォルト動作では、引数型集合の[`variant`](/reference/variant/variant.md)に変換される。
32+
33+
34+
## 例
35+
```cpp example
36+
#include <concepts>
37+
#include <execution>
38+
namespace ex = std::execution;
39+
40+
int main()
41+
{
42+
// エラー完了シグネチャを持たないSender
43+
ex::sender auto snd1 = ex::just(123, 'X');
44+
using Types1 = ex::error_types_of_t<decltype(snd1)>;
45+
// Type1 == 有効だがオブジェクト構築不可な型
46+
47+
// エラー完了シグネチャ set_error_t(int)
48+
ex::sender auto snd2 = ex::just_error(42);
49+
using Types2 = ex::error_types_of_t<decltype(snd2)>;
50+
static_assert(std::same_as<Types2, std::variant<int>>);
51+
}
52+
```
53+
* ex::error_types_of_t[color ff0000]
54+
* ex::sender[link sender.md]
55+
* ex::just[link just.md.nolink]
56+
* ex::just_error[link just_error.md.nolink]
57+
58+
### 出力
59+
```
60+
```
61+
62+
63+
## バージョン
64+
### 言語
65+
- C++26
66+
67+
### 処理系
68+
- [Clang](/implementation.md#clang): ??
69+
- [GCC](/implementation.md#gcc): ??
70+
- [ICC](/implementation.md#icc): ??
71+
- [Visual C++](/implementation.md#visual_cpp): ??
72+
73+
74+
## 関連項目
75+
- [`execution::completion_signatures`](completion_signatures.md)
76+
- [`execution::set_error`](set_error.md)
77+
78+
79+
## 参照
80+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# gather-signatures
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* type-alias[meta id-type]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
template<class Tag,
9+
valid-completion-signatures Completions,
10+
template<class...> class Tuple,
11+
template<class...> class Variant>
12+
using gather-signatures = /*see below*/
13+
```
14+
* valid-completion-signatures[link completion_signatures.md]
15+
* see below[italic]
16+
17+
## 概要
18+
`gather-signatures`は、[完了シグネチャ集合](completion_signatures.md)`Completions`のうち完了タグ`Tag`に適合する引数型リスト集合に対して型情報の変換操作を適用し、新たな型を取得する説明専用のエイリアステンプレートである。
19+
20+
完了タグ`Tag`には下記いずれかの型を指定する。
21+
22+
- [`execution::set_value_t`](set_value.md)
23+
- [`execution::set_error_t`](set_error.md)
24+
- [`execution::set_stopped_t`](set_stopped.md)
25+
26+
完了シグネチャに適合する引数型リスト集合を`{Ts0..., Ts1..., ... TsN...}`としたとき、2段階の型変換操作をテンプレートパラメータ`Tuple`, `Variant`で指定する。
27+
28+
- `Tuple` : それぞれの引数型リスト`Ts...`に適用する型変換操作。
29+
- `Variant` : 上記変換後に、引数型リスト集合に適用する型変換操作。
30+
31+
32+
## バージョン
33+
### 言語
34+
- C++26
35+
36+
37+
## 関連項目
38+
- [`execution::value_types_of_t`](value_types_of_t.md)
39+
- [`execution::error_types_of_t`](error_types_of_t.md)
40+
- [`execution::sends_stopped`](sends_stopped.md)
41+
42+
43+
## 参照
44+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

reference/execution/execution/scheduler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace std::execution {
6363
```
6464
* set_value_t[link set_value.md]
6565
* sender_in[link sender_in.md]
66-
* value_types_of_t[link value_types_of_t.md.nolink]
66+
* value_types_of_t[link value_types_of_t.md]
6767
* type_identity_t[link /reference/type_traits/true_type.md]
6868

6969
`Sch``scheduler`の型、型`Env`[`sender_in`](sender_in.md)`<`[`schedule_result_t`](schedule_result_t.md)`<Sch>, Env>`を満たす実行環境の型としたとき、`sender-in-of<`[`schedule_result_t`](schedule_result_t.md)`<Sch>, Env>`のモデルとなること。
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# sends_stopped
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* variable[meta id-type]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std::execution {
9+
template<class Sndr, class Env = env<>>
10+
requires sender_in<Sndr, Env>
11+
constexpr bool sends_stopped =
12+
!same_as<type-list<>,
13+
gather-signatures<set_stopped_t, completion_signatures_of_t<Sndr, Env>,
14+
type-list, type-list>>;
15+
}
16+
```
17+
* env<>[link env.md]
18+
* sender_in[link sender_in.md]
19+
* gather-signatures[link gather-signatures.md]
20+
* set_stopped_t[link set_stopped.md]
21+
* completion_signatures_of_t[link completion_signatures_of_t.md]
22+
23+
## 概要
24+
[Sender型](sender.md)`Sndr`が[環境](receiver.md)`Env`において非同期操作を作成できるとき、[完了シグネチャ集合](completion_signatures.md)が[停止完了シグネチャ](set_stopped.md)を含むか否かを返す。
25+
26+
27+
## 例
28+
```cpp example
29+
#include <concepts>
30+
#include <execution>
31+
namespace ex = std::execution;
32+
33+
int main()
34+
{
35+
// 停止完了シグネチャを持たないSender
36+
ex::sender auto snd1 = ex::just(123, 'X');
37+
static_assert(not ex::sends_stopped<decltype(snd1)>);
38+
39+
// 停止完了シグネチャ set_stopped_t()
40+
ex::sender auto snd2 = ex::just_stopped();
41+
static_assert(ex::sends_stopped<decltype(snd2)>);
42+
}
43+
```
44+
* ex::sends_stopped[color ff0000]
45+
* ex::sender[link sender.md]
46+
* ex::just[link just.md.nolink]
47+
* ex::just_stopped[link just_stopped.md.nolink]
48+
49+
### 出力
50+
```
51+
```
52+
53+
54+
## バージョン
55+
### 言語
56+
- C++26
57+
58+
### 処理系
59+
- [Clang](/implementation.md#clang): ??
60+
- [GCC](/implementation.md#gcc): ??
61+
- [ICC](/implementation.md#icc): ??
62+
- [Visual C++](/implementation.md#visual_cpp): ??
63+
64+
65+
## 関連項目
66+
- [`execution::completion_signatures`](completion_signatures.md)
67+
- [`execution::set_stopped`](set_stopped.md)
68+
69+
70+
## 参照
71+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# value_types_of_t
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, class Env = env<>,
10+
template<class...> class Tuple = decayed-tuple,
11+
template<class...> class Variant = variant-or-empty>
12+
requires sender_in<Sndr, Env>
13+
using value_types_of_t =
14+
gather-signatures<set_value_t, completion_signatures_of_t<Sndr, Env>, Tuple, Variant>;
15+
}
16+
```
17+
* env<>[link env.md]
18+
* sender_in[link sender_in.md]
19+
* decayed-tuple[link decayed-tuple.md.nolink]
20+
* variant-or-empty[link variant-or-empty.md.nolink]
21+
* gather-signatures[link gather-signatures.md]
22+
* set_value_t[link set_value.md]
23+
* completion_signatures_of_t[link completion_signatures_of_t.md]
24+
25+
## 概要
26+
[Sender型](sender.md)`Sndr`が[環境](receiver.md)`Env`において非同期操作を作成できるとき、[完了シグネチャ集合](completion_signatures.md)のうち[値完了シグネチャ](set_value.md)の引数型リスト集合に対して型情報の変換操作を適用し、新たな型を取得する。
27+
28+
値完了シグネチャの引数型リスト集合を`{Ts0..., Ts1..., ... TsN...}`としたとき、2段階の型変換操作をテンプレートパラメータ`Tuple`, `Variant`で指定する。
29+
30+
- `Tuple` : それぞれの引数型リスト`Ts...`に適用する型変換操作。
31+
- `Variant` : 上記変換後に、引数型リスト集合に適用する型変換操作。
32+
33+
`value_types_of_t`のデフォルト動作では、引数型リスト[`tuple`](/reference/tuple/tuple.md)の[`variant`](/reference/variant/variant.md)に変換される。
34+
35+
36+
## 例
37+
```cpp example
38+
#include <concepts>
39+
#include <execution>
40+
namespace ex = std::execution;
41+
42+
int main()
43+
{
44+
// 値完了シグネチャ set_value_t(int, char)
45+
ex::sender auto snd1 = ex::just(123, 'X');
46+
using Types1 = ex::value_types_of_t<decltype(snd1)>;
47+
static_assert(std::same_as<Types1, std::variant<std::tuple<int, char>>>);
48+
49+
// 値完了シグネチャを持たないSender
50+
ex::sender auto snd2 = ex::just_error(42);
51+
using Types2 = ex::value_types_of_t<decltype(snd2)>;
52+
// Type2 == 有効だがオブジェクト構築不可な型
53+
}
54+
```
55+
* ex::value_types_of_t[color ff0000]
56+
* ex::sender[link sender.md]
57+
* ex::just[link just.md.nolink]
58+
* ex::just_error[link just_error.md.nolink]
59+
60+
### 出力
61+
```
62+
```
63+
64+
65+
## バージョン
66+
### 言語
67+
- C++26
68+
69+
### 処理系
70+
- [Clang](/implementation.md#clang): ??
71+
- [GCC](/implementation.md#gcc): ??
72+
- [ICC](/implementation.md#icc): ??
73+
- [Visual C++](/implementation.md#visual_cpp): ??
74+
75+
76+
## 関連項目
77+
- [`execution::completion_signatures`](completion_signatures.md)
78+
- [`execution::set_value`](set_value.md)
79+
80+
81+
## 参照
82+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

0 commit comments

Comments
 (0)