在此cppreference.com文章的末尾遇到麻烦

问题描述

我已经阅读了What does template's implicit specialization mean?及其答案,但仍然不满意我从cppreference.com了解Partial template specialization的这一部分:

如果主要成员模板明确地(完全)专门用于封闭类模板的给定(隐式)专业化,则成员模板的部分专门性将被忽略。 >

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

问题:

  1. 评论说template<> template<classT2> struct A<short>::B {};行是“主要成员模板的完全专业化”。主要成员模板在注释中标识为结构B。当行BA替换为short时,该行怎么能成为class T的专业化?

  2. 在未指定模板参数B的情况下,该行如何成为T2的“完全”专长?

  3. 注释和随附的文字表明“显式专业化”和“完全专业化”是同义词。如果上面引用的代码行是B的显式专业化,那么A的隐式专业化在哪里?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)