by innot · 7y ago · 0 comments
As far as I remember, move constructors/assignments must leave the moved-from object in a valid state - just that the standard doesn't say anything about what that state is for standard classes.
Also, I have seen code where some kind of "result" can be moved from an object and then re-generated from scratch with different inputs. In that case it was perfectly valid to use it after move. But that's nitpicking, anyways.
auto no_destroy = new MoveNoDestroy();
MoveNoDestroy* moved_into;
*moved_into = std::move(*no_destroy);
Wouldn't call the destructor of the moved from MoveNoDestroy.The actual semantic state of the object may not make sense.