函数模板默认参数
类模板
在为多个默认模板参数声明指定默认值的时候,必须遵守“从右往左”的规则进行指定。
template<typename T1, typename T2 = int> class DefClass1;
template<typename T1 = int, typename T2> class DefClass1; // 无法通过编译
函数模板
在为多个默认模板参数声明指定默认值的时候,不必遵守“从右往左”的规则。
template<typename T1 = int, typename T2> void DefFunc1(T1 a, T2 b);
template<int i = 0, typename T> void DefFunc2(T a);