我刚刚更新到4.8.2 GCC(4.7),我现在得到了下面的代码警告:如何定义模板的模板化子类?
template <class T_base>
class factory {
private:
template <class T>
struct allocator : factory {
//^warning: invalid use of incomplete type 'class factory<T_base>'
};
};
为了避免该警告,我试图定义factory
struct allocator
之外,但现在得到出现以下错误:
template <class T_base>
class factory {
private:
template <class T>
struct allocator;
};
template <class T_base, class T>
struct factory<T_base>::allocator<T> : factory<T_base> {
//^error: too few template-parameter-lists
};
我在做什么错?是否有上述构造的语法避免了警告和错误?
现在有道理我知道需要什么:)谢谢! – zennehoy
在这个上下文中'factory'不是_nested-type-name_(或其他)>有点烦人。< –