gsl_function alternative for c++
gsl_function alternative for c++ I am switching from C to C++, and I would like to optimally use the additional features that become available and avoid things considered 'C-style' like void * pointers. Specifically, I am trying to make a gsl_function -like interface (NOT a wrapper to use gsl in C++). void * gsl_function In C, I wrote several routines for root-finding, integration ... that use a gsl_function -like interface to pass mathematical functions to these routines. This interface looks like this: gsl_function struct Function_struct { double (* p_func) (double x, void * p_params); void * p_params; }; typedef struct Function_struct Function; #define FN_EVAL(p_F,x) (*((p_F)->p_func))(x,(p_F)->p_params) and can be used in the following way: struct FuncParams_struct { double a; double b; double c; }; double my_sqrt(double x, void * p) { struct FuncParams_struct * p_params = (struct FuncParams_struct *) p; double a = p_params->a; double b = p_params-...
