std::packaged_task<R(Args...)>:: get_future
From cppreference.net
<
cpp
|
thread
|
packaged task
C++
Concurrency support library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::packaged_task
| Member functions | ||||
| Getting the result | ||||
|
packaged_task::get_future
|
||||
| Execution | ||||
| Non-member functions | ||||
| Helper classes | ||||
|
(until C++17)
|
||||
| Deduction guides (C++17) |
|
std::
future
<
R
>
get_future
(
)
;
|
(自 C++11 起) | |
返回一个与
*
this
共享相同共享状态的
future
。
get_future
对于每个
packaged_task
只能被调用一次。
参数
(无)
返回值
一个与 * this 共享相同共享状态的future。
异常
std::future_error 在以下错误条件下触发:
-
共享状态已通过调用
get_future被获取。错误类别被设为 future_already_retrieved 。 - * this 没有共享状态。错误类别被设为 no_state 。