c++ - Unrecognizable template declaration/definition -


i'm trying implement heap, i've got above error on 1 of functions.

here's header file:

template <typename e> class heap { private:     class node {         e data;         node * left;         node * right;     };      node root;     int length;      e * preorder(e * list, int length, node node);     e * inorder(e * list, int length, node node);     e * postorder(e * list, int length, node node);     void clear(node node);  //recursively clears nodes , frees pointers public:     heap();     heap(e * list, int length);     ~heap();      node * getroot();     void buildheap(e * list, int length);     e * returnlist(); }; 

and specific function in question (although there's similar errors on others). there error on second line

template <typename e> node<e> * heap<e>::getroot() {     return &root; } 

the compiler complaining node<e>; there no template named node in global scope. code has it's member template:

template <typename e> typename heap<e>::node * heap<e>::getroot() {     return &root; } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -