From Jason Turner

[exec.env]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpuw5gdocu/{from.md → to.md} +74 -0
tmp/tmpuw5gdocu/{from.md → to.md} RENAMED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class template `env` <a id="exec.env">[[exec.env]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::execution {
5
+ template<queryable... Envs>
6
+ struct env {
7
+ Envs_0 envs_0; // exposition only
8
+ Envs_1 envs_1; // exposition only
9
+
10
+ Envs_{n-1} envs_{n-1}; // exposition only
11
+
12
+ template<class QueryTag>
13
+ constexpr decltype(auto) query(QueryTag q) const noexcept(see below);
14
+ };
15
+
16
+ template<class... Envs>
17
+ env(Envs...) -> env<unwrap_reference_t<Envs>...>;
18
+ }
19
+ ```
20
+
21
+ The class template `env` is used to construct a queryable object from
22
+ several queryable objects. Query invocations on the resulting object are
23
+ resolved by attempting to query each subobject in lexical order.
24
+
25
+ Specializations of `env` are not assignable.
26
+
27
+ It is unspecified whether `env` supports initialization using a
28
+ parenthesized *expression-list* [[dcl.init]], unless the
29
+ *expression-list* consist of a single element of type (possibly const)
30
+ `env`.
31
+
32
+ [*Example 1*:
33
+
34
+ ``` cpp
35
+ template<sender Sndr>
36
+ sender auto parameterize_work(Sndr sndr) {
37
+ // Make an environment such that:
38
+ // get_allocator(env) returns a reference to a copy of my_alloc{}
39
+ // get_scheduler(env) returns a reference to a copy of my_sched{}
40
+ auto e = env{prop(get_allocator, my_alloc{}),
41
+ prop(get_scheduler, my_sched{})};
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
+ ``` cpp
51
+ template<class QueryTag>
52
+ constexpr decltype(auto) query(QueryTag q) const noexcept(see below);
53
+ ```
54
+
55
+ Let `has-query` be the following exposition-only concept:
56
+
57
+ ``` cpp
58
+ template<class Env, class QueryTag>
59
+ concept has-query = // exposition only
60
+ requires (const Env& env) {
61
+ env.query(QueryTag());
62
+ };
63
+ ```
64
+
65
+ Let *fe* be the first element of envs₀, envs₁, …, envsₙ₋₁ such that the
66
+ expression *`fe`*`.query(q)` is well-formed.
67
+
68
+ *Constraints:* `(has-query<Envs, QueryTag> || ...)` is `true`.
69
+
70
+ *Effects:* Equivalent to: `return `*`fe`*`.query(q);`
71
+
72
+ *Remarks:* The expression in the `noexcept` clause is equivalent to
73
+ `noexcept(`*`fe`*`.query(q))`.
74
+