|
| 1 | +# product-type |
| 2 | +* execution[meta header] |
| 3 | +* class template[meta id-type] |
| 4 | +* std::execution[meta namespace] |
| 5 | +* cpp26[meta cpp] |
| 6 | + |
| 7 | +```cpp |
| 8 | +template<class T0, class T1, ..., class Tn> |
| 9 | +struct product-type { // exposition only |
| 10 | + T0 t0; // exposition only |
| 11 | + T1 t1; // exposition only |
| 12 | + // ... |
| 13 | + Tn tn; // exposition only |
| 14 | + |
| 15 | + template<size_t I, class Self> |
| 16 | + constexpr decltype(auto) get(this Self&& self) noexcept; // exposition only |
| 17 | + |
| 18 | + template<class Self, class Fn> |
| 19 | + constexpr decltype(auto) apply(this Self&& self, Fn&& fn) // exposition only |
| 20 | + noexcept(see below); |
| 21 | +}; |
| 22 | +``` |
| 23 | +* see below[italic] |
| 24 | +
|
| 25 | +## 概要 |
| 26 | +`product-type`は、実行制御ライブラリの仕様定義で用いられる説明専用のクラステンプレートである。 |
| 27 | +
|
| 28 | +`product-type`型の式は[構造化束縛](/lang/cpp17/structured_bindings.md)における初期化子として利用できる。 |
| 29 | +
|
| 30 | +
|
| 31 | +## クラス仕様 |
| 32 | +```cpp |
| 33 | +template<size_t I, class Self> |
| 34 | +constexpr decltype(auto) get(this Self&& self) noexcept; |
| 35 | +``` |
| 36 | + |
| 37 | +- 効果 : 下記と等価 |
| 38 | + |
| 39 | + ```cpp |
| 40 | + auto& [...ts] = self; |
| 41 | + return std::forward_like<Self>(ts...[I]); |
| 42 | + ``` |
| 43 | + |
| 44 | +```cpp |
| 45 | +template<class Self, class Fn> |
| 46 | +constexpr decltype(auto) apply(this Self&& self, Fn&& fn) noexcept(see below); |
| 47 | +``` |
| 48 | +* see below[italic] |
| 49 | +
|
| 50 | +- テンプレートパラメータ制約 : 下記`return`文の式が適格であること。 |
| 51 | +- 効果 : 下記と等価 |
| 52 | +
|
| 53 | + ```cpp |
| 54 | + auto& [...ts] = self; |
| 55 | + return std::forward<Fn>(fn)(std::forward_like<Self>(ts)...); |
| 56 | + ``` |
| 57 | +
|
| 58 | +- 備考 : `noexcept`節の式は上記`return`文が潜在的に例外送出しないならば`true`に、そうでなければ`false`となる。 |
| 59 | +
|
| 60 | +
|
| 61 | +## バージョン |
| 62 | +### 言語 |
| 63 | +- C++26 |
| 64 | +
|
| 65 | +
|
| 66 | +## 関連項目 |
| 67 | +- [`basic-sender`](basic-sender.md) |
| 68 | +
|
| 69 | +
|
| 70 | +## 参照 |
| 71 | +- [P2999R3 Sender Algorithm Customization](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2999r3.html) |
| 72 | +- [P2300R10 `std::execution`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html) |
0 commit comments