Calling a C++ function pointer on a specific object instance

前端 未结 10 1885
傲寒
傲寒 2020-12-06 01:25

I have a function pointer defined by:

typedef void (*EventFunction)(int nEvent);

Is there a way to handle that function with a specific ins

10条回答
  •  粉色の甜心
    2020-12-06 02:28

    I highly recommend Don Clugston's excellent FastDelegate library. It provides all the things you'd expect of a real delegate and compiles down to a few ASM instructions in most cases. The accompanying article is a good read on member function pointers as well.

    http://www.codeproject.com/KB/cpp/FastDelegate.aspx

提交回复
热议问题