On Fri, 01 Jun 2012 10:09:49 -0400, d coder <[email protected]> wrote:

Hello Steve


There is a way, as I hinted :)

I'll show you how, but be prepared to deal with ugliness!


All this smart code would be hidden from the end-users so I really do not
care.


typeof(&F.init.foo) dg; // alternately: void delegate() dg;
dg.funcptr = &F.foo;    // use the type, not the instance, to get the
function pointer itself instead of a delegate
dg.ptr = cast(void *)f; // set f is the context pointer

dg(); // now should call f.foo

Let me understand this. Is F here an alias for foo? If so why I need to
mention stuff like &F.foo?

Sorry! I meant Foo, not F. F should be replaced with whatever the class type is.

-Steve

Reply via email to