I have two functions f
and g
. f
calculates it's return value asynchronously and returns a future. Now, based on several return values of f
, I want to call g
, but I want to make sure that the computations of the values of f
happen in parallel.
Consider the following code:
template <typename T>
std::future<T> f(T& t);
template <typename... T>
void g(T&&... t)
template <typename... T>
void call_wrapper(T&&... t) {
auto f1 = f(t1); // How do I set the values of f1... fn
auto f2 = f(t2);
...
g(f1.get(), f2.get()....); // How do I call g
}
How can I unpack the types from the variadic template T
of the call_wrapper
function?
Aucun commentaire:
Enregistrer un commentaire