I'm making a code that uses a Function pointer. The problem is, when I try to compile appears an error like: error: no matching function for call to 'rnVector::rnVector()'
Here's part of the code:
1 2 3
phiFunction::phiFunction(double (*f)(rnVector), rnVector (*df)(rnVector)) {
//... Here comes the code stuff...
}
I've read somewhere that there's a way of doing this work.
class phiFunction {
private:
rnVector x, d;
double (*f)(rnVector);
rnVector (*df)(rnVector);
public:
/**
* Para construir um objeto phiFunction é necessário passar o ponteiro para uma função e sua derivada.
*/
phiFunction(double (*)(rnVector), rnVector (*)(rnVector));
/**
* Estabelece as constantes para a função phi. (x,d).
*/
void setConst(rnVector, rnVector);
/**
* Estabelece a função interna de phi(a)=f(x+a*d).
*/
void setFunc(double (*)(rnVector v), rnVector (*)(rnVector v));
/**
* Retorna o valor da função phi no ponto a.
*/
double getFuncValue(double);
/**
* Retorna o valor da derivada no ponto a.
*/
double getDiffValue(double);
/**
* Retorna a dimensão dos vetores x e d.
*/
int getDim();
};
This is almost all the code. And the error is:
1 2 3
..\PhiFunction.cpp:3: error: no matching function for call to 'rnVector::rnVector()'
..\pnl.hpp:18: note: candidates are: rnVector::rnVector(int, double*)
..\pnl.hpp:9: note: rnVector::rnVector(const rnVector&)