On Tuesday, 10 July 2018 at 13:38:33 UTC, Jonathan M Davis wrote:
He thought that it was critical that the invariant be valid
when opAssign was called - and there are cases where that's
arguably true - but since it doesn't work once you try to do
fancier stuff like emplace, I'm of the opinion that invariants
are unfortunately a waste of time - even without getting into
the issue of init values.
- Jonathan M Davis
moveEmplace bypasses opAssign, since it memcopies directly.
However, it resets its source value to T.init... so if T.init
isn't valid, you simply crash whenever the source value goes out
of scope.
Using types with an invalid T.init feels like playing musical
chairs with a crash. You can shuffle things around, and make some
parts work, but *something* is always left crashing at the end.