Difference between revisions of "cpp/keyword/typename"
From cppreference.com
m |
m |
||
Line 6: | Line 6: | ||
* 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 name]] is a type. | ||
− | * Inside a [[cpp/language/constraints]] 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 17:35, 27 October 2017
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 name is a type.
- Inside a requirements for type requirements (since C++20)