tmp/tmpmp_9ip5e/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Queryable utilities <a id="exec.envs">[[exec.envs]]</a>
|
| 2 |
+
|
| 3 |
+
### Class template `prop` <a id="exec.prop">[[exec.prop]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::execution {
|
| 7 |
+
template<class QueryTag, class ValueType>
|
| 8 |
+
struct prop {
|
| 9 |
+
QueryTag query_; // exposition only
|
| 10 |
+
ValueType value_; // exposition only
|
| 11 |
+
|
| 12 |
+
constexpr const ValueType& query(QueryTag) const noexcept {
|
| 13 |
+
return value_;
|
| 14 |
+
}
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
template<class QueryTag, class ValueType>
|
| 18 |
+
prop(QueryTag, ValueType) -> prop<QueryTag, unwrap_reference_t<ValueType>>;
|
| 19 |
+
}
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
Class template `prop` is for building a queryable object from a query
|
| 23 |
+
object and a value.
|
| 24 |
+
|
| 25 |
+
*Mandates:* `callable<QueryTag, prop-like<ValueType>>` is modeled, where
|
| 26 |
+
*`prop-like`* is the following exposition-only class template:
|
| 27 |
+
|
| 28 |
+
``` cpp
|
| 29 |
+
template<class ValueType>
|
| 30 |
+
struct prop-like { // exposition only
|
| 31 |
+
const ValueType& query(auto) const noexcept;
|
| 32 |
+
};
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
[*Example 1*:
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
template<sender Sndr>
|
| 39 |
+
sender auto parameterize_work(Sndr sndr) {
|
| 40 |
+
// Make an environment such that get_allocator(env) returns a reference to a copy of my_alloc{}.
|
| 41 |
+
auto e = prop(get_allocator, my_alloc{});
|
| 42 |
+
|
| 43 |
+
// Parameterize the input sender so that it will use our custom execution environment.
|
| 44 |
+
return write_env(sndr, e);
|
| 45 |
+
}
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
— *end example*]
|
| 49 |
+
|
| 50 |
+
Specializations of `prop` are not assignable.
|
| 51 |
+
|
| 52 |
+
### Class template `env` <a id="exec.env">[[exec.env]]</a>
|
| 53 |
+
|
| 54 |
+
``` cpp
|
| 55 |
+
namespace std::execution {
|
| 56 |
+
template<queryable... Envs>
|
| 57 |
+
struct env {
|
| 58 |
+
Envs_0 envs_0; // exposition only
|
| 59 |
+
Envs_1 envs_1; // exposition only
|
| 60 |
+
⋮
|
| 61 |
+
Envs_{n-1} envs_{n-1}; // exposition only
|
| 62 |
+
|
| 63 |
+
template<class QueryTag>
|
| 64 |
+
constexpr decltype(auto) query(QueryTag q) const noexcept(see below);
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
template<class... Envs>
|
| 68 |
+
env(Envs...) -> env<unwrap_reference_t<Envs>...>;
|
| 69 |
+
}
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
The class template `env` is used to construct a queryable object from
|
| 73 |
+
several queryable objects. Query invocations on the resulting object are
|
| 74 |
+
resolved by attempting to query each subobject in lexical order.
|
| 75 |
+
|
| 76 |
+
Specializations of `env` are not assignable.
|
| 77 |
+
|
| 78 |
+
It is unspecified whether `env` supports initialization using a
|
| 79 |
+
parenthesized *expression-list* [[dcl.init]], unless the
|
| 80 |
+
*expression-list* consist of a single element of type (possibly const)
|
| 81 |
+
`env`.
|
| 82 |
+
|
| 83 |
+
[*Example 1*:
|
| 84 |
+
|
| 85 |
+
``` cpp
|
| 86 |
+
template<sender Sndr>
|
| 87 |
+
sender auto parameterize_work(Sndr sndr) {
|
| 88 |
+
// Make an environment such that:
|
| 89 |
+
// get_allocator(env) returns a reference to a copy of my_alloc{}
|
| 90 |
+
// get_scheduler(env) returns a reference to a copy of my_sched{}
|
| 91 |
+
auto e = env{prop(get_allocator, my_alloc{}),
|
| 92 |
+
prop(get_scheduler, my_sched{})};
|
| 93 |
+
|
| 94 |
+
// Parameterize the input sender so that it will use our custom execution environment.
|
| 95 |
+
return write_env(sndr, e);
|
| 96 |
+
}
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
— *end example*]
|
| 100 |
+
|
| 101 |
+
``` cpp
|
| 102 |
+
template<class QueryTag>
|
| 103 |
+
constexpr decltype(auto) query(QueryTag q) const noexcept(see below);
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
Let `has-query` be the following exposition-only concept:
|
| 107 |
+
|
| 108 |
+
``` cpp
|
| 109 |
+
template<class Env, class QueryTag>
|
| 110 |
+
concept has-query = // exposition only
|
| 111 |
+
requires (const Env& env) {
|
| 112 |
+
env.query(QueryTag());
|
| 113 |
+
};
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
Let *fe* be the first element of envs₀, envs₁, …, envsₙ₋₁ such that the
|
| 117 |
+
expression *`fe`*`.query(q)` is well-formed.
|
| 118 |
+
|
| 119 |
+
*Constraints:* `(has-query<Envs, QueryTag> || ...)` is `true`.
|
| 120 |
+
|
| 121 |
+
*Effects:* Equivalent to: `return `*`fe`*`.query(q);`
|
| 122 |
+
|
| 123 |
+
*Remarks:* The expression in the `noexcept` clause is equivalent to
|
| 124 |
+
`noexcept(`*`fe`*`.query(q))`.
|
| 125 |
+
|