C++ callbacks for dummies
Published by packi on
Updated by packi on

While installing a package on my gentoo machine, a neat little signal/slot library caught my eye:

http://libsigc.sourceforge.net/

For those (I’m pretending somone reads this stuff but, can tell from the server-logs only google does) who don’t know what signal/slots are, lets put it like this: among other things, they save you from giving away your soul and do some pagan vodoo with function-pointers.

Just to scare you away:

char** (CMyClass::*pointerToMyClassType)( void* )  
         =  &CMyInstance::ReturnPPCharAndTakeVoidP

The above translates to: Pointer named pointerToMyClassType to a member-function of CMyClass which takes a void* parameter and returns a pointer to a pointer of character.
I think I’ll spare you the invocation part ;)

Acoording to their benchmarks, they’re even faster than the Qt™ implementation from TrollTech.