请注释代码在我执行此已知任务时出现的问题
template <typename T>
T arithmetic_sum(T first) {
return first;
}
template<typename T, typename... Types>
auto arithmetic_sum(T first, Types ...others) ->decltype(first + arithmetic_sum(others...)) {
return first + arithmetic_sum(others...);
}
(GCC 4.9)
e.g。这个电话
auto i = arithmetic_sum(123, 123.45, 0.55l);
无法编译错误:
错误:没有匹配函数来调用&#39; arithmetic_sum(int,double,long double)&#39;
auto i = arithmetic_sum(123,123.45,0.55l); ^