【发布时间】:2014-10-22 21:33:42
【问题描述】:
class XY{};
template<typename typeA>
class A
{
(...)
};
template<typename typeB>
class B
{
(...)
};
(...)
B<class <class XY>A> * attribute; // <- How can I do that without Syntaxerror
尝试这个 gcc 时出现以下错误:
xy.h:19: 错误:模板参数 1 无效
我怎样才能避免这种情况?
【问题讨论】:
-
正确的语法是
B<A<XY>>* attribute,如果你打算用XY实例化A,用A<XY>实例化B
标签: c++ class templates syntax type-parameter