Re: How does libsigc++ accept member functions?



Am Freitag, den 05.06.2009, 08:51 +0400 schrieb Igor Gorbounov:

> Thanks, Daniel, it was helpfull, though it seems to be impossible to 
> transfer this
> pointer to some outward object, knowing nothing about the class with 
> member function.

You need to know the function signature.  This is not different from a
call through any other function pointer.  What sigc::mem_fun() does to
make this generic is just a bit of template magic, which has nothing to
do with the pointer-to-member-function call itself.

In a nutshell, templates allow you to defer the compilation of a piece
of code to the point where the template is actually used.  Just like
macros, really.  At that point, the class and the method signature *are*
known.  That's the trick.

--Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]