I am using boost.future<T> with continuations, in boost 1.56.
I cannot figure out how to do the following:
auto result = api_returns_future().then([](boost::future<R> && result) {
do_something_with_result();
return api_returns_future();
}).then([](boost::future<R> && result) { ... });
Namely, I have:
future<R>::then- In the first continuation, I return from the lambda with an API call that returns a
boost::future<R>. In theory, I would need to unwrap it, but I don't see such an API call available. - After that I want to attach another continuation.
Questions:
- Do I need something like unwrap? How is it possible that it is not available?
- Will automatic unwrapping be performed, in case 1. is not needed?
- It would be correct to do this in the first continuation:
return api_returns_future().get(). Or it has some drawback?
Thanks
Aucun commentaire:
Enregistrer un commentaire