I want to use the GNU Scientific Library and need to cast std::function
to the gsl_function, which is of type double (* function) (double x, void * params)
.
Until now I simply tried:
class Numerics {
public:
....
double integrate(function<double(double)> &func) {
double result, error;
gsl_function F;
F.function = static_cast<(*)(double, void *)>( func );
gsl_integration_qag(&F, 0, 1, epsabs_, epsrel_, 1000, 6, w_, &result, &error);
return result;
}
...
};
, which hands me back the error
type name requires a specifier or qualifier