how to avoid static member function when using gsl with c++
You can easily wrap member functions using the following code (which is a well known solution) class gsl_function_pp : public gsl_function { public: gsl_function_pp(std::function<double(double)> const& func) : _func(func){ function=&gsl_function_pp::invoke; params=this; } private: std::function<double(double)> _func; static double invoke(double x, void *params) { return static_cast<gsl_function_pp*>(params)->_func(x); } }; Then you can use std::bind to wrap the member function … Read more