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

Reply via email to