B.4 — Introduction to C++20

What is C++20?

In February of 2020, the ISO (International Organization for Standardization) approved a new version of C++, called C++20. C++20 contains the most changes to the language since C++11.

New improvements in C++20

For your interest, here’s a list of the major changes that C++20 adds. Note that this list is not comprehensive, but rather intended to highlight some of the key changes of interest.

  • Abbreviated function templates via auto parameters (10.17 -- Function templates with multiple template types)
  • Chrono extensions for calendar and time zone support (no tutorial yet)
  • Concepts, which allow you to put constraints on template parameters (no tutorial yet)
  • Constexpr virtual functions, unions, try, catch, dynamic_cast, and typeid (no tutorial yet)
  • Constinit keyword, to assert that a variable has static initialization (no tutorial yet)
  • Coroutines (no tutorial yet)
  • Designated initializers (13.6 -- Struct aggregate initialization)
  • Immediate functions using the consteval keyword (5.8 -- Constexpr and consteval functions)
  • Modules, a replacement for #include (no tutorial yet)
  • Ranges (no tutorial yet)
  • std::erase (no tutorial yet)
  • std::make_shared for arrays (no tutorial yet)
  • std::map::contains() (no tutorial yet)
  • std::span (no tutorial yet)
  • String formatting library (no tutorial yet, see https://en.cppreference.com/w/cpp/utility/format)
  • String literals as template parameters (no tutorial yet)
  • Three-way comparison using the spaceship operator <=> (no tutorial yet)
  • Using scoped enums (no tutorial yet)
  • Views (no tutorial yet)
guest
Your email address will not be displayed
Find a mistake? Leave a comment above!
Correction-related comments will be deleted after processing to help reduce clutter. Thanks for helping to make the site better for everyone!
Avatars from https://gravatar.com/ are connected to your provided email address.
Notify me about replies:  
17 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments