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 {
};
};
When I instantiate list<int> x
it gives me an error:
../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>’
Type node clearly is defined. What happens here ?
Question:
Type node clearly is defined. What happens here ?
list
is not completely defined when the base class is instantiated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.