Skip to content

Commit d512f5b

Browse files
committed
execution: get_stop_token,stop_token_of_t (#1384)
1 parent 3785ecf commit d512f5b

File tree

7 files changed

+120
-6
lines changed

7 files changed

+120
-6
lines changed

reference/execution/execution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace std::execution {
3737
|------|------|----------------|
3838
| [`forwarding_query`](forwarding_query.md.nolink) | クエリオブジェクトに転送問い合わせ可能か否かを返す (customization point object) | C++26 |
3939
| [`get_allocator`](get_allocator.md.nolink) | アロケータ取得のクエリオブジェクト (customization point object) | C++26 |
40-
| [`get_stop_token`](get_stop_token.md.nolink) | 停止トークン取得のクエリオブジェクト (customization point object) | C++26 |
41-
| [`stop_token_of_t`](get_stop_token.md.nolink) | 指定型から停止トークン型を取得 (alias template) | C++26 |
40+
| [`get_stop_token`](get_stop_token.md) | 停止トークン取得のクエリオブジェクト (customization point object) | C++26 |
41+
| [`stop_token_of_t`](stop_token_of_t.md) | 指定型から停止トークン型を取得 (alias template) | C++26 |
4242
| [`execution::get_domain`](execution/get_domain.md.nolink) | 実行ドメイン取得のクエリオブジェクト (customization point object) | C++26 |
4343
| [`execution::get_scheduler`](execution/get_scheduler.md.nolink) | Scheduler取得のクエリオブジェクト (customization point object) | C++26 |
4444
| [`execution::get_delegation_scheduler`](execution/get_delegation_scheduler.md.nolink) | 委譲Scheduler取得のクエリオブジェクト (customization point object) | C++26 |

reference/execution/execution/env.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main()
6262
* ex::env[color ff0000]
6363
* ex::prop[link prop.md]
6464
* std::get_allocator[link get_allocator.md.nolink]
65-
* std::get_stop_token[link get_stop_token.md.nolink]
65+
* std::get_stop_token[link ../get_stop_token.md]
6666
* std::never_stop_token[link /reference/stop_token/never_stop_token.md]
6767

6868
### 出力

reference/execution/execution/env/query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main()
7070
* ex::env[link ../env.md]
7171
* ex::prop[link ../prop.md]
7272
* std::get_allocator[link get_allocator.md.nolink]
73-
* std::get_stop_token[link get_stop_token.md.nolink]
73+
* std::get_stop_token[link ../../get_stop_token.md]
7474
* std::never_stop_token[link /reference/stop_token/never_stop_token.md]
7575
* std::stop_token[link /reference/stop_token/stop_token.md]
7676

reference/execution/execution/get_completion_scheduler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace std::execution {
1111

1212
template<class CPO>
1313
constexpr get_completion_scheduler_t<CPO> get_completion_scheduler{};
14-
}
14+
}
1515
```
1616
* unspecified[italic]
1717

reference/execution/execution/prop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main()
4949
}
5050
```
5151
* ex::prop[color ff0000]
52-
* std::get_stop_token[link get_stop_token.md.nolink]
52+
* std::get_stop_token[link ../get_stop_token.md]
5353
* std::never_stop_token[link /reference/stop_token/never_stop_token.md]
5454

5555
### 出力
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# get_stop_token
2+
* execution[meta header]
3+
* cpo[meta id-type]
4+
* std[meta namespace]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std {
9+
struct get_stop_token_t { unspecified };
10+
constexpr get_stop_token_t get_stop_token{};
11+
}
12+
```
13+
* unspecified[italic]
14+
15+
## 概要
16+
`get_stop_token`は、[クエリ可能オブジェクト](queryable.md)から[停止トークン](/reference/stop_token/stoppable_token.md)を取得する[クエリオブジェクト](queryable.md)である。
17+
18+
コア定数式[`forwarding_query`](forwarding_query.md.nolink)`(get_stop_token)`は`true`値を返す。
19+
20+
21+
## 効果
22+
式`get_stop_token(env)`は下記と等価であり、[`stoppable_token`](/reference/stop_token/stoppable_token.md)を満たす型の値となる。
23+
24+
- 引数`env`がconst修飾された`cenv`を用いて、式`cenv.query(get_stop_token)`が有効であればその値。
25+
- そうでなければ、[`never_stop_token{}`](/reference/stop_token/never_stop_token.md)
26+
27+
28+
## 例外
29+
投げない
30+
31+
32+
## カスタマイゼーションポイント
33+
const修飾[クエリ可能オブジェクト](queryable.md)`env`に対して式`env.query(get_stop_token)`が呼び出される。
34+
このとき、`noexcept(cenv.query(get_stop_token)) == true`であること。
35+
36+
37+
## 例
38+
```cpp
39+
#include <concepts>
40+
#include <stop_token>
41+
#include <execution>
42+
namespace ex = std::execution;
43+
44+
int main()
45+
{
46+
// just Senderは停止トークンを持たない
47+
ex::sender auto sndr = ex::just(42);
48+
auto token = std::get_stop_token(ex::get_env(sndr));
49+
static_assert(std::same_as<decltype(token), std::never_stop_token>);
50+
}
51+
```
52+
* std::get_stop_token[color ff0000]
53+
* ex::sender[link execution/sender.md]
54+
* ex::just[link execution/just.md.nolink]
55+
* ex::get_env[link execution/get_env.md]
56+
* std::never_stop_token[link /reference/stop_token/never_stop_token.md]
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+
- [`stoppable_token`](/reference/stop_token/stoppable_token.md)
76+
77+
78+
## 参照
79+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# stop_token_of_t
2+
* execution[meta header]
3+
* std[meta namespace]
4+
* type-alias[meta id-type]
5+
* cpp26[meta cpp]
6+
7+
```cpp
8+
namespace std {
9+
template<class T>
10+
using stop_token_of_t = remove_cvref_t<decltype(get_stop_token(declval<T>()))>;
11+
}
12+
```
13+
* get_stop_token[link get_stop_token.md]
14+
15+
## 概要
16+
[クエリ可能オブジェクト型](queryable.md)`T`から[停止トークン型](/reference/stop_token/stoppable_token.md)を取得する。
17+
18+
19+
## バージョン
20+
### 言語
21+
- C++26
22+
23+
### 処理系
24+
- [Clang](/implementation.md#clang): ??
25+
- [GCC](/implementation.md#gcc): ??
26+
- [ICC](/implementation.md#icc): ??
27+
- [Visual C++](/implementation.md#visual_cpp): ??
28+
29+
30+
## 関連項目
31+
- [`get_stop_token`](get_stop_token.md)
32+
33+
34+
## 参照
35+
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)

0 commit comments

Comments
 (0)