C++20 Delta Seminar

The new syntax of C++20 and the extensions of the C++ Standard Library compared to C++17.

This seminar covers the pure differences of C++20 compared to the older standard C++17. Therefore, this seminar is ideal for participants who already have a solid knowledge of C++17 and only want to learn about the new features.

The following topics will be covered:

The new C++20 Language Features

  • Concepts: An extension to template metaprogramming that allows requirements for template parameters to be defined directly and explicitly. This leads to clearer error messages and easier-to-read generic code.
  • Modules: A solution to header file problems. Modules enable faster compilation times, improve encapsulation, and simplify dependency management in large codebases. As of 31.07.2025: this feature is still in an experimental state in most productive compilers.
  • Coroutines: A new paradigm for asynchronous and concurrent programming. Coroutines allow writing blocking operations in a sequential, non-blocking style, which improves the readability of I/O or event-based code.
  • Three-way Comparison Operator (<=>) – the Spaceship Operator: Simplifies the writing of comparison operators. By implementing this single operator, compilers can automatically generate all relational operators (<, <=, ==, !=, >, >=).
  • consteval and constinit: Extend C++'s compile-time capabilities. consteval enforces a function's evaluation at compile time, while constinit guarantees a variable's static initialization at compile time.
  • Lambda Improvements: Lambdas become more flexible, including the introduction of template parameters for lambdas and extended constexpr capabilities.
  • using enum: Simplifies access to enumerators within enum class definitions by allowing them to be imported directly into the current scope.

The C++20 Standard Library Extensions

  • Ranges Library: A library that transforms the way we work with data collections. It allows writing functional and chainable operations (e.g., filtering, transforming) on sequences.
  • std::span: A safe and efficient non-owning view over a contiguous sequence of objects. Ideal for passing parts of arrays or buffers to functions.
  • Concurrency and Synchronization Improvements: New and improved tools for concurrency, including std::jthread (a thread that automatically `join`s and provides a stop token) and enhanced atomic operations.
  • Text Formatting with std::format: A type-safe, and powerful formatting library that offers a flexible and intuitive syntax for creating formatted strings, similar to the syntax known from Python.
  • Calendar and Time Zone Support: Comprehensive extensions to the <chrono> library for precise and easy work with dates, times, and time zones.

The seminar provides a theoretical and practical introduction to the C++20 - ISO/IEC 14882:2020 - standard. After the theoretical sections, practical exercises are included so that participants can test the applicability of the new language and library components.

Most current versions of common production compilers support the C++20 standard. The best support is provided by the Clang C++ Compiler, closely followed by the GNU C++ Compiler. The operating system used in the seminar is irrelevant. It's usually Linux, Windows, or Mac OS X.

Last changed on 2025-07-27