Difference between template name and template id

后端 未结 3 552
暖寄归人
暖寄归人 2020-12-09 12:49

C++ Standard

Section 14/2 :

In a function template declaration, the declarator-id shall be a template-name (i.e.,

3条回答
  •  死守一世寂寞
    2020-12-09 13:22

    The template-name is the name of the template. In your example, templatefunction is a template-name.

    The template-id is the name of the template with the template arguments list. In your example, templatefunction is the template-id. A template-id names a template specialization.

    A type-id names a type. A template-id is a type-id; a template-name is not (because it does not name a type; it names a template).

    The text you cite from 14/2 concerns a template-declaration, which declares a primary template. Your example is not a template-declaration, it is an explicit-specialization (14.7.3/1).

提交回复
热议问题