Skip to Main Content
C++ In a Nutshell
book

C++ In a Nutshell

by Ray Lischner
May 2003
Intermediate to advanced content levelIntermediate to advanced
808 pages
32h 24m
English
O'Reilly Media, Inc.
Content preview from C++ In a Nutshell

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ High Performance

C++ High Performance

Viktor Sehr, Björn Andrist
Optimized C++

Optimized C++

Kurt Guntheroth
Mastering C++ Programming

Mastering C++ Programming

Jeganathan Swaminathan

Publisher Resources

ISBN: 059600298XSupplemental ContentErrata Page