mercredi 25 mars 2015

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 {

};
};


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 ?


Aucun commentaire:

Enregistrer un commentaire