std::promise<R>::promise
|
promise();
|
(1) | (C++11 起) |
|
template< class Alloc >
promise( std::allocator_arg_t, const Alloc& alloc ); |
(2) | (C++11 起) |
|
promise( promise&& other ) noexcept;
|
(3) | (C++11 起) |
|
promise( const promise& other ) = delete;
|
(4) | (C++11 起) |
构造 std::promise 对象。
1) 默认构造函数,构造一个共享状态为空的
std::promise ;3) 移动构造函数,用原属
other 的共享状态构造新的 std::promise 对象,使用移动语义。构造完毕后, other 无共享状态;4)
std::promise 不可复制。参数
| alloc | - | 分配器,用于分配共享状态; |
| other | - | 另一 std::promise 对象,作为获得共享状态的来源。 |
异常
1-2) 可能会抛出由实现定义的异常。