Appendix B. The typename and template KeywordsThe template keyword is used to introduce template declarations and definitions:
template <class T>
class vector;
The typename keyword is often used in place of class to declare template type parameters:[1]
template <typename T>
class vector;
Both keywords also have a second role in the language. This appendix is about that role, why it is needed, and exactly how to apply typename and template to fill it. Because the rules are subtle, many people wait until the compiler complains before thinking about the use of typename or template, but it's worth learning these technical details because:
|