tmp/tmpi9q5_70k/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `task` <a id="task.class">[[task.class]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::execution {
|
| 5 |
+
template<class T, class Environment>
|
| 6 |
+
class task {
|
| 7 |
+
// [task.state]
|
| 8 |
+
template<receiver Rcvr>
|
| 9 |
+
class state; // exposition only
|
| 10 |
+
|
| 11 |
+
public:
|
| 12 |
+
using sender_concept = sender_t;
|
| 13 |
+
using completion_signatures = see below;
|
| 14 |
+
using allocator_type = see below;
|
| 15 |
+
using scheduler_type = see below;
|
| 16 |
+
using stop_source_type = see below;
|
| 17 |
+
using stop_token_type = decltype(declval<stop_source_type>().get_token());
|
| 18 |
+
using error_types = see below;
|
| 19 |
+
|
| 20 |
+
// [task.promise]
|
| 21 |
+
class promise_type;
|
| 22 |
+
|
| 23 |
+
task(task&&) noexcept;
|
| 24 |
+
~task();
|
| 25 |
+
|
| 26 |
+
template<receiver Rcvr>
|
| 27 |
+
state<Rcvr> connect(Rcvr&& rcvr);
|
| 28 |
+
|
| 29 |
+
private:
|
| 30 |
+
coroutine_handle<promise_type> handle; // exposition only
|
| 31 |
+
};
|
| 32 |
+
}
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
`task<T, E>` models `sender` [[exec.snd]] if `T` is `void`, a reference
|
| 36 |
+
type, or a cv-unqualified non-array object type and `E` is a class type.
|
| 37 |
+
Otherwise a program that instantiates the definition of `task<T, E>` is
|
| 38 |
+
ill-formed.
|
| 39 |
+
|
| 40 |
+
The nested types of `task` template specializations are determined based
|
| 41 |
+
on the `Environment` parameter:
|
| 42 |
+
|
| 43 |
+
- `allocator_type` is `Environment::allocator_type` if that
|
| 44 |
+
*qualified-id* is valid and denotes a type, `allocator<byte>`
|
| 45 |
+
otherwise.
|
| 46 |
+
- `scheduler_type` is `Environment::scheduler_type` if that
|
| 47 |
+
*qualified-id* is valid and denotes a type, `task_scheduler`
|
| 48 |
+
otherwise.
|
| 49 |
+
- `stop_source_type` is `Environment::stop_source_type` if that
|
| 50 |
+
*qualified-id* is valid and denotes a type, `inplace_stop_source`
|
| 51 |
+
otherwise.
|
| 52 |
+
- `error_types` is `Environment::error_types` if that *qualified-id* is
|
| 53 |
+
valid and denotes a type,
|
| 54 |
+
`completion_signatures<set_error_t(exception_ptr)>` otherwise.
|
| 55 |
+
|
| 56 |
+
A program is ill-formed if `error_types` is not a specialization of
|
| 57 |
+
`execution::completion_signatures` or if the template arguments of that
|
| 58 |
+
specialization contain an element which is not of the form
|
| 59 |
+
`set_error_t(E)` for some type `E`.
|
| 60 |
+
|
| 61 |
+
The type alias `completion_signatures` is a specialization of
|
| 62 |
+
`execution::completion_signatures` with the template arguments (in
|
| 63 |
+
unspecified order):
|
| 64 |
+
|
| 65 |
+
- `set_value_t()` if `T` is `void`, and `set_value_t(T)` otherwise;
|
| 66 |
+
- template arguments of the specialization of
|
| 67 |
+
`execution::completion_signatures` denoted by `error_types`; and
|
| 68 |
+
- `set_stopped_t()`.
|
| 69 |
+
|
| 70 |
+
`allocator_type` shall meet the *Cpp17Allocator* requirements.
|
| 71 |
+
|