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ept defines the requirements for a sender type
|
| 4 |
+
[[exec.async.ops]]. The `sender_in` concept defines the requirements for
|
| 5 |
+
a sender type that can create asynchronous operations given an
|
| 6 |
+
associated environment type. The `sender_to` concept defines the
|
| 7 |
+
requirements for a sender type that can connect with a specific receiver
|
| 8 |
+
type. The `get_env` customization point object is used to access a
|
| 9 |
+
sender’s associated attributes. The connect customization point object
|
| 10 |
+
is used to connect [[exec.async.ops]] a sender and a receiver to produce
|
| 11 |
+
an operation state.
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
namespace std::execution {
|
| 15 |
+
template<auto>
|
| 16 |
+
concept is-constant = true; // exposition only
|
| 17 |
+
|
| 18 |
+
template<class Sndr>
|
| 19 |
+
concept is-sender = // exposition only
|
| 20 |
+
derived_from<typename Sndr::sender_concept, sender_t>;
|
| 21 |
+
|
| 22 |
+
template<class Sndr>
|
| 23 |
+
concept enable-sender = // exposition only
|
| 24 |
+
is-sender<Sndr> ||
|
| 25 |
+
is-awaitable<Sndr, env-promise<env<>>>; // [exec.awaitable]
|
| 26 |
+
|
| 27 |
+
template<class Sndr>
|
| 28 |
+
inline constexpr bool enable_sender = enable-sender<Sndr>;
|
| 29 |
+
|
| 30 |
+
template<class Sndr>
|
| 31 |
+
consteval bool is-dependent-sender-helper() try { // exposition only
|
| 32 |
+
get_completion_signatures<Sndr>();
|
| 33 |
+
return false;
|
| 34 |
+
} catch (dependent_sender_error&) {
|
| 35 |
+
return true;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
template<class Sndr>
|
| 39 |
+
concept sender =
|
| 40 |
+
enable_sender<remove_cvref_t<Sndr>> &&
|
| 41 |
+
requires (const remove_cvref_t<Sndr>& sndr) {
|
| 42 |
+
{ get_env(sndr) } -> queryable;
|
| 43 |
+
} &&
|
| 44 |
+
move_constructible<remove_cvref_t<Sndr>> &&
|
| 45 |
+
constructible_from<remove_cvref_t<Sndr>, Sndr>;
|
| 46 |
+
|
| 47 |
+
template<class Sndr, class... Env>
|
| 48 |
+
concept sender_in =
|
| 49 |
+
sender<Sndr> &&
|
| 50 |
+
(sizeof...(Env) <= 1) &&
|
| 51 |
+
(queryable<Env> &&...) &&
|
| 52 |
+
is-constant<get_completion_signatures<Sndr, Env...>()>;
|
| 53 |
+
|
| 54 |
+
template<class Sndr>
|
| 55 |
+
concept dependent_sender =
|
| 56 |
+
sender<Sndr> && bool_constant<is-dependent-sender-helper<Sndr>()>::value;
|
| 57 |
+
|
| 58 |
+
template<class Sndr, class Rcvr>
|
| 59 |
+
concept sender_to =
|
| 60 |
+
sender_in<Sndr, env_of_t<Rcvr>> &&
|
| 61 |
+
receiver_of<Rcvr, completion_signatures_of_t<Sndr, env_of_t<Rcvr>>> &&
|
| 62 |
+
requires (Sndr&& sndr, Rcvr&& rcvr) {
|
| 63 |
+
connect(std::forward<Sndr>(sndr), std::forward<Rcvr>(rcvr));
|
| 64 |
+
};
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
For a type `Sndr`, if `sender<Sndr>` is `true` and
|
| 69 |
+
`dependent_sender<Sndr>` is `false`, then `Sndr` is a non-dependent
|
| 70 |
+
sender [[exec.async.ops]].
|
| 71 |
+
|
| 72 |
+
Given a subexpression `sndr`, let `Sndr` be `decltype((sndr))` and let
|
| 73 |
+
`rcvr` be a receiver with an associated environment whose type is `Env`.
|
| 74 |
+
A completion operation is a *permissible completion* for `Sndr` and
|
| 75 |
+
`Env` if its completion signature appears in the argument list of the
|
| 76 |
+
specialization of `completion_signatures` denoted by
|
| 77 |
+
`completion_signatures_of_t<Sndr, Env>`. `Sndr` and `Env` model
|
| 78 |
+
`sender_in<Sndr, Env>` if all the completion operations that are
|
| 79 |
+
potentially evaluated by connecting `sndr` to `rcvr` and starting the
|
| 80 |
+
resulting operation state are permissible completions for `Sndr` and
|
| 81 |
+
`Env`.
|
| 82 |
+
|
| 83 |
+
*Remarks:* Pursuant to [[namespace.std]], users may specialize
|
| 84 |
+
`enable_sender` to `true` for cv-unqualified program-defined types that
|
| 85 |
+
model `sender`, and `false` for types that do not. Such specializations
|
| 86 |
+
shall be usable in constant expressions [[expr.const]] and have type
|
| 87 |
+
`const bool`.
|
| 88 |
+
|
| 89 |
+
The exposition-only concepts `sender-of` and `sender-in-of` define the
|
| 90 |
+
requirements for a sender type that completes with a given unique set of
|
| 91 |
+
value result types.
|
| 92 |
+
|
| 93 |
+
``` cpp
|
| 94 |
+
namespace std::execution {
|
| 95 |
+
template<class... As>
|
| 96 |
+
using value-signature = set_value_t(As...); // exposition only
|
| 97 |
+
|
| 98 |
+
template<class Sndr, class SetValue, class... Env>
|
| 99 |
+
concept sender-in-of-impl = // exposition only
|
| 100 |
+
sender_in<Sndr, Env...> &&
|
| 101 |
+
MATCHING-SIG(SetValue, // see [exec.general]
|
| 102 |
+
gather-signatures<set_value_t, // see [exec.cmplsig]
|
| 103 |
+
completion_signatures_of_t<Sndr, Env...>,
|
| 104 |
+
value-signature,
|
| 105 |
+
type_identity_t>);
|
| 106 |
+
|
| 107 |
+
template<class Sndr, class Env, class... Values>
|
| 108 |
+
concept sender-in-of = // exposition only
|
| 109 |
+
sender-in-of-impl<Sndr, set_value_t(Values...), Env>;
|
| 110 |
+
|
| 111 |
+
template<class Sndr, class... Values>
|
| 112 |
+
concept sender-of = // exposition only
|
| 113 |
+
sender-in-of-impl<Sndr, set_value_t(Values...)>;
|
| 114 |
+
}
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
Let `sndr` be an expression such that `decltype((sndr))` is `Sndr`. The
|
| 118 |
+
type `tag_of_t<Sndr>` is as follows:
|
| 119 |
+
|
| 120 |
+
- If the declaration
|
| 121 |
+
``` cpp
|
| 122 |
+
auto&& [tag, data, ...children] = sndr;
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
would be well-formed, `tag_of_t<Sndr>` is an alias for
|
| 126 |
+
`decltype(auto(tag))`.
|
| 127 |
+
- Otherwise, `tag_of_t<Sndr>` is ill-formed.
|
| 128 |
+
|
| 129 |
+
Let `sender-for` be an exposition-only concept defined as follows:
|
| 130 |
+
|
| 131 |
+
``` cpp
|
| 132 |
+
namespace std::execution {
|
| 133 |
+
template<class Sndr, class Tag>
|
| 134 |
+
concept sender-for =
|
| 135 |
+
sender<Sndr> &&
|
| 136 |
+
same_as<tag_of_t<Sndr>, Tag>;
|
| 137 |
+
}
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
For a type `T`, `SET-VALUE-SIG(T)` denotes the type `set_value_t()` if
|
| 141 |
+
`T` is cv `void`; otherwise, it denotes the type `set_value_t(T)`.
|
| 142 |
+
|
| 143 |
+
Library-provided sender types
|
| 144 |
+
|
| 145 |
+
- always expose an overload of a member `connect` that accepts an rvalue
|
| 146 |
+
sender and
|
| 147 |
+
- only expose an overload of a member `connect` that accepts an lvalue
|
| 148 |
+
sender if they model `copy_constructible`.
|
| 149 |
+
|