How does the template argument deduction perform for function template parameter when it is a class template with default argument
问题 template<typename T, typename U = T> struct Test{}; template<typename T> void func(Test<T>){ //#1 } int main(){ func(Test<int>{}); //#2 } Consider the above code, At the point of invocation of function template func , the type of argument is Test<int,int> , When call the function template, template argument deduction will perform. The rule of template argument deduction for function call is : temp.deduct#call-1 Template argument deduction is done by comparing each function template parameter