Build function parameters with variadic templates
问题 I have this sample code, which do what I need for a 3-parameter function : template<typename T>T GETPARAM(void) { return T(); } template<>int GETPARAM(void) { return 123; } template<>double GETPARAM(void) { return 1.2345; } template<>const char *GETPARAM(void) { return "hello"; } template<typename P1, typename P2, typename P3, typename RES> RES BuildArgs3(RES(*fn)(P1, P2, P3)) { P1 p1 = GETPARAM<P1>(); P2 p2 = GETPARAM<P2>(); P3 p3 = GETPARAM<P3>(); return fn(p1, p2, p3); } int print3(int a,