template <typename Key, typename E>
class BST : public Dictionary<Key, E>
{
.....
E FindHelp(BSTNode<Key, E>*, const Key&) const;
template <typename Key>
std::string FindHelp(BSTNode<Key, std::string> *root, const Key &k) const;
....
};
template <typename Key>
std::string BST<Key, std::string>::FindHelp(BSTNode<Key, std::string> *root, const Key &k) const
{
if (root == nullptr) return "Not Found!"; // Empty tree
// If smaller than the root go left sub tree
if (k < root->key()) return FindHelp(root->Left(), k);
// If bigger than the root go right tree
if (k > root->key()) return FindHelp(root->Right(), k);
// If equal to the root return root value
else return root->Element();
}
Я хочу добавить функцию, имеющую дело с конкретным типом данных, таким как std :: string, когда я написал свое определение следующим образом
ошибка C2244: «BST :: FindHelp»: невозможно сопоставить
определение функции для существующего объявления