M
Michael Olea
I came across code of the following form:
template<typename T>
class X { ... };
template<typename T, size_t N>
class X<T[N]> { ... };
I was surprised that the partial specialization has more template parameters
than does the primary template. I would not have guessed that was possible.
Now client code of the form:
template<typename T>
class Y { ... X<T>::whatever ... };
.... Y<int[2]> ...
works as expected (i.e. Y invokes the specialized version of X). Hmm...
template<typename T>
class X { ... };
template<typename T, size_t N>
class X<T[N]> { ... };
I was surprised that the partial specialization has more template parameters
than does the primary template. I would not have guessed that was possible.
Now client code of the form:
template<typename T>
class Y { ... X<T>::whatever ... };
.... Y<int[2]> ...
works as expected (i.e. Y invokes the specialized version of X). Hmm...