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).

Parameters

none

Return value

true if the object is associated with a shared state.
false otherwise.

Data races

The shared_future object is accessed.

Exception safety

No-throw guarantee: never throws exceptions.

See also