面试题答案
一键面试// 函数模板,比较两个整数大小并返回较大值
template<typename T>
T maxValue(T a, T b) {
return a > b? a : b;
}
// 全特化模板,比较两个std::string的字典序大小并返回字典序较大的字符串
template<>
std::string maxValue<std::string>(std::string a, std::string b) {
return a > b? a : b;
}