- state->set_continuation(simgrid::xbt::makeTask(
- [](Promise<R> promise, std::shared_ptr<FutureState<T>> state, F continuation) {
- // ...set the new future value by running the continuation.
- Future<T> future(std::move(state));
- simgrid::xbt::fulfillPromise(promise,[&]{
- return continuation(std::move(future));
- });
- },
- std::move(promise), state, std::move(continuation)));
- return std::move(future);
+ state->set_continuation(simgrid::xbt::make_task(
+ [](Promise<R> promise, std::shared_ptr<FutureState<T>> state, F continuation) {
+ // ...set the new future value by running the continuation.
+ Future<T> future(std::move(state));
+ simgrid::xbt::fulfill_promise(promise, [&continuation, &future] { return continuation(std::move(future)); });
+ },
+ std::move(promise), state, std::move(continuation)));
+ return future;