引用 3.3.9/1 中的一句话:
The declarative region of the name of a template parameter of a template template-parameter is the smallest template-parameter-list in which the name was introduced.
你能举个例子来理解上面的定义吗?我也想知道模板参数的模板参数列表是什么意思?示例会有所帮助。
最佳答案
template< // outer template-parameter-list
template< // inner template-parameter-list
typename q, // named parameter of a template template-parameter
q x // use that name
> // the declarative region ends here
class q // hence the name may be reused
> struct x {};
这里再次没有评论,如果这有助于跟进:
template< template< typename q, q x > class q >
struct x {};
它是一个在模板上参数化的类,它采用给定类型的常量值。例如,你可以有 x< std::integral_constant >
.
关于c++ - template-parameter-list of template parameter 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23797487/