Pointer to function, issue with classes

I’m using a pointer to a function (int parameter) as follows:

	void (*invokeInt)(int) = NULL;

but it only works if my functions are outside any classes (ofApp, ofxDmtrUI3)
I’ve tried both forms

	getElement("allPresets")->invokeInt = &ofxDmtrUI3::loadPresetAll;

and it returns this error:

Assigning to 'void (*)(int)' from incompatible type 'void (ofxDmtrUI3::*)(int)'

which is the correct way of declaring and assigning this kind of pointer?
Thank you!

it’s easier to use std function like:

std::function<void(int)> invokeInt;

then to pass a member function:

ofxDmtr instance;
invokeInt = std::bind(&ofxDmtr::loadPresetAll, &instance);
1 Like

Danke Schon @arturo