Why the template with default template arguments can't be used as template with less template argument in Template Template Parameters

后端 未结 1 1753
天命终不由人
天命终不由人 2020-12-31 12:10

myTemplateTemplate expects the second template parameter is a template with one argument. myDefaultTemplate is a template with two arguments, and the second argument has def

相关标签:
1条回答
  • 2020-12-31 12:50

    From the standard (see 14.3.3 paragraph 1 - [temp.arg.template):

    A template-argument for a template template-parameter shall be the name of a class template, expressed as id-expression. Only primary class templates are considered when matching the template template argument with the corresponding parameter; partial specializations are not considered even if their parameter lists match that of the template template parameter.

    That means the template myDefaultTemplate will be seen only as 2 arguments template. The default argument will not be considered.

    0 讨论(0)
提交回复
热议问题