Name

typename keyword — Introduces a type name

Synopsis

               elaborated-type-specifier := typename [::] nested-name :: identifier | 
    typename [::] nested-name :: [template] template-id
               using-decl := using [typename] [::] nested-name :: unqualified-id ;
type-parm := typename [identifier] [= id-expr]

The typename keyword is used in two different situations:

  • When referring to a qualified member of a class template, the compiler cannot tell whether the name refers to a type, object, or function. Use typename before the qualified name to tell the compiler that it names a type.

  • In a template declaration, use typename to name a type parameter. In this context, class means the same thing as typename.