Consider:
#include<tuple>
template<int N,typename... Vs,typename... Ts>
void fog( const std::tuple<Vs...>& vs , const std::tuple<Ts...> & ts )
{
}
template<typename...Vs,typename...Ts >
int gof( const std::tuple<Vs...>& vs , const std::tuple<Ts...> & ts )
{
fog<0,Vs...,Ts...>(vs,ts);
}
int main()
{
std::tuple<int,double> t;
gof(t,t);
}
Why does the compiler (g++-4.6) not find the fog function and how to make it find it?
error: no matching function for call to ‘fog(const std::tuple<int, double>&, const std::tuple<int, double>&)’
note: candidate is:
note: template<int N, class ... Vs, class ... Ts> void fog(const std::tuple<Vs ...>&, const std::tuple<_Tail ...>&)
Yes, I need the integral template parameter N. (This is a boiled down example.)
Don’t expand the parameter packs:
Otherwise the compiler doesn’t know which template parameters belong to which tuple. This way, the tuples’ template parameters get deducted as usual.