|
| 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