On Friday, 29 June 2018 at 07:15:38 UTC, FeepingCreature wrote:
I'm doing a pull request to rewrite Nullable to use
moveEmplace/move to replace its internal value. I'm considering
whether it's better to let Nullable destroy its existing value,
then memcpy the new one over it (via move()), or if it already
has a value in it, if an opAssign to Nullable should assign to
the underlying type.
With that in mind: what *is* opAssign actually good for, now
that we have move/moveEmplace?
What usecase for opAssign would break if we replaced it with
destructor + copy + postblit?
You can move only exactly the same type. with opAssign you can
assign a differnt type. So opAssign should forward assignment to
the underlying type if you assign nor Nullable!T nor T.