繁体   English   中英

模板类型名实例化错误

[英]template typename instantiation error

template <typename List>
class list_base {
    typedef typename List::node node;

};


template <typename T, typename Allocator = allocator<T>>
class list: private list_base<list<T, Allocator>> {
    typedef Allocator allocator_type;

    class node {

    };
};

当我实例化list<int> x它给了我一个错误:

../src/Console.cpp: In instantiation of ‘class list_base<list<int> >’:
../src/Console.cpp:27:7:   required from ‘class list<int>’
../src/Console.cpp:36:12:   required from here
../src/Console.cpp:21:30: error: no type named ‘node’ in ‘class list<int>’

类型节点已明确定义。 这里会发生什么?

题:

类型节点已明确定义。 这里会发生什么?

实例化基类时, list尚未完全定义。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM