I tried looking for the solution to my problem on C++ FAQ LITE (Sec 33),
and some more places, but could not figure out the solution.
Here's my problem:
I have defined a functor "F" as an abstract class, and then a template "T"
derived from it.
Both of these have two methods that have some format(signature) that I need
for callback functions for some other class "C".
Now I instantiate the template "T" (call it sTemp) in one of my methods of
class "C" using the class "C" itself as the class type, along with two of
its methods CM1 and CM2 with signatures as,
void C::CM1(int, double);
void C::Cm2(int , double, double);
and then I create a pointer to pointer to "F" (call it sFunct) and make it
point to the address of the above object.
(*sFunct) = &sTemp;
Now I simply try to pass the methods declared in "F" to create an object of
some other class "OC"(call it obj).
OC obj(int, &((*sFunct)->CM1),&((*sFunct)->CM2)) );
The constructor of the OC class is :
OC::OC(int, void (*)(int, double), void(*)(int, double, double) );
But the compiler simply refuses to accept these as valid call back functions
though their declarations are exactly the same as the constructor of "OC"
g++(version 3.2) says:
warning: ISO C++ forbids taking the address of a bound member function to
form a pointer to member function. Say `&F::CM1'
I realize that this is must be a pretty standard issue in C++ with pretty
I will greatly appreciate any help, pointers that may help.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]