问题描述
|
我有与此线程相同的BST类
BST文件
template<class T>
class BinarySearchTree
{
private:
struct tree_node
{
tree_node* left;
tree_node* right;
T data;
tree_node( const T & thedata,tree_node * l = NULL,tree_node * r = NULL )
: data( thedata ),left( l ),right( r ) { }
};
tree_node* root;
public:
//some functions
private:
struct tree_node* minFunc( tree_node** node);
};
我正在尝试从函数中返回一个指针,就像在此线程中所做的那样。
minFunc的定义在同一BST.hpp文件中
template <class T>
struct tree_node* BST<T>::minFunc(tree_node** node)
{
tree_node* current = *node;
while(current->left != NULL)
{
current = current->left;
}
return current;
}
无法找出编译错误:
错误C2143:语法错误:\'* \'之前缺少\'; \'
错误C2065:\'T \':未声明的标识符
错误C2955:\'BST \':使用类模板需要模板参数列表
错误C2509:\'minFunc \':未在\'BST \'中声明的成员函数
所有这些都指向定义
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)