C++ 没有用于调用的匹配函数
我有一个C++ 没有用于调用的匹配函数,c++,class,pointers,member,C++,Class,Pointers,Member,我有一个.h文件,其中包含 template <typename DataType> class BST { private: struct BinaryNode { //variables } public: BinaryNode *root; int contains(const DataType &x, BinaryNode *&t) const; } 的实现包含 template <typen
.h
文件,其中包含
template <typename DataType>
class BST
{
private:
struct BinaryNode
{
//variables
}
public:
BinaryNode *root;
int contains(const DataType &x, BinaryNode *&t) const;
}
的实现包含
template <typename DataType>int BST<DataType>::contains(const DataType &x, BST<DataType>::BinaryNode *&t) const
{
//some stuff
}
模板int BST::contains(const数据类型&x,BST::BinaryNode*&t)const
{
//一些东西
}
我有一个问题,它说:没有匹配的函数调用BST::contains(SequenceMap*const,BST::BinaryNode*&)
在theMap.contains(this,theMap.root)
我不确定这其中的哪一部分是错误的,因为
this
是Datatype
SequenceMap
的变量,而theMap.root
是BinaryNode
。我已尝试将其更改为*map.root
,但没有帮助。该函数通过引用而不是指针调用x。您可能想要:
theMap.contains(*this, theMap.root);
该函数通过引用而不是指针调用x。您可能想要:
theMap.contains(*this, theMap.root);
该函数通过引用而不是指针调用x。您可能想要:
theMap.contains(*this, theMap.root);
该函数通过引用而不是指针调用x。您可能想要:
theMap.contains(*this, theMap.root);
BST
您的BST
模板声明在哪里??您是否确实缺少模板类BST{/…
@πάνταῥεῖ 实际上,jaba10只是添加了代码高亮显示和大写。我是在BST上面添加模板声明的人,如第2版所示。在公共方法接口中使用私有类型不是很好……好吧,那么你澄清得很好。BST
你在哪里为BST
添加模板声明?你是真的吗几乎缺少模板
类BST{/…
@πάνταῥεῖ 实际上,jaba10只是添加了代码高亮显示和大写。我是在BST上面添加模板声明的人,如第2版所示。在公共方法接口中使用私有类型不是很好……好吧,那么你澄清得很好。BST
你在哪里为BST
添加模板声明?你是真的吗几乎缺少模板
类BST{/…
@πάνταῥεῖ 实际上,jaba10只是添加了代码高亮显示和大写。我是在BST上面添加模板声明的人,如第2版所示。在公共方法接口中使用私有类型不是很好……好吧,那么你澄清得很好。BST
你在哪里为BST
添加模板声明?你是真的吗几乎缺少模板
类BST{/…
@πάνταῥεῖ 实际上,jaba10只是添加了代码高亮显示和大写的内容。我是在BST上面添加模板声明的人,如修订版2所示。在公共方法接口中使用私有类型不是很好……好吧,那么你很好地澄清了这一点。