作者autumn31 (路邊小草)
看板EE_DSnP
標題[問題] BST compile
時間Fri Dec 9 01:25:54 2011
make b 之後出現了這行
../../include/bst.h:81:7: error: passing ‘const BSTree<AdtTestObj>’ as ‘
this’ argument of ‘BSTreeNode<T>* BSTree<T>::findmin(BSTreeNode<T>*) [with
T = AdtTestObj]’ discards qualifiers
不太清楚compiler這行的意思是什麼
底下是我的code
BSTree:{
public:
iterator begin() const
{
iterator it;
it._node = findmin(_root);
return it;
}
private:
BSTreeNode<T>* findmin(BSTreeNode<T>* t)
{
if(t->_Lchild == 0)
return t;
else
return findmin(t->_Lchild);
}
BSTreeNode<T>* _root;
我看來看去還是看不出錯在哪裡QQ阿阿阿阿阿阿~~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.224.47.6
※ 編輯: autumn31 來自: 61.224.47.6 (12/09 01:29)
1F:推 ric2k1:BSTreeNode<T>* findmin(const BSTreeNode<T>* t) {...} 12/09 01:34
2F:→ djshen:const function可以使用非const function? 12/09 01:51
3F:→ autumn31:歐歐!!!!謝謝大鈞和老師~~~~ 12/09 01:58