Struct should be invalid after move
Sebastiaan Koppe
mail at skoppe.eu
Tue Nov 27 12:03:20 UTC 2018
On Tuesday, 27 November 2018 at 10:59:03 UTC, Alex wrote:
> There exist
>
> auto val = Handle.init;
>
> 1. How do you treat this?
I have no idea. Logically I would say that - in my case - the val
is invalid.
> 2. Why do you don't want to treat the handle after movement the
> same way?
Because the handle refers to an underlying resource, and any
access to that resource through that handle is invalid after a
move. Much like one doesn't want to call .release() twice on an
unique(T) wrapper type.
Sure, I could put in a runtime check, but then I get runtime
errors and I rather have compile time errors.
More information about the Digitalmars-d
mailing list