Converting function pointers to delegates
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Apr 14 10:51:23 PDT 2014
On Monday, 14 April 2014 at 17:48:31 UTC, Adam D. Ruppe wrote:
> On Monday, 14 April 2014 at 17:45:52 UTC, Ryan Voots wrote:
>> src/yage/core/misc.d(164): Error: e2ir: cannot cast this of
>> type S to type void*
>
>
> Try taking the address of this before casting it. So more like
>
> cast(void*)&this
>
>
> IIRC in D1 this was a pointer, whereas in D2 this is a
> reference. You can't cast a reference to pointer directly.
That's not true.
And I think the issue in his diagnostic is that he used it with a
struct. You can't cast 'this' of a struct to a pointer (you'd
have to use &this), but you can cast a class reference to a
pointer.
More information about the Digitalmars-d-learn
mailing list