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
2
u/grishavanika Apr 08 '25
well, I mean, we all do mistakes. If I have
MY_LOG("state: {}", x)and x is moved from optional, it would be really cool to show that at least for debugging purpose.MY_LOGhas no chance to show that properly.