【发布时间】:2012-01-11 00:57:39
【问题描述】:
例子:
template <typename T, typename U>
struct A {
void Print() {}
};
template <>
void A<int, float>::Print() {} // Okay
template <typename T>
void A<T, char>::Print() {} // Will produce error
问题:
我知道你必须在上面的代码中定义类模板部分特化才能工作,我也从标准中知道The members of the class template partial specialization are unrelated to the members of the primary template (§ 14.5.5.3)。但是,为什么显式特化和偏特化在语法上有区别呢?
【问题讨论】:
标签: c++ templates template-specialization