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
61
Upvotes
r/cpp • u/pavel_v • Apr 16 '26
View all comments
Show parent comment
5
u/jedwardsol const & Apr 16 '26
Yes but it seems rather niche; introducing a new way of thinking about initialisation(*) to support an object that can be both decomposed and supports operator bool. The article mentions std::expected as being a motivation, but it can't be decomposed.
* Until this it was the left hand side that was result (https://godbolt.org/z/dPjj84ser)