Difference between revisions of "cpp/keyword/typename"
From cppreference.com
m (T. Canens moved page Template:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/typename to cpp/keyword/typename over a redirect wi...) |
D41D8CD98F (Talk | contribs) |
||
Line 5: | Line 5: | ||
* In a [[cpp/language/templates | template declaration]], {{c|typename}} can be used as an alternative to [[cpp/keyword/class | class]] to declare [[cpp/language/template_parameters#Type template parameter|type template parameters]] {{rev inl|since=c++17|and template template parameters}}. | * In a [[cpp/language/templates | template declaration]], {{c|typename}} can be used as an alternative to [[cpp/keyword/class | class]] to declare [[cpp/language/template_parameters#Type template parameter|type template parameters]] {{rev inl|since=c++17|and template template parameters}}. | ||
− | * Inside a declaration or a definition of a template, {{c|typename}} can be used to declare that a [[cpp/language/dependent_name|dependent name]] is a type. | + | * Inside a declaration or a definition of a template, {{c|typename}} can be used to declare that a [[cpp/language/dependent_name|dependent qualified name]] is a type. |
+ | * {{rev inl|until=c++11|Inside a declaration or a definition of a template,}} {{c|typename}} can be used before a non-dependent qualified type name. It has no effect in this case. | ||
* Inside a [[cpp/language/constraints | requirements]] for type requirements {{mark since c++20}} | * Inside a [[cpp/language/constraints | requirements]] for type requirements {{mark since c++20}} | ||
{{langlinks|de|es|fr|it|ja|pt|ru|zh}} | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} |
Revision as of 00:15, 21 April 2019
Usage
- In a template declaration, typename can be used as an alternative to class to declare type template parameters and template template parameters(since C++17).
- Inside a declaration or a definition of a template, typename can be used to declare that a dependent qualified name is a type.
- Inside a declaration or a definition of a template,(until C++11) typename can be used before a non-dependent qualified type name. It has no effect in this case.
- Inside a requirements for type requirements (since C++20)