Update 09/07/2020: Last Saturday the draft standards ISO / IEC 14882: 2020 was approved as the last major update to the C ++ programming language. Voting on the C ++ 20 Draft International Standard (DIS) ended on Friday, and it was passed unanimously. The approval of C ++ 20 has been unanimous and is a very important update over C ++ 17. This means that C ++ 20 has now received final technical approval and has been voted on by ISO.
The update will be officially published towards the end of 2020, after a final round of ISO editorial work. Even if it happened to be released in 2021, it will still be referred to as C ++ 20, as WG21 finished its technical work in February. In summary, C ++ 20 brings Modules, Coroutines, the addition of the operator ⇔ to the standard library, Concepts and more.
As announced last February, the ISO C ++ 20 committee held its summer meeting last week in Cologne, Germany. The meeting report indicates that work is complete for C ++ 20 and a draft will be distributed before the end of the summer. During the meeting, a few additions and modifications were made to the draft C ++ 20 presented last February by the committee. The international standard C ++ 20 is scheduled to be officially published in February 2020 in Prague.
During the previous meeting in February, the ISO C ++ 20 committee added several new features to the language. Among these features are Coroutines and Modules. Modules are a new alternative to header files and provide a number of key enhancements including isolating macro effects and allowing scalable builds. This feature allows language users to set a named encapsulation limit. Coroutines are functions that can suspend and resume their execution while maintaining their state.
As a result of last week’s meeting, it was reported that a few additions and changes have been made to the C ++ 20 specification again. According to the report on Reddit, new features have been added and many changes. were also made. New additions include std :: format, the integration of the ⇔ operator into the standard language library, etc., and the constexpr containers. Herb Sutter, the C ++ 20 Standards Committee Chair, provided further explanation of these new additions:
std :: format
std :: format adds support for format strings to the C ++ standard library, including type-safe and positional parameters.
Stop Token and Joining Thread
Sutter explained that this feature introduces two new concepts. First, this is a type of thread that the destructor implicitly joins if you haven’t signed in or out yet. And second, but more importantly, this feature is a general composable undo mechanism in the standard library that all types can use. This mechanism is called stop_token.
The following constexpr containers were added in the C ++ 20 standard: constexpr INVOKE, constexpr std :: vector, and constexpr std :: string. According to Sutter, this means that a lot of ordinary C ++ code can be run at compile time, including even standard vector containers and dynamic strings.
The use of enumerations has been reviewed
According to the functionality explanation, the enumerations in question here are not classes. They are closer to namespaces with inline variables. So the familiar syntax that works for namespaces should also be applied to them, in one way or another.
The components of the C ++ 20 standard are now known. A committee draft will be released in the coming weeks and the official release of C ++ 20 is scheduled for February 2020. Here is a non-exhaustive list of notable features that are expected for C ++ 20:
- modules ;
- the Coroutines;
- adding the ⇔ operator to the standard library;
- the concepts ;
- the Ranges;
- constexpr containers;
- functionality test macros;
- std :: span;
- std :: format;
- std :: atomic_ref;
Sources : Rapport du Comité C++, Herb Sutter