Having template classes like this (it's simplified to get my point):
template <typename TYPE> class Wrapper
{
TYPE m_tValue;
void DoSomething();
};
template <typename TYPE> class Array
{
TYPE * m_pArray;
};
is it possible (and how?) to specialize method Wrapper<Array<TYPE>>::DoSomething()
?
I mean, I am able to specialize this method for int
type by defining:
template <> void Wrapper<int>::DoSomething(){...};
But how do I specialize this for Array
but keeping Array
not specialized?
Of course, I could write:
template <> void Wrapper<Array<int>>::DoSomething(){...};
but that's not generic at all and contradicts the advantage of templates.
I've tried something like
template <typename T> void Wrapper<Array<T>>::DoSomething(){...};
but I've got compile errors.
I wonder what is the proper way to do it? thx