boost::bind & boost::function pointers to overloaded or templated member functions

前端 未结 2 1453
感动是毒
感动是毒 2020-12-14 20:20

I have a callback mechanism, the classes involved are:

class App
{
    void onEvent(const MyEvent& event);
    void onEvent(const MyOtherEvent& event         


        
2条回答
  •  借酒劲吻你
    2020-12-14 20:56

    I think you need to disambiguate the address of the overloaded function. You can do this by explicitly casting the function pointer to the one with the correct parameters.

    boost::bind( static_cast(&App::OnEvent) , this, _1);
    

    Similar problem + solution on gamedev.net

提交回复
热议问题