Skip to content

Commit d134ea8

Browse files
committed
execution: just_error,just_stopped (#1384)
1 parent cb70d2c commit d134ea8

File tree

9 files changed

+234
-20
lines changed

9 files changed

+234
-20
lines changed

reference/execution/execution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ namespace std::execution {
100100
| 名前 | 説明 | 対応バージョン |
101101
|------|------|----------------|
102102
| [`execution::just`](execution/just.md) | 値を送信するSender (customization point object) | C++26 |
103-
| [`execution::just_error`](execution/just_error.md.nolink) | エラーを送信するSender (customization point object) | C++26 |
104-
| [`execution::just_stopped`](execution/just_stopped.md.nolink) | 停止を送信するSender (customization point object) | C++26 |
103+
| [`execution::just_error`](execution/just_error.md) | エラーを送信するSender (customization point object) | C++26 |
104+
| [`execution::just_stopped`](execution/just_stopped.md) | 停止を送信するSender (customization point object) | C++26 |
105105
| [`execution::read_env`](execution/read_env.md) | Receiver環境からクエリオブジェクトで値を読み取るSender (customization point object) | C++26 |
106106
| [`execution::schedule`](execution/schedule.md) | Scheduler上で実行されるSender (customization point object) | C++26 |
107107
| [`execution::schedule_result_t`](execution/schedule_result_t.md) | [`schedule`](execution/schedule.md)結果型を取得 (alias template) | C++26 |

reference/execution/execution/error_types_of_t.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main()
5353
* ex::error_types_of_t[color ff0000]
5454
* ex::sender[link sender.md]
5555
* ex::just[link just.md]
56-
* ex::just_error[link just_error.md.nolink]
56+
* ex::just_error[link just_error.md]
5757

5858
### 出力
5959
```

reference/execution/execution/just.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ namespace std::execution {
1717
1818
1919
## 効果
20-
- 呼び出し式`just(ts...)`は、`(`[`movable-value`](../movable-value.md)`<Ts> &&...) == false`のとき不適格となる。
21-
- そうでなければ、式[`make-sender`](make-sender.md)`(just,` [`product-type`](product-type.md)`{ts...})`と等価。
20+
説明用のパック`ts`に対して、パック`Ts`を`decltype((ts))`とする。下記いずれかの条件をみたすとき、呼び出し式`just(ts...)`は不適格となる。
21+
22+
- `(`[`movable-value`](../movable-value.md)`<Ts> &&...) == false`
23+
24+
そうでなければ、呼び出し式`just(ts...)`は下記と等価。
25+
26+
```cpp
27+
make-sender(just, product-type{ts...})
28+
```
29+
* make-sender[link make-sender.md]
30+
* product-type[link product-type.md]
2231

2332

2433
### Senderアルゴリズムタグ `just`
@@ -43,22 +52,34 @@ namespace std::execution {
4352
* std::move[link /reference/utility/move.md]
4453
4554
55+
## カスタマイゼーションポイント
56+
[Receiver](receiver.md)との[接続(connect)](connect.md)時に、[関連付けられた実行ドメイン](get-domain-late.md)に対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
57+
[デフォルト実行ドメイン](default_domain.md)では無変換。
58+
59+
4660
## 例
4761
```cpp example
62+
#include <string>
4863
#include <print>
4964
#include <execution>
5065
namespace ex = std::execution;
66+
using namespace std::string_literals;
5167
5268
int main()
5369
{
54-
// 値(123,'X')の送信結果は tuple<int,char> 型で受け取る
55-
ex::sender auto snd1 = ex::just(123, 'X');
56-
std::tuple<int, char> result1 = std::this_thread::sync_wait(snd1).value();
70+
// 空の値を送信するSender
71+
ex::sender auto snd0 = ex::just();
72+
std::tuple<> result0 = std::this_thread::sync_wait(snd0).value();
73+
std::println("result0={}", result0);
74+
75+
// 値"C++"を送信するSender
76+
ex::sender auto snd1 = ex::just("C++"s);
77+
std::tuple<std::string> result1 = std::this_thread::sync_wait(snd1).value();
5778
std::println("result1={}", result1);
5879
59-
// 空値の送信結果は tuple<> 型で受け取る
60-
ex::sender auto snd2 = ex::just();
61-
std::tuple<> result2 = std::this_thread::sync_wait(snd2).value();
80+
// 値(123,'X')を送信するSender
81+
ex::sender auto snd2 = ex::just(123, 'X');
82+
std::tuple<int, char> result2 = std::this_thread::sync_wait(snd2).value();
6283
std::println("result2={}", result2);
6384
}
6485
```
@@ -69,8 +90,9 @@ int main()
6990

7091
### 出力
7192
```
72-
result1=(123, 'X')
73-
result2=()
93+
result0=()
94+
result1=("C++")
95+
result2=(123, 'X')
7496
```
7597

7698

@@ -86,9 +108,10 @@ result2=()
86108

87109

88110
## 関連項目
89-
- [`execution::just_error`](just_error.md.nolink)
90-
- [`execution::just_stopped`](just_stopped.md.nolink)
111+
- [`execution::just_error`](just_error.md)
112+
- [`execution::just_stopped`](just_stopped.md)
91113

92114

93115
## 参照
116+
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
94117
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# just_error
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 just_error_t { unspecified };
10+
inline constexpr just_error_t just_error{};
11+
}
12+
```
13+
* unspecified[italic]
14+
15+
## 概要
16+
`just_error`は、非同期操作の[開始(start)](start.md)で[エラー完了関数](set_error.md)を呼び出すSenderファクトリである。
17+
18+
19+
## 効果
20+
説明用のパック`ts`に対して、パック`Ts`を`decltype((ts))`とする。下記いずれかの条件をみたすとき、呼び出し式`just_error(ts...)`は不適格となる。
21+
22+
- `(`[`movable-value`](../movable-value.md)`<Ts> &&...) == false`、もしくは
23+
- `sizeof...(ts) == 1`が`false`
24+
25+
そうでなければ、呼び出し式`just_error(ts...)`は下記と等価。
26+
27+
```cpp
28+
make-sender(just_error, product-type{ts...})
29+
```
30+
* make-sender[link make-sender.md]
31+
* product-type[link product-type.md]
32+
33+
34+
### Senderアルゴリズムタグ `just_error`
35+
Senderアルゴリズム動作説明用のクラステンプレート[`impls-for`](impls-for.md)に対して、下記の特殊化が定義される。
36+
37+
```cpp
38+
namespace std::execution {
39+
template<>
40+
struct impls-for<decayed-typeof<just_error>> : default-impls {
41+
static constexpr auto start =
42+
[](auto& state, auto& rcvr) noexcept -> void {
43+
auto& [...ts] = state;
44+
set_error(std::move(rcvr), std::move(ts)...);
45+
};
46+
};
47+
}
48+
```
49+
* decayed-typeof[link decayed-typeof.md.nolink]
50+
* impls-for[link impls-for.md]
51+
* default-impls[link impls-for.md]
52+
* set_error[link set_error.md]
53+
* std::move[link /reference/utility/move.md]
54+
55+
56+
## カスタマイゼーションポイント
57+
[Receiver](receiver.md)との[接続(connect)](connect.md)時に、[関連付けられた実行ドメイン](get-domain-late.md)に対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
58+
[デフォルト実行ドメイン](default_domain.md)では無変換。
59+
60+
61+
## 例
62+
```cpp example
63+
#include <execution>
64+
namespace ex = std::execution;
65+
66+
int main()
67+
{
68+
// エラー(42)を送信するSender
69+
ex::sender auto sndr = ex::just_error(42);
70+
}
71+
```
72+
* ex::just_error[color ff0000]
73+
* ex::sender[link sender.md]
74+
75+
### 出力
76+
```
77+
```
78+
79+
80+
## バージョン
81+
### 言語
82+
- C++26
83+
84+
### 処理系
85+
- [Clang](/implementation.md#clang): ??
86+
- [GCC](/implementation.md#gcc): ??
87+
- [ICC](/implementation.md#icc): ??
88+
- [Visual C++](/implementation.md#visual_cpp): ??
89+
90+
91+
## 関連項目
92+
- [`execution::just`](just.md)
93+
- [`execution::just_stopped`](just_stopped.md)
94+
95+
96+
## 参照
97+
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
98+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# just_stopped
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 just_stopped_t { unspecified };
10+
inline constexpr just_stopped_t just_stopped{};
11+
}
12+
```
13+
* unspecified[italic]
14+
15+
## 概要
16+
`just_stopped`は、非同期操作の[開始(start)](start.md)で[停止完了関数](set_stopped.md)を呼び出すSenderファクトリである。
17+
18+
19+
## 効果
20+
呼び出し式`just_stopped()`は下記と等価。
21+
22+
```cpp
23+
make-sender(just_stopped, product-type{})
24+
```
25+
* make-sender[link make-sender.md]
26+
* product-type[link product-type.md]
27+
28+
29+
### Senderアルゴリズムタグ `just_stopped`
30+
Senderアルゴリズム動作説明用のクラステンプレート[`impls-for`](impls-for.md)に対して、下記の特殊化が定義される。
31+
32+
```cpp
33+
namespace std::execution {
34+
template<>
35+
struct impls-for<decayed-typeof<just_stopped>> : default-impls {
36+
static constexpr auto start =
37+
[](auto& state, auto& rcvr) noexcept -> void {
38+
/*auto& [...ts] = state;*/
39+
set_stopped(std::move(rcvr));
40+
};
41+
};
42+
}
43+
```
44+
* decayed-typeof[link decayed-typeof.md.nolink]
45+
* impls-for[link impls-for.md]
46+
* default-impls[link impls-for.md]
47+
* set_stopped[link set_stopped.md]
48+
* std::move[link /reference/utility/move.md]
49+
50+
51+
## カスタマイゼーションポイント
52+
[Receiver](receiver.md)との[接続(connect)](connect.md)時に、[関連付けられた実行ドメイン](get-domain-late.md)に対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
53+
[デフォルト実行ドメイン](default_domain.md)では無変換。
54+
55+
56+
## 例
57+
```cpp example
58+
#include <execution>
59+
namespace ex = std::execution;
60+
61+
int main()
62+
{
63+
// 停止を送信するSender
64+
ex::sender auto sndr = ex::just_stopped();
65+
}
66+
```
67+
* ex::just_stopped[color ff0000]
68+
* ex::sender[link sender.md]
69+
70+
### 出力
71+
```
72+
```
73+
74+
75+
## バージョン
76+
### 言語
77+
- C++26
78+
79+
### 処理系
80+
- [Clang](/implementation.md#clang): ??
81+
- [GCC](/implementation.md#gcc): ??
82+
- [ICC](/implementation.md#icc): ??
83+
- [Visual C++](/implementation.md#visual_cpp): ??
84+
85+
86+
## 関連項目
87+
- [`execution::just`](just.md)
88+
- [`execution::just_error`](just_error.md)
89+
90+
91+
## 参照
92+
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
93+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

reference/execution/execution/let_value.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ int main()
361361
* ex::set_value[link set_value.md]
362362
* ex::set_error_t[link set_error.md]
363363
* ex::set_error[link set_error.md]
364-
* ex::just_stopped[link just_stopped.md.nolink]
364+
* ex::just_stopped[link just_stopped.md]
365365
* ex::operation_state_t[link operation_state.md]
366366
* std::this_thread::sync_wait_with_variant[link ../this_thread/sync_wait_with_variant.md]
367367
* std::move[link /reference/utility/move.md]

reference/execution/execution/sends_stopped.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main()
4444
* ex::sends_stopped[color ff0000]
4545
* ex::sender[link sender.md]
4646
* ex::just[link just.md]
47-
* ex::just_stopped[link just_stopped.md.nolink]
47+
* ex::just_stopped[link just_stopped.md]
4848

4949
### 出力
5050
```

reference/execution/execution/value_types_of_t.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main()
5555
* ex::value_types_of_t[color ff0000]
5656
* ex::sender[link sender.md]
5757
* ex::just[link just.md]
58-
* ex::just_error[link just_error.md.nolink]
58+
* ex::just_error[link just_error.md]
5959

6060
### 出力
6161
```

reference/execution/execution/when_all_with_variant.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ return when_all(into_variant(std::forward_like<decltype((sndr))>(child))...);
5555

5656

5757
## カスタマイゼーションポイント
58-
Senderアルゴリズム構築時に、関連付けられた実行ドメインに対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
58+
Senderアルゴリズム構築時に、全入力Senderに関連付けられた共通の実行ドメイン`CD`に対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
5959
[デフォルト実行ドメイン](default_domain.md)では無変換。
6060

61-
[Receiver](receiver.md)との[接続(connect)](connect.md)時に、関連付けられた実行ドメインに対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
61+
[Receiver](receiver.md)との[接続(connect)](connect.md)時に、[関連付けられた実行ドメイン](get-domain-late.md)に対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
6262
[デフォルト実行ドメイン](default_domain.md)では`when_all_with_variant.transform_sender(sndr, env)`が呼ばれ、前述仕様通りのSenderへと変換される。
6363

6464

0 commit comments

Comments
 (0)