This is a followup question to "unpacking" a tuple to call a matching function pointer, which asked how to provide the values from a std::tuple as arguments to a function in a generic way.  A solution given there was the following:
template<int ...>
struct seq { };
template<int N, int ...S>
struct gens : gens<N-1, N-1, S...> { };
template<int ...S>
struct gens<0, S...>
{
   typedef seq<S...> type;
};
double foo(int x, float y, double z)
{
   return x + y + z;
}
template <typename... Args>
struct save_it_for_later
{
   std::tuple<Args...> params;
   double (*func)(Args...);
   double delayed_dispatch()
   {
    return callFunc(typename gens<sizeof...(Args)>::type());
   }
   template<int ...S>
   double callFunc(seq<S...>)
   {
    return func(std::get<S>(params) ...);
   }
};
int main(void)
{
   std::tuple<int, float, double> t = std::make_tuple(1, 1.2, 5);
   save_it_for_later<int,float, double> saved = {t, foo};
   std::cout << saved.delayed_dispatch() << std::endl;
}
My question is whether there's way to make an alternate version of save_it_for_later which takes only foo as a template argument, so that we don't have to provide foo 's parameter types as a template argument (or bake its return type into save_it_for_later).  Something like
int main(void) {
   ...
   save_it_for_later2<foo> saved = {t};
   ...
}
I'd be equally fine with some sort of macro wrapping foo to extract the required types:
int main(void) {
   ...
   save_it_for_later<MACRO_USING_DECLTYPE_OR_SOMESUCH(foo)> saved = {t};
   ...
}
This concern seems orthogonal enough to the original question to warrant its own ticket.
 
     
    