我正在尝试定义一个包含非类型模板参数成员函数的模板类的特化。我收到以下错误:
error: too few template-parameter-lists
Here's a sample class that describes the problem in brief,
// file.h
template <typename T>
class ClassA {
T Setup();
template <int K> static void Execute();
};
//file.cc
void ClassA<int>::Execute<2>() { //Do stuff }
我认为这更多是语法问题而不是设计问题,有什么线索吗?谢谢
最佳答案
即使你完全特化了一个模板,你仍然需要template<>
:
template<> template<> void ClassA<int>::Execute<2>() { //Do stuff }
关于c++ - 具有非类型模板参数成员函数的模板类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384820/