Note: this seems to be a repost of a problem: C++ - Overload templated class method with a partial specilization of that method
I have boiled down a
This is a very often found problem, and there is a surprisingly simple solution. I will show it in an artificial example, because it's more clearer than to use your code, and you will have to understand it to adapt it to your code
template
struct TwoTypes { };
template
struct X {
/* forwards ... */
void f() { fImpl(TwoTypes()); }
/* special overload for */
template
void fImpl(TwoTypes) {
/* ... */
}
/* generic */
template
void fImpl(TwoTypes) {
/* ... */
}
};
Explicitly specializing functions is never (almost never?) the right way. In my work as a programmer, I've never explicitly specialized a function template. Overloading and partial ordering is superior.