Generated by GPT-5-mini| C++20 | |
|---|---|
| Name | C++20 |
| Paradigm | Multi-paradigm: Object-oriented programming, Generic programming, Functional programming, Metaprogramming |
| Designer | Bjarne Stroustrup and WG21 |
| Developer | ISO, WG21 |
| Latest release version | 2020 |
| Typing | Static, nominal and static |
| Influenced by | C++17, C, Ada, ALGOL 68, Simula |
| Influenced | C++23, Rust, D |
| License | Standard specification |
C++20 C++20 is the 2020 revision of the C++ standard published by WG21 under ISO and IEC. It extends prior revisions such as C++17 and C++11 with new language constructs, library facilities, and formalized behaviors intended to improve expressiveness, performance, and compile-time programming. The revision process involved contributors from organizations including Microsoft, Google, LLVM Project, GCC, Intel, and academic participants from institutions such as MIT and Stanford University.
C++20 consolidated proposals from ISO meetings and study groups within WG21 to address long-standing feature requests and modern systems programming needs. Key design trade-offs balanced inputs from major maintainers like the LLVM Project and GCC steering committees with implementers at Microsoft and ARM. The standard harmonizes prior work from C++17 and experimental features introduced in Library Fundamentals Technical Specification and Reflection TS efforts, while influencing subsequent efforts such as C++23 and language explorations in Rust research.
C++20 introduces a suite of language-level features that reshape expression syntax and compile-time computation: - Concepts: Constrained templates inspired by work from Bjarne Stroustrup contributors and committees, enabling overload resolution akin to interfaces in Java and contracts discussed in Design by Contract history. Concepts formalize template requirements and interact with SFINAE patterns. - Ranges: A formal ranges framework extends iterators with views and actions influenced by research from Eric Niebler and library work at Boost. Ranges enable pipeline-style composition similar to LINQ in C#. - Coroutines: Language support for coroutines reflects prior cooperative multitasking models from Simon Peyton Jones research and runtime designs used in Microsoft Visual C++ and LLVM runtimes, facilitating asynchronous programming and generator patterns found in Python. - Modules: A module system replaces fragile textual includes, drawing from module proposals discussed at WG21 and implementation efforts by Clang and GCC. Modules improve compile-time isolation and scaling in large projects like those at Google and Microsoft. - Constexpr enhancements: Extended compile-time evaluation expands on C++11 and C++14 constexpr foundations, enabling more complex compile-time algorithms used in metaprogramming by researchers at ETH Zurich and industrial users. - Template parameter deduction and abbreviated function templates: Shorter template syntax influenced by modern generic programming patterns used in Boost and academic curricula at University of Cambridge.
The standard library grew with new components and algorithms: - Ranges library: Standardized views, adaptors, and range-based algorithms derived from Boost.Range and proposals championed by contributors like Eric Niebler; integrates with existing containers from STL implementations in libstdc++ and Microsoft STL. -
Adoption of modules and new language constructs prompted tooling evolution across compilers and build systems: - Compilers: Implementations in Clang, GCC, and Microsoft Visual C++ incorporated module front-ends and coroutine lowering strategies; ABI stability concerns echoed debates from Itanium C++ ABI custodians. - Build systems: Integration with CMake, Bazel, and Ninja required new dependency tracking to support precompiled module artifacts used by enterprises like Google and Facebook. - Debuggers and profilers: Tools such as GDB and LLDB adapted to new symbol and debug-info representations; performance analysis suites from Intel and Valgrind adjusted to coroutine stacks and inlined constexpr code. - ABI and linkage: Modules change translation-unit boundaries and potentially affect linkage; projects relying on vendor ABIs like Microsoft Visual C++ ABI and GNU C Library needed careful coordination to maintain binary compatibility.
Compiler and platform vendors rolled out staged support: - GCC: Full or near-complete support arrived in successive GCC releases, with contributors from the Free Software Foundation and Red Hat participating in implementation. - Clang/LLVM: Clang integrated many features rapidly, with module and coroutine support driven by teams at Apple and Google contributing to LLVM Project repositories. - Microsoft: MSVC implemented concepts, ranges, and coroutines in line with Microsoft Visual Studio releases, used in enterprise deployments at Microsoft and partners. - Third-party toolchains: Projects like Intel C++ Compiler and embedded toolchains from ARM vendors updated to support key features for high-performance computing and embedded systems.
C++20 received praise for modernizing the language and enabling safer, more expressive code in systems at organizations such as Google, Facebook, and Microsoft. Some critics noted migration costs for legacy codebases and the learning curve for features like modules and concepts; these concerns echoed historical debates during adoption of C++11 and C++17. Academic and industrial adopters in high-performance computing and finance highlighted productivity gains from ranges and constexpr improvements, while tooling and ABI transitions continued to be practical hurdles for large-scale codebases.
Category:C++