July 2022 ISO C++ committee virtual meeting report
On July 25, 2022, the ISO C++ committee (also known as WG21) met via Zoom for a virtual plenary session. This plenary session was remarkable for two reasons. First, this was our last virtual meeting before we finally return to meeting in-person – the next meeting is scheduled for November 2022 in Kona, Hawaii. Second, it was the last meeting for approving new features for the upcoming C++23 standard. This means that as of now, C++23 is in feature freeze.
The exciting news is that a lot of great features have made the cut! Thanks to the tireless work of the paper authors and committee subgroups, and in particular the heroic efforts of LWG (the group responsible for standard library wording review), C++23 is looking great. Here are some of the most exciting new features that have been approved in this meeting:
std::generator(P2502R2), a synchronous coroutine generator that makes working with C++20 coroutines a lot easier. Finally, we have some standard library support for this important coroutines use case, and don’t have to write generators by hand anymore (which is a lot of work, even for the simplest use case)!
std::flat_multimap(P0429R9), new associative container adaptors with an interface like that of
std::multimap, but a lot more cache-friendly, which is great for low-latency applications. The idea is similar to
boost::containers::flat_map, but the design evolved quite significantly. It is now a container adapter rather than a standalone container, and the keys and values are stored in separate containers as this was found to be more performant in certain cases.
std::flat_multiset(P1222R4), analogous to the above but for elements where the key is also the value.
std::mdspan(P0009R18), a powerful and flexible multidimensional span which will be tremendously useful for scientific computing (those who’ve ever had to write their own multidimensional dynamic array class template know what I mean). This one took a while to standardize – the first revision of this paper was published in 2015!
std::print(P2093R14) – the new output facility that integrates with C++20
std::coutobsolete. We now have a new and better way to write “Hello, World” in C++!
std::find_last(P1223R5), a new standard algorithm that does what it says on the tin.
import std(P2465R3). The standard library itself can now finally be imported as a C++20 module.
- Lots of additions to ranges, such as
std::bfloat16_t(P1467R9). Optional extended floating-point types with a defined storage width and properties defined according to ISO/IEC/IEEE 60559. They are not completely analogous to the fixed-width integer types
std::int16_t, etc. The new extended floating-point types are not allowed to be type aliases for the built-in types
long double, but are required to be independent types.
#warning(P2437R1), a preprocessor directive to issue a warning. Like
#error, except it’s a warning, not an error! It’s already been approved for the C language as well, and almost all major C++ compilers already support it.
I am also very happy that all three of my own proposals that were up for vote this time around have been approved as well:
[[assume(x)]](P1774R8). Allows the compiler to assume that the expression
xis true, without evaluating it, and optimize the code based on that assumption. It’s a portable replacement for clang’s
__builtin_assume, and a sharp knife for those who need to shave off the last nanoseconds of performance from their code. This is one of those proposals where getting the specification right turned out to be surprisingly hard. After over three years of work on this, I’m very happy it is finally done!
std::start_lifetime_as<T>(P2590R2). For certain types, this allows the user to turn a sequence of bytes into a live C++ object without calling a constructor. Previously, people did this with
reinterpret_cast, often unaware that this is undefined behavior (I gave a talk on this a few years ago).
std::start_lifetime_asgives us a way to avoid some of these situations.
- Class template argument deduction (CTAD) from inherited constructors (P2582R1). This concludes another piece of work that started over three years ago: extending CTAD. In C++20, we already added CTAD for aggregates (P1816R0, P2082R1) and CTAD for alias templates (P1814R0), and both proved very useful. But CTAD from inherited constructors didn’t make the cut back then because I did not get the wording done in time. Three years later, it’s finally here!
The feature freeze doesn’t mean that committee work on C++23 is now finished. We now have what’s called a “committee draft” (CD), but there is more work to do. The next two committee meetings will be focused on bug fixing (“ballot resolution” in ISO language). Hopefully, nothing shocking will happen during this phase. Once that’s done, there will be just a few more bureaucratic ISO hoops to jump through, and then the new C++23 standard will ship!
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.3 EAP2: Support for Device Tree Files and Meson
The CLion 2023.3 Early Access Program has just started, featuring assembly view for files, enhanced C++ data flow analysis, and other updates. The CLion 2023.3 EAP2 build is ready for you to try! With it, you can finally start working on Meson projects in CLion and benefit from device tree format s…
The CLion 2023.3 Early Access Program Is Open
We recently shared our preliminary plans for v2023.3, which we plan to release at the end of November. We are now happy to announce that the CLion 2023.3 Early Access Program (EAP) starts today! Our EAP lets the community participate in discussions devoted to our products and influence the developm…
CLion 2023.2.2 Bug-Fix Update
The CLion bug-fix update 2023.2.2 is now available! The fixes included in this bug-fix update are listed below. Download build 232.9921.42 from our website, through the Toolbox App, as a snap package for Ubuntu, or via a patch from inside the IDE. DOWNLOAD CLION This update’s main highlights includ…