From Jason Turner

[exec.factories]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvpabj8gv/{from.md → to.md} +99 -0
tmp/tmpvpabj8gv/{from.md → to.md} RENAMED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Sender factories <a id="exec.factories">[[exec.factories]]</a>
2
+
3
+ #### `execution::schedule` <a id="exec.schedule">[[exec.schedule]]</a>
4
+
5
+ `schedule` obtains a schedule sender [[exec.async.ops]] from a
6
+ scheduler.
7
+
8
+ The name `schedule` denotes a customization point object. For a
9
+ subexpression `sch`, the expression `schedule(sch)` is
10
+ expression-equivalent to `sch.schedule()`.
11
+
12
+ *Mandates:* The type of `sch.schedule()` satisfies `sender`.
13
+
14
+ If the expression
15
+
16
+ ``` cpp
17
+ get_completion_scheduler<set_value_t>(get_env(sch.schedule())) == sch
18
+ ```
19
+
20
+ is ill-formed or evaluates to `false`, the behavior of calling
21
+ `schedule(sch)` is undefined.
22
+
23
+ #### `execution::just`, `execution::just_error`, `execution::just_stopped` <a id="exec.just">[[exec.just]]</a>
24
+
25
+ `just`, `just_error`, and `just_stopped` are sender factories whose
26
+ asynchronous operations complete synchronously in their start operation
27
+ with a value completion operation, an error completion operation, or a
28
+ stopped completion operation, respectively.
29
+
30
+ The names `just`, `just_error`, and `just_stopped` denote customization
31
+ point objects. Let *`just-cpo`* be one of `just`, `just_error`, or
32
+ `just_stopped`. For a pack of subexpressions `ts`, let `Ts` be the pack
33
+ of types `decltype((ts))`. The expression `just-cpo(ts...)` is
34
+ ill-formed if
35
+
36
+ - `(movable-value<Ts> &&...)` is `false`, or
37
+ - *`just-cpo`* is `just_error` and `sizeof...(ts) == 1` is `false`, or
38
+ - *`just-cpo`* is `just_stopped` and `sizeof...(ts) == 0` is `false`.
39
+
40
+ Otherwise, it is expression-equivalent to
41
+ `make-sender(just-cpo, product-type{ts...})`.
42
+
43
+ For `just`, `just_error`, and `just_stopped`, let *`set-cpo`* be
44
+ `set_value`, `set_error`, and `set_stopped`, respectively. The
45
+ exposition-only class template *`impls-for`* [[exec.snd.expos]] is
46
+ specialized for *`just-cpo`* as follows:
47
+
48
+ ``` cpp
49
+ namespace std::execution {
50
+ template<>
51
+ struct impls-for<decayed-typeof<just-cpo>> : default-impls {
52
+ static constexpr auto start =
53
+ [](auto& state, auto& rcvr) noexcept -> void {
54
+ auto& [...ts] = state;
55
+ set-cpo(std::move(rcvr), std::move(ts)...);
56
+ };
57
+ };
58
+ }
59
+ ```
60
+
61
+ #### `execution::read_env` <a id="exec.read.env">[[exec.read.env]]</a>
62
+
63
+ `read_env` is a sender factory for a sender whose asynchronous operation
64
+ completes synchronously in its start operation with a value completion
65
+ result equal to a value read from the receiver’s associated environment.
66
+
67
+ `read_env` is a customization point object. For some query object `q`,
68
+ the expression `read_env(q)` is expression-equivalent to
69
+ `make-sender(read_env, q)`.
70
+
71
+ The exposition-only class template *`impls-for`* [[exec.snd.expos]] is
72
+ specialized for `read_env` as follows:
73
+
74
+ ``` cpp
75
+ namespace std::execution {
76
+ template<>
77
+ struct impls-for<decayed-typeof<read_env>> : default-impls {
78
+ static constexpr auto start =
79
+ [](auto query, auto& rcvr) noexcept -> void {
80
+ TRY-SET-VALUE(rcvr, query(get_env(rcvr)));
81
+ };
82
+ };
83
+
84
+ template<class Sndr, class Env>
85
+ static consteval void check-types();
86
+ }
87
+ ```
88
+
89
+ ``` cpp
90
+ template<class Sndr, class Env>
91
+ static consteval void check-types();
92
+ ```
93
+
94
+ Let `Q` be `decay_t<`*`data-type`*`<Sndr>>`.
95
+
96
+ *Throws:* An exception of an unspecified type derived from `exception`
97
+ if the expression `Q()(env)` is ill-formed or has type `void`, where
98
+ `env` is an lvalue subexpression whose type is `Env`.
99
+