-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Service Arch 2022-03-07, Service Arch 2022-03-21, Service Arch 2022-04-04, Service Arch 2022-04-18, Service Arch 2022-05-02, Service Arch 2022-05-16, Service Arch 2022-05-30
std::future has a "bool Future<T>::valid()" member function that returns true if the future refers to shared state. This is useful in determining if the Future has been moved-from, which can be helpful when a future needs to be "exchanged" or "handed-out" via an API. For an example, see PackagedTask, which needs to "hand out" a Future and then later should be able to check if the Future has already been moved-from, rather than tracking this information separately.
We should be able to do this by checking the of the Future::FutureImpl's SharedStateHolder member, but may require some more digging.