ejlouw ejlouw - 1 year ago 101
C++ Question

C++ function thinks pointer argument is pointer reference

When compiling a library I get the following error related to the function below:

error: no matching function for call to ‘Factor::inplaceCancel(const

I don't understand why the
const Factor* rhsFPtr
is being treated as a
const Factor*&
Could anyone perhaps help me with this?

void InplaceCancelFF::inplaceProcess(FactorisedFactor* lhsPtr, const Factor* rhsFPtr){
//In the abstract Factor Class:
virtual void inplaceCancel(const Factor* rhsPtr,FactorOperator* procPtr) = 0;
//In the child class:
inline void inplaceCancel(const Factor* rhsPtr, FactorOperator* procPtr = 0);

Answer Source

The declaration in the base class has no second default parameter (procPtr). So this gets ignored in the child class declarations.

You need to provide 2 arguments to the function for this to work (or at a default to the base declaration)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download