tmp/tmppeyjefh0/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### `execution::into_variant` <a id="exec.into.variant">[[exec.into.variant]]</a>
|
| 2 |
+
|
| 3 |
+
`into_variant` adapts a sender with multiple value completion signatures
|
| 4 |
+
into a sender with just one value completion signature consisting of a
|
| 5 |
+
`variant` of `tuple`s.
|
| 6 |
+
|
| 7 |
+
The name `into_variant` denotes a pipeable sender adaptor object. For a
|
| 8 |
+
subexpression `sndr`, let `Sndr` be `decltype((sndr))`. If `Sndr` does
|
| 9 |
+
not satisfy `sender`, `into_variant(sndr)` is ill-formed.
|
| 10 |
+
|
| 11 |
+
Otherwise, the expression `into_variant(sndr)` is expression-equivalent
|
| 12 |
+
to:
|
| 13 |
+
|
| 14 |
+
``` cpp
|
| 15 |
+
transform_sender(get-domain-early(sndr), make-sender(into_variant, {}, sndr))
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
except that `sndr` is only evaluated once.
|
| 19 |
+
|
| 20 |
+
The exposition-only class template *`impls-for`* [[exec.snd.expos]] is
|
| 21 |
+
specialized for `into_variant` as follows:
|
| 22 |
+
|
| 23 |
+
``` cpp
|
| 24 |
+
namespace std::execution {
|
| 25 |
+
template<>
|
| 26 |
+
struct impls-for<into_variant_t> : default-impls {
|
| 27 |
+
static constexpr auto get-state = see below;
|
| 28 |
+
static constexpr auto complete = see below;
|
| 29 |
+
|
| 30 |
+
template<class Sndr, class... Env>
|
| 31 |
+
static consteval void check-types() {
|
| 32 |
+
auto cs = get_completion_signatures<child-type<Sndr>, FWD-ENV-T(Env)...>();
|
| 33 |
+
decay-copyable-result-datums(cs); // see [exec.snd.expos]
|
| 34 |
+
}
|
| 35 |
+
};
|
| 36 |
+
}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
The member `impls-for<into_variant_t>::get-state` is initialized with a
|
| 40 |
+
callable object equivalent to the following lambda:
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept
|
| 44 |
+
-> type_identity<value_types_of_t<child-type<Sndr>, FWD-ENV-T(env_of_t<Rcvr>)>> {
|
| 45 |
+
return {};
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
The member `impls-for<into_variant_t>::complete` is initialized with a
|
| 50 |
+
callable object equivalent to the following lambda:
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
[]<class State, class Rcvr, class Tag, class... Args>(
|
| 54 |
+
auto, State, Rcvr& rcvr, Tag, Args&&... args) noexcept -> void {
|
| 55 |
+
if constexpr (same_as<Tag, set_value_t>) {
|
| 56 |
+
using variant_type = State::type;
|
| 57 |
+
TRY-SET-VALUE(rcvr, variant_type(decayed-tuple<Args...>{std::forward<Args>(args)...}));
|
| 58 |
+
} else {
|
| 59 |
+
Tag()(std::move(rcvr), std::forward<Args>(args)...);
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
```
|
| 63 |
+
|