r/cpp • • 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

40 comments sorted by

View all comments

Show parent comment

1

u/Ateist Apr 25 '26

How is the "bad" effect here any different from just writing:

VERY different.

you won't notice if the return type of f changes

'x' exists not on its own but is processed later on.
So your call

g(x);  

is going to result in a compile error if the signature of the return type changes substantially.

In my example above this is not the case, because you are putting the value of z1 into y1 (let's assume they are the same type)