#define BOOST_THREAD_PROVIDES_FUTURE #define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION #include int main(int argc, char const *argv[]) { boost::promise prom; boost::future futr = prom.get_future(); int callCount = 0; auto futr2 = futr.then(boost::launch::deferred, [&] (boost::future f) { callCount++; assert(f.valid()); assert(f.is_ready()); if (f.is_ready()) { assert(17 == f.get()); } }); assert(futr2.valid()); assert(!futr2.is_ready()); assert(0 == callCount); prom.set_value(17); assert(1 == callCount); futr2.get(); assert(1 == callCount); futr2.get(); assert(1 == callCount); /* code */ return 0; }