Target groups will work.
Otherwise:
template<class...Ts>
struct get_many{
std::tuple<task<Ts>...> tasks;
template<class T0, size_t...Is>
std::tuple<T0,Ts...>
operator()(
std::task<T0> t0,
std::index_sequence<Is...>
){
return std::make_tuple(
t0.get(),
std::get<Is>(tasks).get()...
);
}
template<class T0>
std::tuple<T0,Ts...>
operator()(task<T0> t0){
return (*this)(
std::move(t0),
std::index_sequence_for<Ts...>{}
);
}
};
template<class T0, class...Ts>
task<std::tuple<T0,Ts...>> when_every(
task<T0> next, task<Ts>... later
){
return next.then( get_many<Ts...>{
std::make_tuple(std::move(later)...)
} );
}
which does not work with tasks void, but otherwise associates any set of tasks with the task of tuples.
void - . - get_safe, T task<T> void_placeholder task<void>, . a partition_args, args task<void> task<T> - . . -append ( T tuple, void).
++ 14 (index_sequence index_sequence_for), ++ 11 ( 2-4 ), .
, , , . , . .