我已阅读模板的隐式专业化意味着什么?及其答案,但我仍然不满意我从 cppreference.com理解部分模板专业化的这一部分:
如果主要成员模板显式(完全)专门用于封闭类模板的给定(隐式)特化,则对于封闭类模板的这种特化,成员模板的部分特化将被忽略......
Run Code Online (Sandbox Code Playgroud)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
问题:
评论说该行template<> template<classT2> …