The goal of writing this code was to get a better understanding of partial template specialization. I'm trying to partial specialize the class Vector with three different bools.
I have an enum(for my bool) defined as:
enum MY_BOOL
{
YES,
NO,
MAYBE
};
For my primary template class I have
template<class A,MY_BOOL,class B>
class Vector{};
And the partial specialization class I have is
template<MY_BOOL b>
class Vector<A,YES,B>{};
The compiler is complaining that A
and B
are undeclared identifiers and that the partial specialized Vector
has too few arguments. Doesn't complain about 'YES' This confuses me because A
and B
were already defined in the primary template class. I shouldn't need to put them back in the parameter list of the partial specialized class because the point of that parameter list is to only have the variables that I want specialized.
A
andB
actual types in your partial specialization? Please add a minimal reproducible example. – NathanOliverA
andB
only apply totemplate<class A,MY_BOOL,class B> class Vector{};
. Intemplate<MY_BOOL b> class Vector<A,YES,B>{};
they do not exist. – NathanOliver