r/cpp • u/adityazero • Sep 20 '26
CppCon At cppcon WG21 had a whiteboard asking attendees what they would like to have in C++29
some of the ones I remember was:
- contracts
- profiles
- delete moar stuff
I'm curious what folks here expect. Also if someone remembers rest of the list, that'd be great.
57
Upvotes
View all comments
Show parent comment
3
u/ts826848 Sep 22 '26 edited Sep 22 '26
Hrm, I'm not sure shapes will be conducive to a realistic example, but I can try.
Say you writing some kind of game where you need to chain colored shapes. Pattern matching lets you define a function to get a scoring multiplier in a fairly intuitive way:
Or to build on /u/steveklabnik1's example, maybe you are trying to extract the payload from some cursed format. Pattern matching lets you perform such extraction in a fairly declarative manner:
Sure, you can write something in C++ that achieves the same result, but I think such a solution would not be as understandable.