Foo.h
template<typename A, typename B>
class Foo{
public:
Foo();
/*..*/
};
Foo.cpp
template<typename A, typename B>
Foo<A, B>::Foo(){/*...*/}
template<typename A>
Foo<A, Beta>::Foo(){/* some specialized construction */} //<- this doesn't work.
template<>
Foo<Alpha, Beta>::Foo(){/*...*/} // <-will work, but I want partial specialization.
When I compile, the partially specialized constructor throws an error
nested name specifier 'Foo::' for declaration does not refer into a class, class template or class template partial specialization
I imagine I need to declare this partially-specialized class somewhere, but I don't want to have to keep re-declaring the same class ... ie I don't want to have to put the following in the header file:
template<typename A>
class Foo_Beta : public Foo<A, Beta>{
public:
Foo_Beta();
}
//in cpp
template<typename A>
Foo_Beta<A>() : Foo<A, Beta>() {/**specialized constructor stuff**/}
Because then I can't construct Foo() that uses the Foo_Beta constructor.
I've tried
template<typename A>
class Foo<A,Beta> : public Foo<A, Beta>{
public:
Foo();
}
but that doesn't compile either.
Essentially, what is the syntax to declare the partial specialization of a class without re-declaring all the internal functions to that class?