Code:
template
struct A {
void f1() {};
void f2() {};
};
template<>
struct A {
void f2() {};
};
int main() {
A<
Consider moving common parts to a base class:
template
struct ABase
{
void f1();
};
template
struct A : ABase
{
void f2();
}
template <>
struct A : ABase
{
void f2();
};
You can even override f1
in the derived class. If you want to do something more fancy (including being able to call f2
from f1
code in the base class), look at the CRTP.