-
#include "tensorstore/util/future.h"
-
template <typename Executor,
typename Callback,
typename... FutureValue>
Future<UnwrapFutureType<std::remove_cvref_t<
std::invoke_result_t<Callback, FutureValue&...>>>>
tensorstore::MapFutureValue(Executor&& executor,
Callback&& callback,
Future<FutureValue>... future); Returns a
Future
that resolves tocallback(future.value()...)
when all of the specifiedfuture
objects become ready with non-error results. Thecallback
is invoked using the specifiedexecutor
.If any of the
future
objects become ready with an error result, the error propagates to the returnedFuture
.Example:
Future<int> future_a = ...; Future<int> future_b = ...; Future<int> mapped_future = MapFutureValue( InlineExecutor{}, [](int a, int b) { return a + b; }, future_a, future_b);