C++ in a Nutshell

   
typename keyword Introduces a type name

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:

Example

template< typename C> typename C::value_type checked_first(const C& c) { if (not c.empty( )) return c[0]; throw std::out_of_range("container is empty"); }

See Also

class , expression , template , type , using , Chapter 7

   

Категории