看板 EE_DSnP 關於我們 聯絡資訊
../../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
ric2k1:begin() and end() are constant methods. They can only 05/20 17:51
ric2k1:call other constant methods. In short, your treeMin() 05/20 17:51
ric2k1:and treeMax() should also be const methods. 05/20 17:52