這個功能是二叉樹類二叉搜索樹,錯誤的預定,不知道是什麼錯誤
/***********************
*
* give preorder of tree
*
* ********************/
void preorder(Node * node, std::ostream &p_str){
if(node != NULL){
//p_str << node->Data() << " ";
if(node->m_ll) {
preorder(node->m_ll, &p_str);
}
if(node->m_rl) {
preorder(node->m_rl, &p_str);
}
}
}
這讓來電來訪類以外的內部。遞歸遍歷樹,從根
void preorder(Node * node, std::ostream &p_str){
if(node != NULL){
//p_str << node->Data() << " ";
if(node->m_ll) {
preorder(node->m_ll, &p_str);
}
if(node->m_rl) {
preorder(node->m_rl, &p_str);
}
}
}
我得到這樣的錯誤
Tree.h:337: error: no matching function for call to 'CTree<int>::preorder(CTree<int>::Node*&, std::ostream*)'
Tree.h:330: note: candidates are: void CTree<T>::preorder(CTree<T>::Node*, std::ostream&) [with T = int]
Tree.h:343: error: no matching function for call to 'CTree<int>::preorder(CTree<int>::Node*&, std::ostream*)'
Tree.h:330: note: candidates are: void CTree<T>::preorder(CTree<T>::Node*, std::ostream&) [with T = int]
的我俯瞰的相當簡單的事情,任何想法?
是的。那工作。 D'哦 – tausch86 2013-02-16 00:50:23