Namespaces
Variants

std::shared_future<T>:: shared_future

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
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 对象