Name

template keyword — Declares a template, specialization, or instantiation

Synopsis

               declaration := template-decl | explicit-instantiation | explicit-specialization
               template-decl ::= [export] template < template-parm-list > declaration
               template-parm-list ::= template-parm | template-parm-list , template-parm
               template-parm ::= type-parm | parm-decl
               type-parm ::= class [identifier] [= type-id] | typename [identifier] [= type-id] | 
    template < template-parm-list > class [identifier] [= id-expr]
template-id ::= template-name < [template-arg-list] >
typename-name ::= identifier
               template-arg-list ::= template-arg | template-arg-list , template-arg
               template-arg ::= assignment-expr | type-id | id-expr
               explicit-instantiation ::= template declaration
               explicit-specialization ::= template < > declaration
               elaborated-type-specifier := class-key [::] [nested-name ::] [template] 
    template-id | typename [::] nested-name :: [template] template-id
               simple-type-specifier := [::] nested-name :: template template-id
               postfix-expr := postfix-expr . [template] id-expr | 
    postfix-expr -> [template] id-expr
               pseudo-dtor-name := [::] nested-name :: template template-id :: ~ class-name
               nested-name := nested-name [:: template class-name]
qualified-id := [::] nested-name :: [template] unqualified-id
            

The template keyword declares a template, a specialization of a template, or an instance of a template. The declaration can be a function declaration, function definition, class declaration, or class definition.

A template ...

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.