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

Pizza in microwave oven doesn't cause the house to burn down.

Wrong variable processed can do a lot of damage in some cases.

which were difficult to express before

Sometimes difficulty is good, as it prevents abuse of things that are dangerous and harmful.
Packs are choke full of dangers:

  1. Binary Bloat & Compile-Time Explosion
  2. Recursive Instantiation Depth
  3. Hidden Performance Costs
  4. Compiler Stability and Bugs
  5. Ambiguity and Deduction Failures

so they should be reserved for the cases where you absolutely can't avoid using them.