【发布时间】:2014-04-04 21:08:41
【问题描述】:
我这样声明两个类:
template<typename Data, const int m, const int n>
class Foo {};
template<typename Data, const int m>
class Foo <Data, m, 1> {};
现在,当我尝试以下操作时(几乎是 double 类,但它的行为与其他任何东西一样,因此新的部分类将是一种矫枉过正):
template <const int n>
using BarD = Foo<double, n>; // error: wrong number of template arguments (2, should be 3)
为什么会这样?有没有我没完全理解的概念?
PS:我使用 eclipse 4.3.1 M20130911-1000 并使用 g++ -O3 -g -Wall -c -std=c++11 -o obj/c++/src/test.o src/test.cpp 构建
【问题讨论】:
-
您将专业化与默认模板参数混淆了。而且您的代码中没有
Mat模板。
标签: templates c++11 compiler-errors