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.
59
Upvotes
View all comments
Show parent comment
6
u/steveklabnik1 Sep 21 '26
Warning: I'm much better at Rust than C++, so there might be small mistakes here.
Here's a small example of the differences. Let's say you've got a little protocol, and you want to know the size of the messages.
Using
std::variantmight look something like this:Rust lets you write this:
There's a lot less ceremony going on here. This is largely because this feature is a language construct, built into Rust, whereas
std::variantis, in my understanding, entirely a library feature.There's a lot more going on with all of the details of both features, but it's used in Rust code quite heavily.