std::shared_future<T>:: shared_future
From cppreference.net
<
cpp
|
thread
|
shared future
C++
Concurrency support library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::shared_future
| Member functions | ||||
|
shared_future::shared_future
|
||||
| Getting the result | ||||
| State | ||||
|
shared_future
(
)
noexcept
;
|
(1) | (自 C++11 起) |
| (2) | ||
|
shared_future
(
const
shared_future
&
other
)
;
|
(自 C++11 起)
(直至 C++17) |
|
|
shared_future
(
const
shared_future
&
other
)
noexcept
;
|
(自 C++17 起) | |
|
shared_future
(
std::
future
<
T
>
&&
other
)
noexcept
;
|
(3) | (自 C++11 起) |
|
shared_future
(
shared_future
&&
other
)
noexcept
;
|
(4) | (自 C++11 起) |
构造一个新的
shared_future
。
1)
默认构造函数。构造一个空的 shared future,它不引用任何共享状态,即
valid
(
)
==
false
。
2)
构造一个共享 future,该 future 引用与
other
相同的共享状态(如果存在)。
3,4)
将
other
持有的共享状态转移给
*
this
。构造完成后,
other.
valid
(
)
==
false
,且
this
-
>
valid
(
)
的返回值与构造前
other.
valid
(
)
的返回值相同。
参数
| 其他 | - | 用于初始化的另一个 future 对象 |