作者lec1987 (述)
看板EE_DSnP
标题[BST]看不懂错误讯讯息
时间Tue May 20 17:10:37 2008
../../include/bst.h: In member function 「BSTree<T>::iterator
BSTree<T>::begin() const [with T = AdtTestObj]」:
adtTest.h:121: instantiated from here
../../include/bst.h:135: 错误:将 「const BSTree<AdtTestObj>」 做为 「
BSTNode<T>* BSTree<T>::treeMin(BSTNode<T>*) [with T = AdtTestObj]」 的 「this
」 引数时丢弃了类型限定
../../include/bst.h: In member function 「BSTree<T>::iterator
BSTree<T>::end() const [with T = AdtTestObj]」:
adtTest.h:122: instantiated from here
../../include/bst.h:136: 错误:将 「const BSTree<AdtTestObj>」 做为 「
BSTNode<T>* BSTree<T>::treeMax(BSTNode<T>*) [with T = AdtTestObj]」 的 「this
」 引数时丢弃了类型限定
make[1]: *** [adtTest.o] Error 1
make: *** [all] Error 2
---
啥是
"将 「const BSTree<AdtTestObj>」 做为 「BSTNode<T>* BSTree<T>::treeMax(BSTNode<T>*) [with T = AdtTestObj]」 的 「this
」 引数时丢弃了类型限定"
----
然後我的135还有136行
是begin()还有end()
然後我在begin()我return从_root算过去最小的那个
end()则相反
---
有人可以解答吗谢谢啦
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.18.228
1F:推 ric2k1:begin() and end() are constant methods. They can only 05/20 17:51
2F:→ ric2k1:call other constant methods. In short, your treeMin() 05/20 17:51
3F:→ ric2k1:and treeMax() should also be const methods. 05/20 17:52