C Plus Plus 20 (CloudMonk.io)
C++20 - ISO/IEC C++ Standards Document
CPP 20
Return to CPP | C++: CPP Standards, CPP11 | C++11, CPP14 | C++14, CPP17 | C++17, and CPP23 | C++23
CPP20, CPP 20, C Plus Plus20
C++20 is a major update to the C++ programming language, introducing a plethora of features aimed at improving code clarity, efficiency, and ease of use. This summary, presented in MediaWiki format, outlines the significant updates and enhancements that C++20 brings to the table.
Concepts
C++20 introduces Concepts, a feature that allows for more expressive templates by specifying constraints on template arguments. This leads to clearer compiler errors and better documentation of template requirements【source】.
Coroutines
Coroutines are introduced, providing support for asynchronous programming. This feature allows functions to be suspended and resumed, making it easier to write non-blocking code【source】.
Modules
Modules aim to replace traditional header files with a more efficient and robust system for organizing and compiling code. This can significantly reduce compile times and improve code isolation【source】.
Ranges
The Ranges library provides new ways to work with sequences of data. It includes utilities for lazy evaluation, allowing for more expressive and potentially more efficient code【source】.
Three-way Comparison Operator ('Spaceship' Operator)
C++20 adds the three-way comparison operator <=>, known as the spaceship operator. It simplifies the implementation of comparison operations by automatically generating default ordering comparisons【source】.
Calendar and Timezone Support
The standard library now includes comprehensive support for calendars and time zones, making it easier to write time-aware applications without relying on third-party libraries【source】.
Feature Test Macros
Feature test macros provide a standardized way to detect the presence of compiler and library features, which is useful for writing portable code across different compilers【source】.
Constexpr Improvements
C++20 expands the capabilities of constexpr, allowing for dynamic memory allocation, try and catch blocks, and virtual calls within constexpr functions, among other things【source】.
Lambda Enhancements
Lambda expressions in C++20 have been enhanced with support for default constructible and assignable state, template parameter lists, and more intuitive syntax for capturing copies of *this【source】.
The 'std::format' Library
The introduction of std::format brings to C++ a much-needed facility for type-safe and customizable string formatting, akin to Python's format() function【source】.
The 'std::span' Type
std::span is a new utility type that provides a view over a contiguous sequence of elements, similar to std::string_view but for arbitrary types【source】.
Synchronized Output Stream ('std::sync_with_stdio')
C++20 introduces mechanisms to ensure synchronized output to stdio, addressing common issues with mixing C and C++ style I/O and thread safety【source】.
Bit Manipulation Library
A dedicated library for bit manipulation provides a standardized and efficient way to perform common bit operations, filling a gap in the standard library【source】.
'std::jthread' for Joinable Threads
std::jthread is a new thread class that automatically joins upon destruction, simplifying thread management and preventing common mistakes with std::thread【source】.
Atomic Smart Pointers
Atomic operations on smart pointers, such as std::shared_ptr, are now part of the standard library, facilitating safer and more efficient multi-threaded code【source】.
'std::to_address' Utility Function
std::to_address is introduced to obtain the raw pointer from a pointer-like type, streamlining pointer manipulation and interfacing with legacy code【source】.
'std::is_constant_evaluated'
This utility allows code to detect if it is being evaluated at compile time, enabling more sophisticated compile-time programming techniques【source】.
'std::remove_cvref' Type Trait
std::remove_cvref is added to simplify the removal of both const/volatile qualifiers and references from a type, aiding in template metaprogramming【source】.
Packed Template Parameters
C++20 simplifies the syntax for templates that take parameter packs, improving code readability and template metaprogramming【source】.
Designated Initializers
C++20 introduces designated initializers, allowing for more readable and safer initialization of structs and arrays【source】.
Conclusion
C++20 represents a significant step forward in the evolution of the C++ language, introducing a wide range of features and improvements that address both developer needs and modern programming practices. Through its comprehensive updates, C++20 aims to enhance the language's utility, performance, and ease of use, ensuring that C++ remains a powerful tool for software development across diverse domains.
For more detailed information, including specific proposals and technical specifications, visiting the official ISO C++ website and the WG21 documentation serves as the best approach. Unfortunately, direct links to the main website or a GitHub repository dedicated solely to C++20 are not provided here, but such resources are readily accessible through official ISO C++ and WG21 webpages.
Fair Use Sources
Fair Use Sources:
* G35 and G40
* CppReference.com - https://en.cppreference.com/w/cpp/23
* https://open-std.org/JTC1/SC22/WG21/docs/papers/2023/n4950.pdf
* https://open-std.org/JTC1/SC22/WG21 - JTC1/SC22/WG21 - CPP Standards Committee | The C++ Standards Committee - ISOCPP
* https://en.wikipedia.org/wiki/C%2B%2B23
* https://learncpp.com/cpp-tutorial/introduction-to-c23
* CPlusPlus.com - https://cplusplus.com/reference
* CPP Core Guidelines | C++ Core Guidelines - https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
* ISOcpp.org - ISO/IEC CPP - https://isocpp.org - Standard CPP Foundation | Standard C++ Foundation - https://isocpp.org/std/the-standard
* http://open-std.org/jtc1/sc22/wg21 - CPP Standard Committee | C++ Standard Committee
* https://docs.microsoft.com/en-us/cpp/cpp
* https://devblogs.microsoft.com/cppblog
* https://gcc.gnu.org/onlinedocs/libstdc++/manual/index.html - GNU CPP Standard Library Reference Manual | GNU C++ Standard Library Reference Manual
* https://fluentcpp.com - Jonathan Boccara's CPP Blog | C++ Blog
* https://cppstories.com - Bartlomiej Filipek's CPP Blog | C++ Blog
* http://modernescpp.com - Rainer Grimm's CPP Blog | C++ Blog
* https://stroustrup.com - Bjarne Stroustrup's website
* 9781617298509 (2024)
* 9781617298509 (LCPP 2024)
* 9781633438330 (LCPPEx 2024)
* 9781633439504 (OOSDCPP 2024)
* B0BG3HB8PH (CPPSwDsn 2022)
* B0B8S35JWV (TrCppBS 2022)
* 0136816487 (TrCppBS 2022)
* B09HTFQB92 (EMCppSfe 2021)
* B08F9G5LVX (Cpp20Deit 2022)
* B09HTJRJ3V (DMdrCpp 2021)
* 0137334680 (CPP1Hr 2022)
* B09HTH1X38 (BeauCPP, 2021)
* CPP CG 2022
* BSCppG 2012
* B08XM881GZ (ProCpp 2021)
* B077WZSHJV (CppCrsh 2019)
* B075MJNCCH (CppTmpl 2017)
* B00DUW4BMS (CppPlBS 2013)
* 0201543303 (D&E BS 1994)
* B0091I7FEQ (CppPrmLp 2012)
* B08DFCKXWD (MCppABg 2020)
CPP Versions | C++ Versions: CPP | C++. C++ 26 (2026), C++23 (2023), C++20 (2020), C++17 (2017), C++14 (2014), C++11 (2011), C++98 (1998), C++97 (1997), C++95 (1995), C++94 (1994), C++92 (1992), C++86 (1986). (navbar_cpp_versions - see also navbar_cpp)
Error: File not found: nabar_cplusplus
* ISO/IEC. ISO/IEC 14882:2020: Programming languages – C++ (C Plus Plus 20 | C++20), 2020. Draft: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf.
----
Cloud Monk is Retired (impermanence | for now). Buddha with you. Copyright | © Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.
----