tmp/tmps7jxmaha/{from.md → to.md}
RENAMED
|
@@ -2,73 +2,73 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
packaged_task() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*Effects:*
|
| 8 |
no stored task.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
template <class F>
|
| 12 |
packaged_task(F&& f);
|
| 13 |
-
template <class F, class Allocator>
|
| 14 |
-
explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
| 15 |
```
|
| 16 |
|
| 17 |
-
*Requires:* *
|
| 18 |
are values of the corresponding types in `ArgTypes...`, shall be a valid
|
| 19 |
expression. Invoking a copy of `f` shall behave the same as invoking
|
| 20 |
`f`.
|
| 21 |
|
| 22 |
-
*Remarks:*
|
| 23 |
-
|
| 24 |
-
`std::packaged_task<R(ArgTypes...)>`.
|
| 25 |
|
| 26 |
-
*Effects:*
|
| 27 |
-
and initializes the object’s stored task with `std::forward<F>(f)`.
|
| 28 |
-
constructors that take an `Allocator` argument use it to allocate memory
|
| 29 |
-
needed to store the internal data structures.
|
| 30 |
|
| 31 |
-
*Throws:*
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
packaged_task(packaged_task&& rhs) noexcept;
|
| 37 |
```
|
| 38 |
|
| 39 |
-
*Effects:*
|
| 40 |
ownership of `rhs`’s shared state to `*this`, leaving `rhs` with no
|
| 41 |
shared state. Moves the stored task from `rhs` to `*this`.
|
| 42 |
|
| 43 |
-
`rhs` has no shared state.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
packaged_task& operator=(packaged_task&& rhs) noexcept;
|
| 47 |
```
|
| 48 |
|
| 49 |
*Effects:*
|
| 50 |
|
| 51 |
-
-
|
| 52 |
-
- `packaged_task(std::move(rhs)).swap(*this)`.
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
~packaged_task();
|
| 56 |
```
|
| 57 |
|
| 58 |
-
*Effects:* Abandons any shared state
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
void swap(packaged_task& other) noexcept;
|
| 62 |
```
|
| 63 |
|
| 64 |
-
*Effects:*
|
| 65 |
`other`.
|
| 66 |
|
| 67 |
-
`*this` has the same shared state and stored task (if
|
| 68 |
-
prior to the call to `swap`. `other` has the same shared
|
| 69 |
-
stored task (if any) as `*this` prior to the call to `swap`.
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
bool valid() const noexcept;
|
| 73 |
```
|
| 74 |
|
|
@@ -91,14 +91,14 @@ future<R> get_future();
|
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
void operator()(ArgTypes... args);
|
| 94 |
```
|
| 95 |
|
| 96 |
-
*Effects:* *
|
| 97 |
-
task of `*this` and `t1, t2, ..., tN` are the values in
|
| 98 |
-
the task returns normally, the return value is stored as
|
| 99 |
-
asynchronous result in the shared state of `*this`, otherwise the
|
| 100 |
exception thrown by the task is stored. The shared state of `*this` is
|
| 101 |
made ready, and any threads blocked in a function waiting for the shared
|
| 102 |
state of `*this` to become ready are unblocked.
|
| 103 |
|
| 104 |
*Throws:* a `future_error` exception object if there is no shared state
|
|
@@ -112,18 +112,18 @@ or the stored task has already been invoked.
|
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
void make_ready_at_thread_exit(ArgTypes... args);
|
| 115 |
```
|
| 116 |
|
| 117 |
-
*Effects:* *
|
| 118 |
-
task and `t1, t2, ..., tN` are the values in `args...`. If the
|
| 119 |
-
returns normally, the return value is stored as the asynchronous
|
| 120 |
-
in the shared state of `*this`, otherwise the exception thrown by
|
| 121 |
-
task is stored. In either case, this shall be done without making
|
| 122 |
-
state ready ([[futures.state]]) immediately. Schedules the shared
|
| 123 |
-
to be made ready when the current thread exits, after all objects
|
| 124 |
-
thread storage duration associated with the current thread have been
|
| 125 |
destroyed.
|
| 126 |
|
| 127 |
*Throws:* `future_error` if an error condition occurs.
|
| 128 |
|
| 129 |
*Error conditions:*
|
|
@@ -134,13 +134,15 @@ destroyed.
|
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
void reset();
|
| 137 |
```
|
| 138 |
|
| 139 |
-
*Effects:*
|
| 140 |
-
task stored in `*this`.
|
| 141 |
-
|
|
|
|
|
|
|
| 142 |
|
| 143 |
*Throws:*
|
| 144 |
|
| 145 |
- `bad_alloc` if memory for the new shared state could not be allocated.
|
| 146 |
- any exception thrown by the move constructor of the task stored in the
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
packaged_task() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
+
*Effects:* Constructs a `packaged_task` object with no shared state and
|
| 8 |
no stored task.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
template <class F>
|
| 12 |
packaged_task(F&& f);
|
|
|
|
|
|
|
| 13 |
```
|
| 14 |
|
| 15 |
+
*Requires:* *INVOKE*\<R\>(f, t1, t2, ..., tN), where `t1, t2, ..., tN`
|
| 16 |
are values of the corresponding types in `ArgTypes...`, shall be a valid
|
| 17 |
expression. Invoking a copy of `f` shall behave the same as invoking
|
| 18 |
`f`.
|
| 19 |
|
| 20 |
+
*Remarks:* This constructor shall not participate in overload resolution
|
| 21 |
+
if `decay_t<F>` is the same type as `packaged_task<R(ArgTypes...)>`.
|
|
|
|
| 22 |
|
| 23 |
+
*Effects:* Constructs a new `packaged_task` object with a shared state
|
| 24 |
+
and initializes the object’s stored task with `std::forward<F>(f)`.
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
*Throws:*
|
| 27 |
+
|
| 28 |
+
- Any exceptions thrown by the copy or move constructor of `f`.
|
| 29 |
+
- For the first version, `bad_alloc` if memory for the internal data
|
| 30 |
+
structures could not be allocated.
|
| 31 |
+
- For the second version, any exceptions thrown by
|
| 32 |
+
`allocator_traits<Allocator>::template`
|
| 33 |
+
`rebind_traits<`*`unspecified`*`>::allocate`.
|
| 34 |
|
| 35 |
``` cpp
|
| 36 |
packaged_task(packaged_task&& rhs) noexcept;
|
| 37 |
```
|
| 38 |
|
| 39 |
+
*Effects:* Constructs a new `packaged_task` object and transfers
|
| 40 |
ownership of `rhs`’s shared state to `*this`, leaving `rhs` with no
|
| 41 |
shared state. Moves the stored task from `rhs` to `*this`.
|
| 42 |
|
| 43 |
+
*Postconditions:* `rhs` has no shared state.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
packaged_task& operator=(packaged_task&& rhs) noexcept;
|
| 47 |
```
|
| 48 |
|
| 49 |
*Effects:*
|
| 50 |
|
| 51 |
+
- Releases any shared state ([[futures.state]]);
|
| 52 |
+
- calls `packaged_task(std::move(rhs)).swap(*this)`.
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
~packaged_task();
|
| 56 |
```
|
| 57 |
|
| 58 |
+
*Effects:* Abandons any shared state ([[futures.state]]).
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
void swap(packaged_task& other) noexcept;
|
| 62 |
```
|
| 63 |
|
| 64 |
+
*Effects:* Exchanges the shared states and stored tasks of `*this` and
|
| 65 |
`other`.
|
| 66 |
|
| 67 |
+
*Postconditions:* `*this` has the same shared state and stored task (if
|
| 68 |
+
any) as `other` prior to the call to `swap`. `other` has the same shared
|
| 69 |
+
state and stored task (if any) as `*this` prior to the call to `swap`.
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
bool valid() const noexcept;
|
| 73 |
```
|
| 74 |
|
|
|
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
void operator()(ArgTypes... args);
|
| 94 |
```
|
| 95 |
|
| 96 |
+
*Effects:* As if by *INVOKE*\<R\>(f, t1, t2, ..., tN), where `f` is the
|
| 97 |
+
stored task of `*this` and `t1, t2, ..., tN` are the values in
|
| 98 |
+
`args...`. If the task returns normally, the return value is stored as
|
| 99 |
+
the asynchronous result in the shared state of `*this`, otherwise the
|
| 100 |
exception thrown by the task is stored. The shared state of `*this` is
|
| 101 |
made ready, and any threads blocked in a function waiting for the shared
|
| 102 |
state of `*this` to become ready are unblocked.
|
| 103 |
|
| 104 |
*Throws:* a `future_error` exception object if there is no shared state
|
|
|
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
void make_ready_at_thread_exit(ArgTypes... args);
|
| 115 |
```
|
| 116 |
|
| 117 |
+
*Effects:* As if by *INVOKE*\<R\>(f, t1, t2, ..., tN), where `f` is the
|
| 118 |
+
stored task and `t1, t2, ..., tN` are the values in `args...`. If the
|
| 119 |
+
task returns normally, the return value is stored as the asynchronous
|
| 120 |
+
result in the shared state of `*this`, otherwise the exception thrown by
|
| 121 |
+
the task is stored. In either case, this shall be done without making
|
| 122 |
+
that state ready ([[futures.state]]) immediately. Schedules the shared
|
| 123 |
+
state to be made ready when the current thread exits, after all objects
|
| 124 |
+
of thread storage duration associated with the current thread have been
|
| 125 |
destroyed.
|
| 126 |
|
| 127 |
*Throws:* `future_error` if an error condition occurs.
|
| 128 |
|
| 129 |
*Error conditions:*
|
|
|
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
void reset();
|
| 137 |
```
|
| 138 |
|
| 139 |
+
*Effects:* As if `*this = packaged_task(std::move(f))`, where `f` is the
|
| 140 |
+
task stored in `*this`.
|
| 141 |
+
|
| 142 |
+
[*Note 1*: This constructs a new shared state for `*this`. The old
|
| 143 |
+
state is abandoned ([[futures.state]]). — *end note*]
|
| 144 |
|
| 145 |
*Throws:*
|
| 146 |
|
| 147 |
- `bad_alloc` if memory for the new shared state could not be allocated.
|
| 148 |
- any exception thrown by the move constructor of the task stored in the
|