Difference between revisions of "cpp/keyword/typename"
From cppreference.com
m (links to casts) |
D41D8CD98F (Talk | contribs) (rv. That's bogus) |
||
Line 1: | Line 1: | ||
{{cpp/keyword/title|typename}} | {{cpp/keyword/title|typename}} | ||
{{cpp/keyword/navbar}} | {{cpp/keyword/navbar}} | ||
− | |||
− | |||
===Usage=== | ===Usage=== | ||
Line 10: | Line 8: | ||
* {{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. | * {{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 19:39, 16 May 2020
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)