From Jason Turner

[futures.task.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz1jt3yo4/{from.md → to.md} +52 -0
tmp/tmpz1jt3yo4/{from.md → to.md} RENAMED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="futures.task.general">[[futures.task.general]]</a>
2
+
3
+ The class template `packaged_task` defines a type for wrapping a
4
+ function or callable object so that the return value of the function or
5
+ callable object is stored in a future when it is invoked.
6
+
7
+ When the `packaged_task` object is invoked, its stored task is invoked
8
+ and the result (whether normal or exceptional) stored in the shared
9
+ state. Any futures that share the shared state will then be able to
10
+ access the stored result.
11
+
12
+ ``` cpp
13
+ namespace std {
14
+ template<class> class packaged_task; // not defined
15
+
16
+ template<class R, class... ArgTypes>
17
+ class packaged_task<R(ArgTypes...)> {
18
+ public:
19
+ // construction and destruction
20
+ packaged_task() noexcept;
21
+ template<class F>
22
+ explicit packaged_task(F&& f);
23
+ ~packaged_task();
24
+
25
+ // no copy
26
+ packaged_task(const packaged_task&) = delete;
27
+ packaged_task& operator=(const packaged_task&) = delete;
28
+
29
+ // move support
30
+ packaged_task(packaged_task&& rhs) noexcept;
31
+ packaged_task& operator=(packaged_task&& rhs) noexcept;
32
+ void swap(packaged_task& other) noexcept;
33
+
34
+ bool valid() const noexcept;
35
+
36
+ // result retrieval
37
+ future<R> get_future();
38
+
39
+ // execution
40
+ void operator()(ArgTypes... );
41
+ void make_ready_at_thread_exit(ArgTypes...);
42
+
43
+ void reset();
44
+ };
45
+
46
+ template<class R, class... ArgTypes>
47
+ packaged_task(R (*)(ArgTypes...)) -> packaged_task<R(ArgTypes...)>;
48
+
49
+ template<class F> packaged_task(F) -> packaged_task<see below>;
50
+ }
51
+ ```
52
+