in , ,

C++20 is here — Biggest update in 10 years


The C++ group of the International Organization for Standardization (ISO) ratified the final version 20 of the programming language over the past weekend. It is the first time since 2011 C++11 that a new version should fundamentally change the way programming is done.

This applies in particular to the new core features modules, coroutines, ranges, and concepts.

C++20 adds more new major features than C++14 or C++17.

C++20 brings four new core features

Two of the most important features coming to C++20 are ‘modules‘ and ‘coroutines.’

Modules replace the previous header files and ensure faster compilation times because they make the previous repeated replacement unnecessary. Developers can now isolate preprocessor macros, which means that the order in which header files are included is irrelevant. In the future, the logical structure of the code will be designated by modules, which can be combined into module packages and used. Tricks that were previously required are no longer necessary.

With Coroutines, C++20 improves the possibilities of asynchronous programming. C++ itself does not offer any ready-made coroutines. Instead, the language itself is a kind of framework for creating coroutines. It also provides more than twenty functions. 

Coroutines are designed to function generalizations. You can pause and resume execution. This is also the most significant difference to regular functions, which always run through to the end after starting. Coroutines are primarily intended for the more elegant implementation of cooperative multitasking or event loops, so they are designed to simplify event-controlled applications in particular.

The other two features, ‘concepts’ and ‘ranges‘, deal with templating in C++.

Concepts are intended to simplify and expand both the definition and the use of templates. With the ranges library, the standard template library algorithms can then be applied directly to their containers and linked via a pipe.

With the resolution of the ISO working group that has now been brought about, the new version’s technical approval is considered granted. Herb Sutter, a Microsoft engineer, and committee chairman, expects C++20 to be formally released by the end of the year.