【发布时间】:2010-09-26 02:27:00
【问题描述】:
我有一堂课Helper:
template <typename T, template <typename> E>
class Helper {
...
};
我有另一个类模板Exposure,它继承自Helper,同时将自身作为模板模板参数E 传递。我还需要专攻Exposure。因此,我想写如下内容:
template <>
class Exposure<int> : public Helper<int, Exposure> {
Exposure() : Helper<int, Exposure>() {
...
};
...
};
不幸的是,这不会编译。 gcc 抱怨:
Exposure.h:170: 错误:“模板 > 类 ExposureHelper”的模板参数列表中参数 2 的类型/值不匹配
Exposure.h:170: 错误:期望一个''类型的常量,得到'Exposure'
我做错了吗?我正在尝试做的事情有解决方法吗?
【问题讨论】:
标签: c++ templates template-specialization