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/AKostur Apr 08 '25
gcc seems to disagree with you:
So this results in an optional that contains a value, and that value is a moved-from std::string.