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
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
...全文
相关推荐
WinFOF Help_Help!_helpchm_winfof_源码.rar
WinFOF Help_Help!_helpchm_winfof_源码.rar
Apache下htaccess的配置使用详解
看到群里很多前辈都在讨论.htaccess的用法,自己之前也小用过,只做了404的重定向,当然.htaccess的功能远不止这些,他还可以帮助我们做很多(比如:自定义错误页面、禁止目录被浏览、地址重定向、目录保护、改变默认首页索引、防止网站图片盗链 等)。今天我在本地localhost将apache下htaccess做了详细的整理和测试。
最好的vim使用参考手册
最好的vim使用参考手册
中文最常用600 句短语
中文最常用600 句短语.....
二十四谬误中英对照.doc
二十四谬误中英对照.doc



