FeaturedIT topics

What’s new in C++ 20: modules, concepts, and coroutines

C++ 20, the latest version of the venerable general-purpose systems programming language, has been deemed feature-complete by the International Organization for Standardization (ISO), with capabilities including modules, concepts, and coroutines.

Both concepts and modules will simplify the use of C++ once developers learn them and get over “teething pains,” said C++ founder Bjarne Stroustrup.

Modules let programmers specify and use modular components, so C++ developers can finally move away from the complex, error-prone use of preprocessing for program composition.

Concepts let programmers specify a template’s requirements on its arguments. This fulfills the intention for templates to support generic programming by making their interfaces precise. Code quality will be improved and templates made easier to use, Stroustrup said.

Coroutines are program components that generalize subroutines for use in nonpreemptive multitasking, letting execution be suspended and resumed. Suited for tasks such as event loops and iterators, coroutines are enabled by extensions that include new syntactic forms and modifications to existing semantics in the language.

Other new features in C++ 20 include:

Related Articles

Back to top button