开发者

Instantiated from here

开发者 https://www.devze.com 2023-02-25 05:35 出处:网络
I have a problem with \"instantied from here\". template <typename E> class tree { public: tree(){root=0;}

I have a problem with "instantied from here".

template <typename E>
class tree
{
public:
    tree(){root=0;}
    void addAVL( const E &data) throw(bad_alloc);
private:
    class Node
    {
    public:

        E data;             
        Noeud * left;       
        Noeud * right;      
        int high;       
        std::string adHier; 

        Noeud( const E&d ): data( d right( 0 ),left( 0 ),high(0), adHier("") { }
    };
    Node * root;
};

#include "AVL.inl"

/*----------------开发者_如何学运维---------
*in my inl
*/
template <typename E>
void tree<E>::addAVL( const E &data) throw(bad_alloc)
{
    // if the trre is empty
    if ( root == 0 )
    {
        root = new Node(data);  // HERE my error when in a cpp I call addAVL
    }
}

My error is:

../AVL.inl:98:   instantiated from ‘void AVL_Lab10::tree<E>::addAVL(const E&) [with E = int]’
../TestingAVL.cpp:30:   instantiated from here


Noeud * left;
Noeud * right;
Noeud( const E&d ): ...

I guess that should be Node not Noeud? Does it fix your errors if you correct those typos?


finaly I not found the prob, but i can build... my teach say me that he have the samme prob with gcc compilator in eclipse. It's very curious because each time i add some code in my .inl and i save. The error icon display ....

Thank you for your help ! :D

0

精彩评论

暂无评论...
验证码 换一张
取 消