C ++ Member function as a global function parameter?

Is there a way to pass a member function as a parameter to a global function? I found this one , but actually it does not solve my problem.

Let's say that I have the following global functions:

double Function(double (*fEval)(double F1, double F2),double min, double max,int numArgs,...);

bool Function2(double (*fEval1)(double F1, double F2),double (*fEval2)(double F1, double F2),double xmin, double xmax, double ymin, double ymax,double &ax, double &ay,int numArgs,...);

and one of my member functions calls Function2 as

Function2(&F1, &F2, 0, m_m1, 0, m_m2, &m_n1, &m_n2,0);

Where F1 and F2 are member functions, and Function2 is somewhere Function1, but at the moment, my problem is with Function2 and how to declare it correctly.

Now I managed to change the function declaration to

bool Function2(double (CLASS::*)(double F1, double F2),double (CLASS::*)(double F1, double F2),double xmin, double xmax, double ymin, double ymax,double *ax, double *ay,int numArgs,...)

And I probably have only one problem that occurs when I try to call the fEval1 and fEval2 functions that have been replaced with CLASS :: *, so how can I call the first and second member functions in this function?

+3
source
2

- . , , -.

, -, , double (CLASS::*)(double, double) -

++ , -:

http://www.parashift.com/c++-faq-lite/pointers-to-members.html

+4

, , , .

, -, , -, , -. , , ( ), .

Function1 Function2 . , -, operator() .

: , , - , no-nos ++. ++, ++ 11, ( , ).

+4

All Articles