So I have a variable argument function with different argument types; I would like to pass every argument to another function which is a C function. As an example; for a case with two arguments;
void function(int *a, double *b) needs to call
{
bindToFunc(0, a);
bindToFunc(1, b);
}
void function(int *a, double *b, float *c) needs to call
{
bindToFunc(0, a);
bindToFunc(1, b);
bindToFunc(2, c);
}
template<typename... T>
void function(T ...)
{
// has to have
//
// bindToFunc(0, T0) ....
// bindToFunc(n-1, Tn-1);
}
I tried using,
template <int I, class... Ts>
decltype(auto) get(Ts &&... ts)
{
return std::get<I>(std::forward_as_tuple(ts...));
}
but since I is the template parameter, it is a compile time variable and hence we can not use it in with a for loop.