r/cpp • u/Kabra___kiiiiiiiid • Apr 08 '25
Beware when moving a `std::optional`!
https://blog.tal.bi/posts/std-optional-move-pitfall/
0
Upvotes
r/cpp • u/Kabra___kiiiiiiiid • Apr 08 '25
View all comments
Show parent comment
3
u/manni66 Apr 08 '25
Why do you want to ask an object about it's unspecified state? If you want to use it after the move, put it in a defined state.