Hi,
I have a class. In this I have a member function which I want to use as a user defined function, giving it as the second parameter of the TF1 construtor:
TF1(const char* name, Double_t ()(Double_t, Double_t*) fcn, Double_t xmin = 0, Double_t xmax = 1, Int_t npar = 0)
[quote=“radbalint”]Hi,
I have a class. In this I have a member function which I want to use as a user defined function, giving it as the second parameter of the TF1 construtor:
TF1(const char* name, Double_t ()(Double_t, Double_t*) fcn, Double_t xmin = 0, Double_t xmax = 1, Int_t npar = 0)
void myclass::set_myF1(){
myF1= new TF1(“myfunc”, “myclass::myfunc”);
}
Balint[/quote]
In C++ pointer to non-static member-function and pointer to function are completely different things. So, you cannot convert
void (T::)(SomeType) into void ()(SomeType).
^ ^
pointer to member-function pointer to function
But you can use static member-function (of course, it may be bad for you, because static function cannot accsess non-static data without object expression).