28 ms·
>No, even user defined classes have to be valid after a move, because their destructor will still be run. By "valid" I mean that you can use the object like no
by fluoridation 2y ago
>No, even user defined classes have to be valid after a move, because their destructor will still be run.
By "valid" I mean that you can use the object like normal; being able to destruct the object is not enough. If the destructor is unsafe to run (for example because the object ends up owning a dangling pointer) you just have an outright bug. An invalid state would be one where any further use of the object (other than destroying it) is an error.
>I'm not sure whether you're implying this is a strict requirement or just happens to be what happened in this case.
Yes, I'm saying that's what happened in that case. The string was not invalidated, it was reset.