I have a class template:
template <typename Argument> class Signal
{
void invoke(Argument arg) {}
};
Now I want to invoke signals without parameter (meaning void
parameter). I assume I could specialize the whole class for void
and it would compile. But there's a lot of code in the class, I don't want to duplicate it. I want to only specialize whatever neccessary. So I try adding:
// void specialization
template<>
void Signal<void>::invoke()
{
}
And get an error:
error C2244: 'Signal::invoke' : unable to match function definition to an existing declaration
Why is that?
The same code works for any type other than void
.