help!什么错误?
template<class T>
int BinaryTree<T>::Insert (const int &value, BinaryNode<T> *& temp){
if(temp==0){temp=new BinaryNode<T> (value);return 1;}
else if(value<temp->data)return Insert(value,temp->left);
else if(value>temp->data)return Insert(value,temp->right);
return 0;
}
//BinaryNode<T> * GetRoot() const{return root;}
main 函数里:
BinaryTree<int> t(1);
for(int i=0;i<4;i++)t.Insert(i,t.GetRoot());
出现错误:error C2664: 'Insert' : cannot convert parameter 2 from 'const class BinaryNode<int> *' to 'class BinaryNode<int> *& '
A reference that is not to 'const' cannot be bound to a non-lvalue