Coreect way to create delegate for struct method.
Rene Zwanenburg
renezwanenburg at gmail.com
Wed Aug 22 09:40:15 UTC 2018
On Tuesday, 21 August 2018 at 21:29:38 UTC, Andrey wrote:
> Hello,
> This is a code:
>> (...)
>> test.handler = &test.one;
That's an internal pointer, and internal pointers are not allowed
in structs precisely because of the issues you're running into:
the pointer will be invalid after a move.
You may be able to get it kind of working, but I'd recommend
looking for another solution to your problem. This is one of
those things that will come back to bite you later.
More information about the Digitalmars-d-learn
mailing list