From Jason Turner

[exec.recv.concepts]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9xgww4mp/{from.md → to.md} +56 -0
tmp/tmp9xgww4mp/{from.md → to.md} RENAMED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Receiver concepts <a id="exec.recv.concepts">[[exec.recv.concepts]]</a>
2
+
3
+ A receiver represents the continuation of an asynchronous operation. The
4
+ `receiver` concept defines the requirements for a receiver type
5
+ [[exec.async.ops]]. The `receiver_of` concept defines the requirements
6
+ for a receiver type that is usable as the first argument of a set of
7
+ completion operations corresponding to a set of completion signatures.
8
+ The `get_env` customization point object is used to access a receiver’s
9
+ associated environment.
10
+
11
+ ``` cpp
12
+ namespace std::execution {
13
+ template<class Rcvr>
14
+ concept receiver =
15
+ derived_from<typename remove_cvref_t<Rcvr>::receiver_concept, receiver_t> &&
16
+ requires(const remove_cvref_t<Rcvr>& rcvr) {
17
+ { get_env(rcvr) } -> queryable;
18
+ } &&
19
+ move_constructible<remove_cvref_t<Rcvr>> && // rvalues are movable, and
20
+ constructible_from<remove_cvref_t<Rcvr>, Rcvr>; // lvalues are copyable
21
+
22
+ template<class Signature, class Rcvr>
23
+ concept valid-completion-for = // exposition only
24
+ requires (Signature* sig) {
25
+ []<class Tag, class... Args>(Tag(*)(Args...))
26
+ requires callable<Tag, remove_cvref_t<Rcvr>, Args...>
27
+ {}(sig);
28
+ };
29
+
30
+ template<class Rcvr, class Completions>
31
+ concept has-completions = // exposition only
32
+ requires (Completions* completions) {
33
+ []<valid-completion-for<Rcvr>...Sigs>(completion_signatures<Sigs...>*)
34
+ {}(completions);
35
+ };
36
+
37
+ template<class Rcvr, class Completions>
38
+ concept receiver_of =
39
+ receiver<Rcvr> && has-completions<Rcvr, Completions>;
40
+ }
41
+ ```
42
+
43
+ Class types that are marked `final` do not model the `receiver` concept.
44
+
45
+ Let `rcvr` be a receiver and let `op_state` be an operation state
46
+ associated with an asynchronous operation created by connecting `rcvr`
47
+ with a sender. Let `token` be a stop token equal to
48
+ `get_stop_token(get_env(rcvr))`. `token` shall remain valid for the
49
+ duration of the asynchronous operation’s lifetime [[exec.async.ops]].
50
+
51
+ [*Note 1*: This means that, unless it knows about further guarantees
52
+ provided by the type of `rcvr`, the implementation of `op_state` cannot
53
+ use `token` after it executes a completion operation. This also implies
54
+ that any stop callbacks registered on token must be destroyed before the
55
+ invocation of the completion operation. — *end note*]
56
+