这个函数在二叉树类里面
/***********************
*
* 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]
对我忽略的相当简单的事情有任何想法吗?