Say I have the following class:
template<class T>
struct A
{
static int value;
};
template<class T>
int A<T>::value = 0;
I can specialize A::value on a concrete type without problems:
struct B
{
};
template<>
int A<B>::value = 1;
I’d like to specialize A::value on a template type, I tried the following:
template<class T>
struct C
{
};
// error: template definition of non-template 'int A<C<T> >::value'
template<>
template<class T>
int A<C<T> >::value = 2;
Is there any way to do this or is it only possible to specialize A::value on non-template types?
Instead of introducing a whole explicit specialization, you could just specialize the initialization