I have read What does template's implicit specialization mean? and its answers, but I am still not satisfied that I understand this part of Partial template specialization from cppreference.com:
If the primary member template is explicitly (fully) specialized for a given (implicit) specialization of the enclosing class template, the partial specializations of the member template are ignored for this specialization of the enclosing class template....
template<class T> struct A { //enclosing class template template<class T2> struct B {}; //primary member template template<class T2> struct B<T2*> {}; // partial specialization of member template }; template<> template<class T2> struct A<short>::B {}; // full specialization of primary member template // (will ignore the partial) A<char>::B<int*> abcip; // uses partial specialization T2=int A<short>::B<int*> absip; // uses full specialization of the primary (ignores partial) A<char>::B<int> abci; // uses primary
Questions:
The comments say that the line
template<> template<classT2> struct A<short>::B {};
is a "full specialization of primary member template". The primary member template is identified in the comments as the structureB
. How can the line be a specialization ofB
when it isA
that is being specialized by the substitution ofshort
forclass T
?How can the line be a "full" specialization of
B
when the template parameterT2
is left unspecified?The comments and the accompanying text indicate that "explicit specialization" and "full specialization" are synonymous terms. If the line of code quoted above is the explicit specialization of
B
, where is the implicit specialization ofA
?