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 24 '26 edited Apr 24 '26

functions could change return type arbitrarily anyway.

function might but structural bindings shouldn't allow such a change to remain hidden.

I expect compiler to notify me about the change if the return value of the third party function I depend on changes substantially.

Packs as structural bindings are OK if the function returns a Pack, but the uses in the given examples are just going to cause massive amount of bugs that are very difficult to notice.

Tuples are already in grey area in regards to type safety (since variables inside them they don't have names), but this completely pushes them into red zone.

So, when will this be available in MSVC.

Don't know but if it does it goes right away into every single coding standard and helper tool as a "warning-don't use".

Does C++ standard really need more things that people should avoid?