I have some very simple code, which looks like so:
template <typename T, const T DEFAULT>
class One
{
T *p;
};
template <typename T, const T DEFAULT>
class Two
{
One<One<T, DEFAULT>, DEFAULT> *p;
};
When I try to compile it, I get an error message:
error: 'class One' is not a valid type for a template non-type parameter
When, however, I change const T DEFAULT
to typename T2
and DEFAULT
to T2
, it starts working:
template <typename T, typename T2>
class One
{
T *p;
};
template <typename T, typename T2>
class Two
{
One<One<T, T2>, T2> *p;
};
But, it is not what I want. I need my first variant of code work, but I do not know what is wrong with that and how can I fix it.