public member function
<future>

std::shared_future::valid

bool valid() const noexcept;
Check for valid shared state
Returns whether the shared_future object is currently associated with a shared state or not.

For default-constructed shared_future objects, this function returns false (unless assigned a valid shared_future).

Shared futures obtain valid shared states either from a future or shared_future object (on construction or assigning them). Unlike future objects, they retain the same shared state association and validity until destroyed (or assigned).

参数



返回值

true if the object is associated with a shared state.
否则返回 false

数据竞争

shared_future 对象被访问。

异常安全

无异常保证: 绝不抛出异常。

另见