-2

「ここからインスタンス化」に問題があります。

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
    }
}

私のエラーは次のとおりです。

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

2 に答える 2

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

私はそうすべきでNodeはないと思いNoeudますか?これらのタイプミスを修正すると、エラーが修正されますか?

于 2011-04-14T03:05:33.050 に答える
0

最後に、私は問題を見つけられませんでしたが、私は構築することができます...私の教えは彼が日食でgccコンパイラを備えたsamme問題を持っていると私に言います。.inlにコードを追加して保存するたびに、非常に不思議です。エラーアイコンが表示されます...。

ご協力ありがとうございました !:D

于 2011-04-16T00:29:03.207 に答える