change object class
Johan
j at j.nl
Sun Sep 17 17:36:57 UTC 2023
On Sunday, 17 September 2023 at 17:10:16 UTC, evilrat wrote:
> On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
> wrote:
>> It works! But I want to ask how to make this 100% the best of
>> the best?
>> What should I consider before changing ```__vptr``` ?
>
> If that works for you with that constraint of having exact
> memory layout then it should be ok.
No, this is Undefined Behavior and will likely cause you trouble
in the future (as in: some very hard to debug bugs may appear).
Better to store the state in the object and select the behavior
using a switch on the state.
-Johan
More information about the Digitalmars-d-learn
mailing list