小编McG*_*ath的帖子

为什么模板非类型参数不能是类类型

class Example {

   // ...
};

template <typename T, Example ex>  //Error
class MyExample{

   // ...
};
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么模板非类型参数不能是类类型?

我得到的错误是

error: ‘class Example’ is not a valid type for a template constant parameter

c++ templates types

7
推荐指数
3
解决办法
5388
查看次数

标签 统计

c++ ×1

templates ×1

types ×1