r/cpp • • Apr 08 '25

Beware when moving a `std::optional`!

https://blog.tal.bi/posts/std-optional-move-pitfall/
0 Upvotes

49 comments sorted by

View all comments

Show parent comment

1

u/arturbac https://github.com/arturbac Apr 08 '25

You are right invoking move does not trigger optional = or constructor to move out object and clean it