r/cpp • u/pavel_v • Apr 16 '26
C++26: Structured bindings in conditions
https://www.sandordargo.com/blog/2026/04/15/cpp26-structured-bindings-condition
60
Upvotes
r/cpp • u/pavel_v • Apr 16 '26
View all comments
35
u/jedwardsol const & Apr 16 '26
That ordering (call foo, see if the temporary is true, then do the binding) is non-intuitive.
I prefer
which works since C++17 (https://godbolt.org/z/41ozW3PM3)