You are right, and besides calling wait_until with time in the past (which is equivalent), there is no better way.
You can always write a small wrapper if you want a more convenient syntax:
template<typename R> bool is_ready(std::future<R> const& f) { return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; }
NB if the function is deferred, it will never return true, so it is better to check wait_for directly if you can run the deferred task synchronously after a certain time or at low system load.
Jonathan Wakely Jun 06 2018-12-06T00: 00Z
source share