2 ms·
I believe the standard says that move does "valid but unspecified" for standard library objects, but does not generally guarantee that moved from objects must b
by foota 7y ago
I believe the standard says that move does "valid but unspecified" for standard library objects, but does not generally guarantee that moved from objects must be valid.
- ori_b 7y agoThe destructor gets called on them. They need to be valid enough for that.
- foota 7y agoHm, technically don't think this would be required. Take for instance: auto no_destroy = new MoveNoDestroy(); MoveNoDestroy* moved_into; *moved_into = std::move(*no_destroy); Wouldn't call the destructor of the moved from MoveNoDestroy.
- 0xffff2 7y agoYes, if you leak resources, their destructors won't be called. That really has nothing at all to do with move semantics though. I think the important point is that move semantics don't alter the lifetime management of the moved-from object.