-
#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
Futurethat resolves tocallback(future.value()...)when all of the specifiedfutureobjects become ready with non-error results. Thecallbackis invoked using the specifiedexecutor.If any of the
futureobjects 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);