Necessity of forward-declaring template functions
问题 I recently created this example code to illustrate C++11 variadic template function usage. template <typename Head, typename... Tail> void foo (Head, Tail...); template <typename... Tail> void foo (int, Tail...); void foo () {} template <typename... Tail> void foo (int x, Tail... tail) { std :: cout << "int:" << x; foo (tail...); } template <typename Head, typename... Tail> void foo (Head x, Tail... tail) { std :: cout << " ?:" << x; foo (tail...); } foo (int (123), float (123)); // Prints