In the C++ Standard in chapter 14 (Templates) it refers to template parameters with several different names, depending on their context.
non-type parameter
template<int N>
class foo {};
template parameter
template<typename T>
class bar {};
type-parameter
?????
In this quote below, it makes it seem like these are three distinct things, however I can't figure out what type-parameter is?
14.1 Template parameters [temp.param]
9 ... A default template-argument may be specified for any kind of template-parameter (type, non-type, template) that is not a template parameter pack (14.5.3). ...
You can see here that it has three distinct names for template parameters. If template-parameter was a generalization of the other two, then why include that in the list above.
In section 14.1.2 it then refers to them as just type and non-type, and the template-parameter as a generalization.
So what is it? Can someone explain?
It's saying that there are three types of template-parameter:
Type template parameter
template<typename T>
class bar {};
Non-type template parameter
template<int N>
class foo {};
Template template parameter
template<template<class> class T>
class baz {};
I do however agree that this is badly defined. In the grammar, a template-parameter that begins with template
is one of the possible productions of type-parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With