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
4
u/ts826848 Sep 21 '26
You can, but at that point you're basically implementing the decision tree by hand and that does not seem not particularly fun to me (I didn't go with
std::visits since I didn't feel like figuring out how to correctly extract bindings, but I'm sure there is technically some way to do so; feel free to show me up):Granted, OCaml's GC helps with some of the boilerplate, but even if you disregard memory management I'm sure you can see that this is not nearly as convenient and/or readable (which is why I'd imagine actual RB tree implementations in imperative languages would go with a different implementation strategy assuming you even use an RB tree in the first place).
What's more, compilers can check patterns for completeness at compile time and can even tell you what pattern(s) you're missing. For instance, if you leave off the fallback case in the OCaml function you get this message from the compiler:
Perhaps, but there's a very wide gulf between "possible" and "convenient".