4 ms·
> but introduced its own puzzles about the validity of the objects after the move. In practice it's really not a puzzle. Most of the time you're using std::mov
by kllrnohj 7y ago
> but introduced its own puzzles about the validity of the objects after the move.
In practice it's really not a puzzle. Most of the time you're using std::move it's because you don't care about the object you moved from, you're about to drop it on the floor.
The other times you either manually reset it or just read the docs of the type to find out what it says the state will be after move. It's not really any different from any other method documentation on a class.
unique_ptr (or other unique_* types) are vastly worth it, which did not otherwise have a way to work prior to C++11's move semantics.
- human20190310 7y agoIt's a puzzle; observe 8 years of people (with 5 and 6 digit reputation!) debating the details in the comments: https://stackoverflow.com/questions/3413470/what-is-stdmove-and-when-should-it-be-used https://stackoverflow.com/questions/3413470/what-is-stdmove-...
- Asooka 7y agoThat's an incredibly open-ended question, so of course there's debate. I'm amazed it hasn't been locked already.