I have an extract method defined on an API, that is expecting an ID and a callback funcion.
extractAsync(const std::string &name, void (*callback)(int)
but i'm defining the callback function inside the class because i need access to other things inside it.
class CommandBuilder { public: //... void onExtractionChanged(int result); }
My problem is that, because it is inside the class, when i pass as argument it says invalid argument type.
argument of type "void (CommandBuilder::*)(int result)" is incompatible with parameter of type "void (*)(int)"
(I've simplified some of the code in order to explain the problem, if you have any other doubts please ask)
What i've tried:
- Lambda functions;
- Removing from the class (don't have access to other things that i need and can't pass them as argument aswell)
- Adding to the class (gives that weird error because instead of being 'void ()(int)' it becomes 'void (CommandBuilder::)(int result)' )