我正在尝试专门化一个函数模板,但我收到一个错误(标题),我不知道如何解决它.我猜这是由于我在模板专业化中使用的混合类型.这个想法只是在专业化中使用int作为double.非常感谢.
template <typename T> T test(T x) { return x*x; } template <> double test<int>(int x) { return test<double>(x); }
c++ templates template-specialization
c++ ×1
template-specialization ×1
templates ×1