jeudi 25 décembre 2014

Binding function with argument as derived class

I am trying to bind std::function with derived argument. Function I want to bind looks like this:



void Appliation::myFunction(Derived *derived) { }


Function I am trying to pass into this function (but bound) looks like this:



void Storage::register(int number, std::function<void(Base *base)>) { }


And I am doing this: (this keyword in this context is Application)



myStorage->register(0, std::bind(&Application::myFuntion, this, std::placeholders::_1);


But that gives me error:



error: no matching function for call (Storage::register...)



Any idea what am I doing wrong? Thank you!


Aucun commentaire:

Enregistrer un commentaire