考虑:
#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);
}
为什么编译器(g++-4.6)找不到fog
函数以及如何让它找到它?
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 ...>&)
是的,我需要积分模板参数N
。(这是一个简化的示例。)