Using class non-static member function for callback
This is a bit tricky to describe, so bear with me. I have 2 separate libraries I’m trying to mesh. One library is a numerical optimizer (right now the Nelder Mead optimizer is implemented) and the other is an sensor calibration library. The optimizer library needs the user to specify and pass a pointer to a callback function to “optimize over”. The sensor library has a generic sensor class to store calibration data for various sensors (one class for each sensor) and needs to call this optimizer and pass the callback. However, since the callback function is a non-static member of the sensor class, it throws errors like “error: invalid use of non-static member function”.
Using class non-static member function for callback
This is a bit tricky to describe, so bear with me. I have 2 separate libraries I’m trying to mesh. One library is a numerical optimizer (right now the Nelder Mead optimizer is implemented) and the other is an sensor calibration library. The optimizer library needs the user to specify and pass a pointer to a callback function to “optimize over”. The sensor library has a generic sensor class to store calibration data for various sensors (one class for each sensor) and needs to call this optimizer and pass the callback. However, since the callback function is a non-static member of the sensor class, it throws errors like “error: invalid use of non-static member function”.