Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions reference/execution/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ namespace std::execution {
| [`execution::default_domain`](execution/default_domain.md) | デフォルト実行ドメイン (class) | C++26 |
| [`execution::sender`](execution/sender.md) | Sender型 (concept) | C++26 |
| [`execution::sender_in`](execution/sender_in.md) | 指定環境で有効なSender (concept) | C++26 |
| [`execution::dependent_sender`](execution/dependent_sender.md) | 依存Sender (concept) | C++26 |
| [`execution::sender_to`](execution/sender_to.md) | 指定Receiverに接続可能なSender (concept) | C++26 |
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md) | Senderの完了シグネチャ集合を取得 (customization point object) | C++26 |
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderの完了シグネチャ集合を取得 (alias template) | C++26 |
| [`execution::value_types_of_t`](execution/value_types_of_t.md) | Senderの値完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
| [`execution::error_types_of_t`](execution/error_types_of_t.md) | Senderのエラー完了シグネチャ集合から指定操作で型を生成 (alias template) | C++26 |
| [`execution::sends_stopped`](execution/sends_stopped.md) | Senderが停止完了を送信しうるか否か (variable template) | C++26 |
Expand Down Expand Up @@ -142,6 +141,9 @@ Senderコンシューマは名前空間 `std::this_thread` で定義される。
| 名前 | 説明 | 対応バージョン |
|------|------|----------------|
| [`execution::completion_signatures`](execution/completion_signatures.md) | 完了シグネチャ集合を表現する型 (class template) | C++26 |
| [`execution::dependent_sender_error`](execution/dependent_sender_error.md) | 依存Senderを表す例外クラス(class) | C++26 |
| [`execution::get_completion_signatures`](execution/get_completion_signatures.md) | Senderの完了シグネチャ集合を取得 (function template) | C++26 |
| [`execution::completion_signatures_of_t`](execution/completion_signatures_of_t.md) | Senderの完了シグネチャ集合を取得 (alias template) | C++26 |
| [`execution::run_loop`](execution/run_loop.md) | 単一スレッド上でのループ実行 (class) | C++26 |

### コルーチンユーティリティ
Expand Down
6 changes: 3 additions & 3 deletions reference/execution/execution/basic-operation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace std::execution {
```
* operation_state_t[link operation_state.md]
* tag_of_t[link tag_of_t.md]
* indices-for[link basic-sender.md]
* impls-for[link impls-for.md]
* std::move[link /reference/utility/move.md]

Expand All @@ -60,6 +61,7 @@ is_nothrow_constructible_v<basic-state<Self, Rcvr>, Self, Rcvr> &&
noexcept(connect-all(this, std::forward<Sndr>(sndr), indices-for<Sndr>()))
```
* is_nothrow_constructible_v[link /reference/type_traits/is_nothrow_constructible.md]
* indices-for[link basic-sender.md]

`basic-state`コンストラクタ`noexcept`節の式は下記の通り。

Expand Down Expand Up @@ -101,13 +103,11 @@ constexpr auto connect-all = see below; // exposition only
template<class Sndr, class Rcvr>
using connect-all-result = call-result-t< // exposition only
decltype(connect-all), basic-state<Sndr, Rcvr>*, Sndr, indices-for<Sndr>>;

template<class Sndr>
using indices-for = remove_reference_t<Sndr>::indices-for; // exposition only
```
* call-result-t[link /reference/functional/call-result-t.md]
* impls-for[link impls-for.md]
* tag_of_t[link tag_of_t.md]
* indices-for[link basic-sender.md]

説明専用の定数`connect-all`は、下記ラムダ式と等価な関数呼び出し可能なオブジェクトとして初期化される。

Expand Down
39 changes: 27 additions & 12 deletions reference/execution/execution/basic-sender.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ namespace std::execution {
return {std::forward<Self>(self), std::move(rcvr)};
}

template<decays-to<basic-sender> Self, class Env>
auto get_completion_signatures(this Self&& self, Env&& env) noexcept
-> completion-signatures-for<Self, Env> {
return {};
}
template<decays-to<basic-sender> Self, class... Env>
static constexpr auto get_completion_signatures();
};
}
```
Expand Down Expand Up @@ -62,19 +59,35 @@ is_nothrow_constructible_v<basic-operation<Self, Rcvr>, Self, Rcvr>
* is_nothrow_constructible_v[link /reference/type_traits/is_nothrow_constructible.md]
* basic-operation[link basic-operation.md]

説明専用のエイリアステンプレート`completion-signatures-for`は、下記の通り定義される。
### `get_completion_signatures`メンバ関数
```cpp
template<class Tag, class Data, class... Child>
template<class Sndr, class... Env>
constexpr auto basic-sender<Tag, Data, Child...>::get_completion_signatures();
```

型`E`をリスト`Env...,` [`env<>`](env.md)における先頭の型としたとき、[環境](../queryable.md)`E`をもつ[Receiver](receiver.md)型を`Rcvr`とする。式`CHECK-TYPE()`を[`impls-for`](impls-for.md)`<Tag>::template check-types<Sndr, E>()`とし、型`CS`を下記の通り定義する。

- `CHECK-TYPE()`がコア定数式のとき、`op`を[`connect_result_t`](connect_result_t.md)`<Sndr, Rcvr>`型の左辺値とする。`CS`は[`completion_signatures`](completion_signatures.md)の特殊化となり、そのテンプレート引数の集合は評価`op.`[`start()`](start.md)の結果結果として得られる完了操作の集合に対応する。
- そうでなければ、`CS`は[`completion_signatures<>`](completion_signatures.md)となる。

テンプレートパラメータ制約 : 式`CHECK-TYPES()`が適格であること。

効果:下記と等価。

```cpp
template<class Sndr, class Env>
using completion-signatures-for = see below; // exposition only
CHECK-TYPES();
return CS();
```

説明用の`sndr`を`decltype((sndr))`が`Sndr`型となる式、`rcvr`を[`sender_in`](sender_in.md)`<Sndr, Env> == true`となる[環境](../queryable.md)`Env`に関連付けられた[`Receiver`](receiver.md)とする。

`completion-signatures-for<Sndr, Env>`は[`completion_signatures`](completion_signatures.md)の特殊化であり、そのテンプレート引数は `sndr`と`rcvr`との[接続(connect)](connect.md)結果[Operation State](operation_state.md)を[開始(start)](start.md)して得られる可能性のある結果の完了シグネチャ集合となる。
## 説明専用エンティティ
説明専用のエイリアステンプレート`indices-for`を下記の通り定義する。

[`sender_in`](sender_in.md)`<Sndr, Env> == false`となる場合、`completion-signatures-for<Sndr, Env>`は[`completion_signatures`](completion_signatures.md)の特殊化ではない別の型となる。
処理系(標準ライブラリ実装者)は、この型を用いてユーザにエラー理由を通知することが推奨される。
```cpp
template<class Sndr>
using indices-for = remove_reference_t<Sndr>::indices-for; // exposition only
```


## バージョン
Expand All @@ -84,10 +97,12 @@ using completion-signatures-for = see below; // exposition only

## 関連項目
- [`make-sender`](make-sender.md)
- [`impls-for`](impls-for.md)
- [`basic-operation`](basic-operation.md)
- [`execution::sender`](sender.md)


## 参照
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
24 changes: 24 additions & 0 deletions reference/execution/execution/bulk.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ namespace std::execution {
template<>
struct impls-for<bulk_t> : default-impls {
static constexpr auto complete = see below;

template<class Sndr, class... Env>
static consteval void check-types();
};
}
```
Expand Down Expand Up @@ -75,6 +78,26 @@ namespace std::execution {

型`Tag`が[`set_value_t`](set_value.md)以外の型であるとき、もしくは式`f(auto(shape), args...)`が適格なときに限って、上記ラムダ式のrequires節が満たされる。

メンバ関数`impls-for<bulk_t>::check-types`の効果は下記の通り。

```cpp
auto cs = get_completion_signatures<child-type<Sndr>, FWD-ENV-T(Env)...>();
auto fn = []<class... Ts>(set_value_t(*)(Ts...)) {
if constexpr (!invocable<remove_cvref_t<data-type<Sndr>>, Ts&...>)
throw unspecified-exception();
};
cs.for-each(overload-set{fn, [](auto){}});
```
* get_completion_signatures[link get_completion_signatures.md]
* child-type[link child-type.md]
* FWD-ENV-T[link ../forwarding_query.md]
* set_value_t[link set_value.md]
* data-type[link data-type.md]
* for-each[link completion_signatures.md]
* overload-set[link overload-set.md]

`unspecified-exception`は[`exception`](/reference/exception/exception.md)から派生した型となる。


## カスタマイゼーションポイント
Senderアルゴリズム構築時および[Receiver](receiver.md)接続時に、関連付けられた実行ドメインに対して[`execution::transform_sender`](transform_sender.md)経由でSender変換が行われる。
Expand Down Expand Up @@ -133,3 +156,4 @@ int main()
## 参照
- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html)
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
3 changes: 3 additions & 0 deletions reference/execution/execution/child-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ namespace std::execution {

## 関連項目
- [`execution::schedule_from`](schedule_from.md)
- [`execution::let_value`](let_value.md)
- [`execution::into_variant`](into_variant.md)
- [`execution::stopped_as_optional`](stopped_as_optional.md)
- [`write-env`](write-env.md)


## 参照
Expand Down
19 changes: 15 additions & 4 deletions reference/execution/execution/completion_signatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@
```cpp
namespace std::execution {
template<completion-signature... Fns>
struct completion_signatures {};
struct completion_signatures {
template<class Tag>
static constexpr size_t count-of(Tag) { return see below; }

template<class Fn>
static constexpr void for-each(Fn&& fn) { // exposition only
(std::forward<Fn>(fn)(static_cast<Fns*>(nullptr)), ...);
}
};
}
```

## 概要
`completion_signatures`クラステンプレートは、完了シグネチャの集合をテンプレートパラメータとして表現する。

実行制御ライブラリ仕様定義では、説明専用のコンセプト`valid-completion-signatures`を利用する
式`tag`の[decayed](/reference/type_traits/decay.md)型を`Tag`としたとき、説明専用のメンバ関数`count-of`は`Fns`中の`Tag(Ts...)`形式で表される関数型の個数を返す


### 説明専用のコンセプト `valid-completion-signatures`
```cpp
template<class Sigs>
concept valid-completion-signatures = see below;
```

`Sigs`が[`completion_signatures`](completion_signatures.md)クラステンプレートの特殊化であるとき、`Sigs`は説明専用コンセプト`valid-completion-signatures`のモデルである。
`Sigs`が`completion_signatures`クラステンプレートの特殊化であるとき、`Sigs`は説明専用コンセプト`valid-completion-signatures`のモデルである。


## テンプレートパラメータ制約
Expand Down Expand Up @@ -80,11 +90,12 @@ int main()


## 関連項目
- [`execution::receiver`](receiver.md)
- [`execution::get_completion_signatures`](get_completion_signatures.md)
- [`execution::set_value_t`](set_value.md)
- [`execution::set_error_t`](set_error.md)
- [`execution::set_stopped_t`](set_stopped.md)


## 参照
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
11 changes: 5 additions & 6 deletions reference/execution/execution/completion_signatures_of_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

```cpp
namespace std::execution {
template<class Sndr, class Env = env<>>
requires sender_in<Sndr, Env>
using completion_signatures_of_t = call-result-t<get_completion_signatures_t, Sndr, Env>;
template<class Sndr, class... Env>
requires sender_in<Sndr, Env...>
using completion_signatures_of_t = decltype(get_completion_signatures<Sndr, Env...>());
}
```
* env<>[link env.md]
* sender_in[link sender_in.md]
* call-result-t[link /reference/functional/call-result-t.md]
* get_completion_signatures_t[link get_completion_signatures.md]
* get_completion_signatures[link get_completion_signatures.md]

## 概要
[Sender型](sender.md)`Sndr`から[環境](../queryable.md)`Env`における[完了シグネチャ集合](completion_signatures.md)を取得する。
Expand All @@ -37,3 +35,4 @@ namespace std::execution {

## 参照
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
9 changes: 7 additions & 2 deletions reference/execution/execution/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace std::execution {

## 効果
説明用の型`Sndr`を`decltype((sndr))`、型`Rcvr`を`decltype((rcvr))`とし、式`new_sndr`を次の通りとする。
このとき[`sender`](sender.md)`<Sndr> &&` [`receiver`](receiver.md)`<Rcvr> == true`であること。

```cpp
transform_sender(decltype(get-domain-late(sndr, get_env(rcvr))){}, sndr, get_env(rcvr))
Expand All @@ -37,6 +36,11 @@ transform_sender(decltype(get-domain-late(sndr, get_env(rcvr))){}, sndr, get_env
- 適格であるならば、式`new_sndr.connect(rcvr)`
- そうでなければ、式`connect-awaitable(new_sndr, rcvr)`

このとき下記が全て`true`であること。

- [`sender_in`](sender_in.md)`<Sndr,` [`env_of_t`](env_of_t.md)`<Rcvr>>`
- [`receiver_of`](receiver_of.md)`<Rcvr,` [`completion_signatures_of_t`](completion_signatures_of_t.md)`<Sndr,` [`env_of_t`](env_of_t.md)`<Rcvr>>>`


### Awaitable接続用へルパ
説明用のクラス`connect-awaitable-promise`, `operation-state-task`をそれぞれ下記の通り定義する。
Expand Down Expand Up @@ -108,7 +112,7 @@ namespace std::execution {
* destroy()[link /reference/coroutine/coroutine_handle/destroy.md]
* resume()[link /reference/coroutine/coroutine_handle/resume.md]

`C`型の`c`と[コルーチンPromise型](/lang/cpp20/coroutines.md)の左辺値`p`に対して、`await-result-type<C, Promise>`を`decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c, p).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とする。
`C`型の`c`と[コルーチンPromise型](/lang/cpp20/coroutines.md)の左辺値`p`に対して、`await-result-type<C, Promise>`を`decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c, p).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とし、`await-result-type<C>`を`decltype(`[`GET-AWAITER`](../is-awaitable.md)`(c).`[`await_resume()`](/lang/cpp20/coroutines.md)`)`型とする。
型`V`を`await-result-type<DS, connect-awaitable-promise>`とする。

[完了シグネチャ集合型](completion_signatures.md)`Sigs`を下記の通り定義する。
Expand Down Expand Up @@ -238,4 +242,5 @@ int main()
## 参照
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3396R1 std::execution wording fixes](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3396r1.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
- [LWG 4208. Wording needs to ensure that in `connect(sndr, rcvr)` that `rcvr` expression is only evaluated once](https://cplusplus.github.io/LWG/issue4208)
34 changes: 34 additions & 0 deletions reference/execution/execution/data-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# data-type
* execution[meta header]
* std::execution[meta namespace]
* type-alias[meta id-type]
* cpp26[meta cpp]

```cpp
namespace std::execution {
template<class Sndr>
using data-type = decltype(declval<Sndr>().template get<1>()); // exposition only
}
```
* template get[link product-type.md]

## 概要
[Senderアルゴリズム型](basic-sender.md)`Sndr`のデータ型を取得する説明専用のエイリアステンプレート。


## バージョン
### 言語
- C++26

## 関連項目
- [`execution::read_env`](read_env.md)
- [`execution::schedule_from`](schedule_from.md)
- [`execution::then`](then.md)
- [`execution::let_value`](let_value.md)
- [`execution::bulk`](bulk.md)
- [`write-env`](write-env.md)


## 参照
- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html)
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
42 changes: 42 additions & 0 deletions reference/execution/execution/decay-copyable-result-datums.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# decay-copyable-result-datums
* execution[meta header]
* function template[meta id-type]
* std::execution[meta namespace]
* cpp26[meta cpp]

```cpp
constexpr void decay-copyable-result-datums(auto cs) {
cs.for-each([]<class Tag, class... Ts>(Tag(*)(Ts...)) {
if constexpr (!(is_constructible_v<decay_t<Ts>, Ts> &&...))
throw unspecified-exception();
});
}
```
* for-each[link completion_signatures.md]
* is_constructible_v[link /reference/type_traits/is_constructible.md]

## 概要
`decay-copyable-result-datums`は、Senderアルゴリズム動作仕様定義で用いられる説明専用の関数テンプレートである。

`unspecified-exception`は[`exception`](/reference/exception/exception.md)から派生した型となる。


## バージョン
### 言語
- C++26

### 処理系
- [Clang](/implementation.md#clang): ??
- [GCC](/implementation.md#gcc): ??
- [ICC](/implementation.md#icc): ??
- [Visual C++](/implementation.md#visual_cpp): ??


## 関連項目
- [`execution::schedule_from`](schedule_from.md)
- [`execution::when_all`](when_all.md)
- [`execution::into_variant`](into_variant.md)


## 参照
- [P3557R3 High-Quality Sender Diagnostics with Constexpr Exceptions](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3557r3.html)
Loading