On Sun, 29 Mar 2015 22:53:35 -0400, Paul O'Neil wrote: > I'm registering a callback with some C code. The simplified story is > here, but the actual code is on GitHub [1] at the end if you care. > > The call looks something like this. > > void register(void(*fp)(void*), void* context); > > I have a class that holds state for the callback and registers itself: > > final class Klass { > void method() > { > register(callback_function, &this); > } > } > > As of dmd 2.067, doing "&this" is deprecated. Is there an idiomatic way > to do this? > > [0] Actual code is at > https://github.com/todayman/dubik/blob/master/source/vibe/core/drivers/ rx.d#L177 > . The msg object eventually gets passed to the registration function. > > Thanks,
you still can cast `this` to void pointer: `cast(void*)this` but beware of possible `opCast` overloads for `void*` (there are no in stdlib, but...)
signature.asc
Description: PGP signature