C++ 20 receives final technical approval
C++ language upgrade featuring modules and coroutines is set to be released before the end of the year
New capabilities in C++ 20 include:
- Modules, enabling programmers to use modular components.
- Concepts, used to specify template requirements and support generic programming. Concepts promise to improve code quality.
- A synchronization library, for better support of fine-grained hardware control.
- Compile-time computation improvements.
- Coroutines, which generalize subroutines for use in nonpreemptive multi-tasking. Standardized support for coroutines in the standard library is still lacking, however. This support is eyed for C++ 23.
- Ranges, which provide components to deal with ranges of elements.
- Feature test macros, a set of macros that correspond to language and library features from C++ 11 or later.
- Precalculated hash values in lookup.
- Expansion statements to enable compile-time repetition of a statement for each element of a tuple, array, class, parameter pack, or range.
- Monadic operations for
- Implicit creation of objects for low-level manipulation.
- Improved context-sensitive recognition of
moduleto aid non-compiler tools to determine build dependencies.
- New rangified algorithms.
A contracts capability that had been expected in C++ 20, to specify pre-conditions, post-conditions, and assertions, has been removed. Contracts is now marked as a C++ 23 item, although it may not make it into that release, either.