以下内容符合标准:
// 1 : Deduced template parameter in the normal order
template<typename T, typename T1 = typename std::conditional<std::is_fundamental<T>::value, T, int>::type>
void f(T x);
// 2 : Deduced template parameter in the inverted order
template<typename T1 = typename std::conditional<std::is_fundamental<T>::value, T, int>::type, typename T>
void f(T x);
// 3 : Deduced template parameter before a function pointer
template<typename T>
void f(T x, void(*g)(int, int, T*));
// 4 : Deduced template parameter after a function pointer
template<typename T>
void f(void(*g)(int, int, T*), T x);
// 5 : Deduced template parameter with inversed variables
template<typename T, typename T1 = typename std::conditional<std::is_fundamental<T>::value, T, int>::type>
void f(T1 x, T y);
// 6 : Inverted deduced parameter
template<typename T, typename T1>
void f(T1 x, T y);
在第 3 和第 4 种情况下,如果从变量和函数内部传递的类型不同,将选择哪种类型:函数的类型,还是变量的类型?