我有一个带有int和模板模板参数的模板类。 现在我要专注一个成员函数:如何使用模板模板参数专门化模板类的成员
template <int I> class Default{};
template <int N = 0, template<int> class T = Default> struct Class
{
void member();
};
// member definition
template <int N, template<int> class T> inline void Class<N, T>::member() {}
// partial specialisation, yields compiler error
template <template<int> class T> inline void Class<1, T>::member() {}
谁能告诉我,如果这是可能的,什么我就上线做错了什么?
编辑:我想感谢大家的投入。由于我还需要针对某些T的专业化,因此我选择了Nawaz提出的解决方法,并专门研究整个班级,因为它只有一个成员函数和一个数据成员。