I am receiving an error when I create a new function from another using std::bind and trying to pass it to another function.
My code looks like
#include <functional>
using namespace std;
typedef double (*t_function)(double t, double *y);
double integrate_fmax(double s, bool(*t_max)(double t, double *y), void(*fce_min)(double s, double &t_0, double *y_0), t_function fce_max, double err, t_function *f_diff, int dim){...}
get_x1_x2(double &x1, double &x2, double(*fce)(double x), double mlt){...}
double shoot_meth(double s1, double mlt, bool(*t_max)(double t, double *y), void(*fce_min)(double s, double &t_0, double *y_0), t_function fce_max, double err, t_function *f_diff, int dim){
double s2;
auto fce_x = bind(integrate_fmax, placeholders::_1, t_max, fce_min, fce_max, err, f_diff, dim);
get_x1_x2(s1, s2, fce_x, mlt);
}
I am receving error when I try pass function fce_x to get_x1_x2:
IntelliSense: no suitable conversion function from "std::_Bindconst)(double, bool ()(double t, double y), void ()(double s, double &t_0, double *y_0), t_function, double, t_function , int), std::_Ph<1> &, bool (&)(double t, double y), void (&)(double s, double &t_0, double *y_0), t_function &, double &, t_function &, int &>" to "double ()(double x)" exists
But when I tried something like double foo = fce_x(5) I get no error.
I am using Microsoft Visual Studio 2013.
P.S. Sorry for ugly functions but I am not sure where is the error and that simplifying would help.
Aucun commentaire:
Enregistrer un commentaire