mercredi 20 juin 2018

C++ std::bind to std::function, what went wrong in VS2015?

I was a user of VS2013 and I often use initialization as follows and it was working like a charm. I decided to upgrade to VS2015, but it returns errors now :

  error C2440: 'initializing': cannot convert from 'std::_Binder<std::_Unforced,double (__thiscall MyClass::* )(double &),MyClass *const ,const std::_Ph<1> &>' to 'std::function<double (double)>'

This is my code

MyClass::MyClass myRoutine(){
std::function<double(double)> oFunc = std::bind(&Myclass::myfunction, this, std::placeholders::_1);
}

MyClass::MyClass myfunction(double & inX){
return 0;
}

What happened ?

Aucun commentaire:

Enregistrer un commentaire