tmp/tmp8q0ib_x8/{from.md → to.md}
RENAMED
|
@@ -1,84 +1,10 @@
|
|
| 1 |
### Overview <a id="futures.overview">[[futures.overview]]</a>
|
| 2 |
|
| 3 |
[[futures]] describes components that a C++program can use to retrieve
|
| 4 |
in one thread the result (value or exception) from a function that has
|
| 5 |
-
run in the same thread or another thread.
|
| 6 |
-
restricted to multi-threaded programs but can be useful in
|
| 7 |
-
single-threaded programs as well.
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
broken_promise = implementation-defined,
|
| 13 |
-
future_already_retrieved = implementation-defined,
|
| 14 |
-
promise_already_satisfied = implementation-defined,
|
| 15 |
-
no_state = implementation-defined
|
| 16 |
-
};
|
| 17 |
-
|
| 18 |
-
enum class launch : unspecified{} {
|
| 19 |
-
async = unspecified{},
|
| 20 |
-
deferred = unspecified{},
|
| 21 |
-
implementation-defined
|
| 22 |
-
};
|
| 23 |
-
|
| 24 |
-
enum class future_status {
|
| 25 |
-
ready,
|
| 26 |
-
timeout,
|
| 27 |
-
deferred
|
| 28 |
-
};
|
| 29 |
-
|
| 30 |
-
template <> struct is_error_code_enum<future_errc> : public true_type { };
|
| 31 |
-
error_code make_error_code(future_errc e) noexcept;
|
| 32 |
-
error_condition make_error_condition(future_errc e) noexcept;
|
| 33 |
-
|
| 34 |
-
const error_category& future_category() noexcept;
|
| 35 |
-
|
| 36 |
-
class future_error;
|
| 37 |
-
|
| 38 |
-
template <class R> class promise;
|
| 39 |
-
template <class R> class promise<R&>;
|
| 40 |
-
template <> class promise<void>;
|
| 41 |
-
|
| 42 |
-
template <class R>
|
| 43 |
-
void swap(promise<R>& x, promise<R>& y) noexcept;
|
| 44 |
-
|
| 45 |
-
template <class R, class Alloc>
|
| 46 |
-
struct uses_allocator<promise<R>, Alloc>;
|
| 47 |
-
|
| 48 |
-
template <class R> class future;
|
| 49 |
-
template <class R> class future<R&>;
|
| 50 |
-
template <> class future<void>;
|
| 51 |
-
|
| 52 |
-
template <class R> class shared_future;
|
| 53 |
-
template <class R> class shared_future<R&>;
|
| 54 |
-
template <> class shared_future<void>;
|
| 55 |
-
|
| 56 |
-
template <class> class packaged_task; // undefined
|
| 57 |
-
template <class R, class... ArgTypes>
|
| 58 |
-
class packaged_task<R(ArgTypes...)>;
|
| 59 |
-
|
| 60 |
-
template <class R, class... ArgTypes>
|
| 61 |
-
void swap(packaged_task<R(ArgTypes...)>&, packaged_task<R(ArgTypes...)>&) noexcept;
|
| 62 |
-
|
| 63 |
-
template <class R, class Alloc>
|
| 64 |
-
struct uses_allocator<packaged_task<R>, Alloc>;
|
| 65 |
-
|
| 66 |
-
template <class F, class... Args>
|
| 67 |
-
future<result_of_t<decay_t<F>(decay_t<Args>...)>>
|
| 68 |
-
async(F&& f, Args&&... args);
|
| 69 |
-
template <class F, class... Args>
|
| 70 |
-
future<result_of_t<decay_t<F>(decay_t<Args>...)>>
|
| 71 |
-
async(launch policy, F&& f, Args&&... args);
|
| 72 |
-
}
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
The `enum` type `launch` is a bitmask type ([[bitmask.types]]) with
|
| 76 |
-
`launch::async` and `launch::deferred` denoting individual bits.
|
| 77 |
-
Implementations can provide bitmasks to specify restrictions on task
|
| 78 |
-
interaction by functions launched by `async()` applicable to a
|
| 79 |
-
corresponding subset of available launch policies. Implementations can
|
| 80 |
-
extend the behavior of the first overload of `async()` by adding their
|
| 81 |
-
extensions to the launch policy under the “as if” rule.
|
| 82 |
-
|
| 83 |
-
The enum values of `future_errc` are distinct and not zero.
|
| 84 |
|
|
|
|
| 1 |
### Overview <a id="futures.overview">[[futures.overview]]</a>
|
| 2 |
|
| 3 |
[[futures]] describes components that a C++program can use to retrieve
|
| 4 |
in one thread the result (value or exception) from a function that has
|
| 5 |
+
run in the same thread or another thread.
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
[*Note 1*: These components are not restricted to multi-threaded
|
| 8 |
+
programs but can be useful in single-threaded programs as
|
| 9 |
+
well. — *end note*]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|