微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从此处实例化

如何解决从此处实例化

| 我有一个“从这里实例化”的问题。
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
    

解决方法

Noeud * left;
Noeud * right;
Noeud( const E&d ): ...
我猜应该是
Node
而不是
Noeud
?如果您纠正这些错别字,是否可以解决您的错误?     ,最后,我没有找到问题,但我可以建立...我的老师说他的samme问题与eclipse中的gcc编译器有关。很好奇,因为每次我在.inl中添加一些代码并保存时。错误图标显示.... 谢谢您的帮助 ! :D     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。