From Jason Turner

[exec.prop]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp822pjyi_/{from.md → to.md} +49 -0
tmp/tmp822pjyi_/{from.md → to.md} RENAMED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class template `prop` <a id="exec.prop">[[exec.prop]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::execution {
5
+ template<class QueryTag, class ValueType>
6
+ struct prop {
7
+ QueryTag query_; // exposition only
8
+ ValueType value_; // exposition only
9
+
10
+ constexpr const ValueType& query(QueryTag) const noexcept {
11
+ return value_;
12
+ }
13
+ };
14
+
15
+ template<class QueryTag, class ValueType>
16
+ prop(QueryTag, ValueType) -> prop<QueryTag, unwrap_reference_t<ValueType>>;
17
+ }
18
+ ```
19
+
20
+ Class template `prop` is for building a queryable object from a query
21
+ object and a value.
22
+
23
+ *Mandates:* `callable<QueryTag, prop-like<ValueType>>` is modeled, where
24
+ *`prop-like`* is the following exposition-only class template:
25
+
26
+ ``` cpp
27
+ template<class ValueType>
28
+ struct prop-like { // exposition only
29
+ const ValueType& query(auto) const noexcept;
30
+ };
31
+ ```
32
+
33
+ [*Example 1*:
34
+
35
+ ``` cpp
36
+ template<sender Sndr>
37
+ sender auto parameterize_work(Sndr sndr) {
38
+ // Make an environment such that get_allocator(env) returns a reference to a copy of my_alloc{}.
39
+ auto e = prop(get_allocator, my_alloc{});
40
+
41
+ // Parameterize the input sender so that it will use our custom execution environment.
42
+ return write_env(sndr, e);
43
+ }
44
+ ```
45
+
46
+ — *end example*]
47
+
48
+ Specializations of `prop` are not assignable.
49
+