我的构造函数中还有一个控件到达非void函数的结尾。 有谁知道如何解决这个问题?
template<typename T>
T bst<T>::closestValue(T value) const
{
return T();
}
template<typename T>
T bst<T>::closestValue(T value, T & closest, bst_node<T>* node) const
{
bst_node<T>* pClosest = NULL;
int minDistance = 5000;
bst_node<T>* pNode = root;
while(pNode != NULL)
{
int distance = abs(pNode->value);
if(distance < minDistance)
{
minDistance = distance;
pClosest = pNode;
}
if(distance == 0)
break;
if(pNode->value > value)
pNode = pNode->left;
else if(pNode->value < value)
pNode = pNode->right;
}
return pClosest;
}