Reputation: 10473
I am trying to define a specialization of a template class which contains a Non-type template Parameter member function. And I get the following error:
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 }
I believe this is more of a syntax issue than a design issue, any clues? Thanks
Upvotes: 3
Views: 726
Reputation: 96233
You forgot to tell the compiler that you're specializing a template method of a template class:
template <>
template <>
void ClassA<int>::Execute<2>()
{
//Do stuff
}
Upvotes: 4
Reputation: 44181
Even if you fully specialize a template, you still need template<>
:
template<> template<> void ClassA<int>::Execute<2>() { //Do stuff }
Upvotes: 5