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
37
u/SuperV1234 https://romeo.training | C++ Mentoring & Consulting Apr 24 '26
I absolutely adore this feature. Thank you /u/BarryRevzin and /u/jwakely!
3
u/jundehung Apr 25 '26
I love structured bindings, so everything that makes it even better is most certainly welcome!
-2
u/droxile Apr 24 '26
Would be killer if this worked with vectors!
-14
u/Ateist Apr 24 '26 edited Apr 24 '26
Absolutely hate this, completely screws up type safety.
You want first and last values returned by function f();
Someone upstream changes definition of f():
Congratulation - you don't get ANY notification about the change.
Why on Earth would anyone want to compute dot product of two tuples more than once?
if you want "dot product" it should be done using safer data structures!