Reputation: 758
I try to call a class function from another class an I get something absolutely weird
all parameters are treated as references , and i cant see why the compiler threat this as a special case
class AbstractModulation
{
public:
virtual bool isValidMatch(
FOLTerm* toMatch,
std::set<FOLVariable>* toMatchVariables,
FOLTerm* possibleMatch,
unordered_map<FOLVariable, FOLTerm*>* substitution)=0;
...
this line:
abstractModulation->isValidMatch(toMatch, toMatchVariables,(FOLTerm*) variable,substitution)
causes this error (see the & character added to each parameter..wtf?):
AbstractModulation.cpp:105:104: error: no matching function for call to ‘AbstractModulation::isValidMatch(FOLTerm*&, std::vector<FOLVariable>*&, FOLTerm*, std::unordered_map<FOLVariable, FOLTerm*>*&)’
candidate:
AbstractModulation.h:44:7: note: bool AbstractModulation::isValidMatch(FOLTerm*, std::set<FOLVariable>*, FOLTerm*, std::unordered_map<FOLVariable, FOLTerm*>*)
and here are the objjects pointers from the calling class
class IdentifyCandidateMatchingTerm : public FOLVisitor
{
private:
FOLTerm* toMatch;
vector<FOLVariable>* toMatchVariables;
FOLTerm* matchingTerm;
unordered_map<FOLVariable, FOLTerm*>* substitution;
please help me out, this is really weird...
Upvotes: 0
Views: 48
Reputation: 29724
You have defined your function taking std::set<FOLVariable>*
variable but you try to call it with std::vector<FOLVariable>*
.
error: no matching function for call to
‘AbstractModulation::isValidMatch(FOLTerm*&, std::vector<FOLVariable>*&,
^^^^^^^^^^^
But definition is
virtual bool isValidMatch( FOLTerm* toMatch, std::set<FOLVariable>*
^^^^^^^^
This clearly explains what is going on. Double check how and where you are calling this method.
Upvotes: 3