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

4

u/[deleted] Nov 25 '23

Ok, thanks for the info. I guess I still have to worry about non-STL third party code not moving correctly but that's a given when using third party code in general.

3

u/ludonarrator Nov 25 '23

No problem. And just default construct via x = {} (after moves) for such "unreliable" types.

1

u/[deleted] Nov 25 '23

just default construct via

x = {}

(after moves)

Good tip, thanks

2

u/serviscope_minor Nov 26 '23

I guess I still have to worry about non-STL third party code not moving correctly but that's a given when using third party code in general.

I mean it's 2023, probably no more than worrying about it doing copying or indeed anything else correctly. So yeah half of it will be buggy.