Skip to content

Commit a664e2e

Browse files
committed
execution/task: P3980R1対応(#1645)
1 parent 7e7a46e commit a664e2e

5 files changed

Lines changed: 22 additions & 60 deletions

File tree

reference/execution/execution/task/connect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ state<Rcvr> connect(Rcvr&& recv) &&;
1616
[Receiver](../receiver.md)と接続する。
1717
1818
19+
## 適格要件
20+
式`allocator_type(`[`get_allocator`](../../get_allocator.md)`(`[`get_env`](../get_env.md)`(rcvr)))`または式`allocator_type()`のうち、少なくとも一つが適格であること。
21+
22+
1923
## 事前条件
2024
[`bool`](/reference/coroutine/coroutine_handle/op_bool.md)`(handle) == true`
2125
@@ -48,3 +52,4 @@ return state<Rcvr>(exchange(handle, {}), std::forward<Rcvr>(recv));
4852
## 参照
4953
- [P3552R3 Add a Coroutine Task Type](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3552r3.html)
5054
- [LWG4341. Missing rvalue reference qualification for `task::connect()`](https://cplusplus.github.io/LWG/issue4341)
55+
- [P3980R1 Task's Allocator Use](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3980r1.html)

reference/execution/execution/task/promise_type.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ namespace std::execution {
2121
## クラス仕様
2222
説明用の`prom`を`promise_type`型のオブジェクト、`tsk`を`prom.`[`get_return_object()`](promise_type/get_return_object.md)で作成される[`task`](../task.md)型のオブジェクトとする。説明では[Receiver](../receiver.md)`Rcvr`に対して、`task::`[`state<Rcvr>::start`](state.md)の評価中に`tsk`と関連付けられる`STATE(prom)`, `RCVR(prom)`, `SCHED(prom)`を用いる。
2323
24-
`task::promise_type`クラスの動作説明のため、以下の説明専用メンバを用いる。
25-
26-
- `alloc` : [`allocator_type`](../task.md)型のアロケータオブジェクト
27-
2824
2925
## メンバ関数
3026
### 構築・破棄
3127
3228
| 名前 | 説明 | 対応バージョン |
3329
|------|------|----------------|
34-
| [`(constructor)`](promise_type/op_constructor.md) | コンストラクタ | C++26 |
3530
| `(destructor)` | デストラクタ | C++26 |
3631
3732
### コルーチン制御
@@ -73,3 +68,4 @@ namespace std::execution {
7368
- [LWG4415. `task::promise_type::uncaught_exception` seems to be misnamed](https://cplusplus.github.io/LWG/issue4415)
7469
- [LWG4339. `task`'s coroutine frame may be released late](https://cplusplus.github.io/LWG/issue4339)
7570
- [LWG4347. `task`'s stop source is always created](https://cplusplus.github.io/LWG/issue4347)
71+
- [P3980R1 Task's Allocator Use](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3980r1.html)

reference/execution/execution/task/promise_type/get_env.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ unspecified get_env() const noexcept;
1717
問い合わせが以下のように転送されるオブジェクト`env`を返す。
1818

1919
- `env.query(`[`get_scheduler`](../../get_scheduler.md)`)`[`scheduler_type`](../../task.md)`(SCHED(*this))`を返す。
20-
- `env.query(`[`get_allocator`](../../../get_allocator.md)`)``alloc`を返す。
20+
- `env.query(`[`get_allocator`](../../../get_allocator.md)`)`、式が適格ならば`allocator_type(`[`get_allocator`](../../../get_allocator.md)`(`[`get_env`](../../get_env.md)`(RCVR(*this))))`を返す。そうでなければ、`allocator_type()`を返す。
2121
- `env.query(`[`get_stop_token`](../../../get_stop_token.md)`)`[`STATE(*this)`](../state.md)`.get-stop-token()`を返す。
2222
- 上記以外の問い合わせ`q`と引数`a...`に対して、式が妥当かつ[`forwarding_query`](../../../forwarding_query.md)`(q)`が妥当で`true`となるとき、呼び出し`env.query(q, a...)`[`STATE(*this)`](../state.md)`.environment.query(q, a...)`を返す。そうでなければ、`env.query(q, a...)`は不適格となる。
2323

@@ -44,3 +44,4 @@ unspecified get_env() const noexcept;
4444
## 参照
4545
- [P3552R3 Add a Coroutine Task Type](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3552r3.html)
4646
- [LWG4347. `task`'s stop source is always created](https://cplusplus.github.io/LWG/issue4347)
47+
- [P3980R1 Task's Allocator Use](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3980r1.html)

reference/execution/execution/task/promise_type/op_constructor.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

reference/execution/execution/task/promise_type/op_new.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,34 @@
66
* cpp26[meta cpp]
77

88
```cpp
9+
void* operator new(size_t size); // (1)
10+
911
template<class... Args>
10-
void* operator new(size_t size, const Args&... args);
12+
void* operator new(size_t size, const Args&... args); // (2)
13+
14+
template<class This, class Alloc, class... Args>
15+
void* operator new(size_t size, const This&, allocator_arg_t, Alloc alloc, Args&&...); // (3)
1116
```
1217
1318
## 概要
1419
[`task::promise_type`](../promise_type.md)クラスのnew演算子オーバーロード。
1520
16-
[`allocator_arg_t`](/reference/memory/allocator_arg_t.md)型のパラメータがなければ、`alloc`を[`allocator_type`](../../task.md)`()`で初期化する。そうでなければ、`arg_next`を最初の`allocator_arg_t`パラメータに続くパラメータとし、`alloc`を`allocator_type(arg_next)`とする。
17-
18-
`U`型をサイズおよびアライメントが[`__STDCPP_DEFAULT_NEW_ALIGNMENT__`](/lang/cpp17/predefined_macros.md)である未規定の型としたとき、説明用の`PAlloc`を[`allocator_traits`](/reference/memory/allocator_traits.md)`<PAlloc>::template rebind_alloc<U>`とする。
21+
`U`型をサイズおよびアライメントが[`__STDCPP_DEFAULT_NEW_ALIGNMENT__`](/lang/cpp17/predefined_macros.md)である未規定の型としたとき、説明用の`PAlloc`を[`allocator_traits`](/reference/memory/allocator_traits.md)`<Alloc>::template rebind_alloc<U>`とする。
1922
2023
2124
## 適格要件
22-
- (もしあれば)最初の[`allocator_arg_t`](/reference/memory/allocator_arg_t.md)型パラメータが最後のパラメータではない。
23-
- [`allocator_arg_t`](/reference/memory/allocator_arg_t.md)型のパラメータが存在するとき、[`allocator_type`](../../task.md)`(arg_next)`が妥当な式である。
24-
- [`allocator_traits`](/reference/memory/allocator_traits.md)`<PAlloc>::pointer`がポインタ型である。
25+
[`allocator_traits`](/reference/memory/allocator_traits.md)`<PAlloc>::pointer`がポインタ型である。
2526
2627
2728
## 効果
28-
`PAlloc`型のアロケータ`palloc`を`alloc`で初期化する。
29-
サイズ`size`のコルーチンステートに十分なストレージとなる`U`の最小配列ストレージ、および[`operator delete`](op_delete.md)が後で`palloc`と等しいアロケータでこのメモリブロックを解放するのに必要となる未規定の追加ストレージの確保に`palloc`を用いる。
29+
- (2), (3) :
30+
- `PAlloc`型のアロケータ`palloc`を`alloc`で初期化する。
31+
- サイズ`size`のコルーチンステートに十分なストレージとなる`U`の最小配列ストレージ、および[`operator delete`](op_delete.md)が後で`palloc`と等しいアロケータでこのメモリブロックを解放するのに必要となる未規定の追加ストレージの確保に`palloc`を用いる。
3032
3133
3234
## 戻り値
33-
確保したストレージへのポインタ
35+
- (1) : `operator new(size,` [`allocator_arg`](/reference/memory/allocator_arg_t.md)`, allocator_type())`
36+
- (2), (3) : 確保したストレージへのポインタ
3437
3538
3639
## バージョン
@@ -45,9 +48,9 @@ void* operator new(size_t size, const Args&... args);
4548
4649
4750
## 関連項目
48-
- [`(constructor)`](op_constructor.md)
4951
- [`operator delete`](op_delete.md)
5052
5153
5254
## 参照
5355
- [P3552R3 Add a Coroutine Task Type](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3552r3.html)
56+
- [P3980R1 Task's Allocator Use](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3980r1.html)

0 commit comments

Comments
 (0)