我有一個「從這裏瞬間」的問題。從這裏實例化
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
請重新格式化您的問題。 – 2011-04-14 03:00:22
根 - 您可以通過縮進4個空格來格式化代碼。最簡單的方法是突出顯示您的代碼部分,然後單擊編輯器中的「{}」按鈕。 – 2011-04-14 03:04:19
實際的錯誤信息可能就是編譯器輸出中'從此處'實例化後的行* * – phooji 2011-04-14 03:07:06