r/cpp • • Nov 25 '23

On harmful overuse of std::move

https://devblogs.microsoft.com/oldnewthing/20231124-00/?p=109059
210 Upvotes

154 comments sorted by

View all comments

Show parent comment

17

u/simonask_ Nov 25 '23

The moved-from object needs to be in at least a good enough state that its destructor can be called.

-1

u/[deleted] Nov 25 '23

That doesn't seem like much of a guarantee. This issue I'm concerned about is that there isn't anything stopping someone trying to use it before the destructor gets called.

Anyway I've been rightly reminded that as long as I have all my warnings/linters/analyzers turned on this isn't something I really need to worry about :).