r/cpp • u/pavel_v • Apr 24 '26
C++26: Structured Bindings can introduce a Pack
https://www.sandordargo.com/blog/2026/04/22/cpp26-structured-bindings-packs
101
Upvotes
r/cpp • u/pavel_v • Apr 24 '26
View all comments
Show parent comment
7
u/arades Apr 24 '26
The binding `auto [x, ...rest, z] = f();` is literally telling the compiler "I want the first and last item of whatever f() returns and _I don't care_ about the rest". If you actually care about the structure being returned this is just the wrong tool.