c++ - 最简单的template-template为什么编译不出来?

标签 c++ templates c++11 compiler-errors template-templates

以下代码不能用VC++ 2013 CTP编译。

template <template <class> A, class B>
void f(A<B>)
{}

输出结果如下:

error C2988: unrecognizable template declaration/definition
error C2059: syntax error : '<L_TEMPLATEDECL>'
error C2065: 'A' : undeclared identifier
error C2065: 'B' : undeclared identifier
error C2988: unrecognizable template declaration/definition
error C2059: syntax error : ')'

最佳答案

你是这个意思吗?

template <template <class> class A, class B>
void f(A<B>)
{}

关于c++ - 最简单的template-template为什么编译不出来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21823806/

相关文章:

c++ - 在 virtualenv 中使用 c++ 编译库

c++ - 具有两个可以采用多种不同类型的操作数的虚函数

C++ 二进制文件在 Windows XP 上不起作用

c++ - 使用 OpenGL 创建多个多边形很慢?

c++ - 组合策略类 - 模板模板参数和可变参数模板

c++ - 命名空间名称在范围内必须是唯一的。为什么?

python - django 只打印一次循环值

C++:&(std::cout) 作为模板参数

c++ - 使用 Variadic 模板的任意维数组

c++ - g++ 'stod' 未在此范围内声明