When I debug a std::future<T> future
I see that visual studio shows the value as pending
, and this makes sense, the work has not started, (in most cases).
And, there are no guarenties that it will start any time soon.
After the work is complete, the 'value' changes to has_value
.
I understand that this is just a debug window, but I am currious on how I could get the same value in my code to use it.
How can I tell what the status of the future using c++17? What I am specifically after is, telling if the future has started / running / finished.
This is how I start the future, auto future = std::async(std::launch::async, ...);
I know I could use flags in my code that would tell me if it has started or not, but I am currious if there is a more standard way of doing it.