Problems with member function reference

Hello,

I am doing numerical work and am using the GSL (GNU scientific library) to help me with my endeavors. I recently had some code working procedurally, and then switched over to object oriented for the purposes of code reuse. The problem is I am having trouble using a library function that was working fine before.

GSL defines a data type or class called gsl_function. It has has two members, one which is a pointer to a function and one which is a general void pointer (for the purposes of taking in parameters). The function pointer has prototype given by

double (*function) (double x, void * params).

So you define a function f that returns a double and takes in a double and a void pointer, and then you write

gsl_function F;
F.function = &f;

I got this to work in a procedural setting. Now I am trying to do this in a class. My class has a member called myODE_dydx_ which has exactly the form I described for f. Then inside another member function called func, I have

gsl_function F;
F.function = &LensSolver::myODE_dydx_;

When I put this in, I get the error:

error: cannot convert ‘double (LensSolver::*)(double, void*)’ to ‘double (*)(double, void*)’ in assignment.

However, when I leave out the "LensSolver::" I still get this error in addition to another one, which I googled and found out is related to how member functions are addressed. I don't have the faintest clue what its telling me, much less how to solve it. Any help?
This is how you make a pointer to a member function:
1
2
double (LensSolver::*func_ptr)(double, void*);
func_ptr = &LensSolver::myODE_dydx_;
Topic archived. No new replies allowed.