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
Show parent comment
1
u/jedwardsol const & Apr 17 '26
It is different in the general case where temp isn't a reference.
Unless I am missing something (which is possible since C++ has lots of weird corners) this new syntax is introducing the idea of the right hand side of an expression being its "value".
With assignment, and initialisation in an old-style if, it it the lhs that is queried (https://godbolt.org/z/dPjj84ser)