C++20

I’m Proud to Present my New Book: C++20

I’m proud to present the early release of my book to C++20 on LeanPub. The book is 50 % done and has more than 300 pages and 150 code examples of content. I will update the book at least two times in 2021. Of course, you will get each update of the book.

C++20

How to Get it?

Use the link: Leanpub.com: C++20

What’s Inside?

My book C++20 is both: a tutorial and a reference to the C++20 standard. It teaches you C++20 and provides you with the details of this new thrilling C++ standard. The thrilling factor is mainly due to the big four of C++20.

  • Concepts change the way we think and program templates. They are semantic categories for the template parameters. They enable you to express your intention directly in the type of system. If something goes wrong, you get a clear error message.
  • The new ranges library enables it to perform algorithms directly on the container, compose the algorithm with the pipe symbol, and apply them onto infinite data streams.
  • Thanks to coroutines asynchronous programming in C++ becomes mainstream. Coroutines are the base for cooperative tasks, event loops, infinite data streams, or pipelines.
  • Modules overcome the restrictions of header files. They promise a lot. For example, the separation of header and source files becomes as obsolete as the preprocessor. In the end, we have faster built time and an easier way to build packages.

More Details

 

  • Core Language
    • Concepts
      • Two Wrong Approaches
      • Advantages of Concepts
      • Usage of Concepts
      • Unconstrained Placeholders and Constrained Placeholders
      • Abbreviated Function Templates
      • Predefined Concepts
      • Define Concepts
      • Application
    • Moduls
      • Why do we need modules?
      • Advantages
      • A First Example
      • Compilation and Use
      • Modularized Standard Library
      • Export
      • Guidelines for a Module Structure
      • Module Interface Unit and Module Implementation Unit
      • Submodules and Module Partitions
      • Templates in Modules
      • Module Linkage
      • Header Units
    • Three-Way Comparison Operator
      • Ordering before C++20
      • Ordering since C++20
      • The Compiler-Generated Spaceship Operator
      • Rewriting Expressions
      • User-Defined and Auto-Generated Comparison Operators
    • Designated Initialization
      • Aggregate Initialization
      • Designated Initialization
    • consteval and constint
      • consteval
      • constinit
      • Function Execution
      • Variable Initialization
      • Solving the Static Initialization Order Fiasco
    • Template Improvements
      • Conditionally Explicit Constructor
      • Non-Type Template Parameters
    • Lambda Improvements
      • Template Parameter for Lambdas
      • Detection of the Implicitly Copy of the this Pointer
      • Lambdas in an Unevaluted Context and Stateless Lambdas can be Default-Constructed and Copy-Assigned
    • New Attributes
      • [[nodiscard("reason")]]
      • [[likely]] and [[unlikely]]
      • [[no_unique_address]]
    • volatile
    • Further Improvements
      • Range-base for-loop with Initializers
      • Virtual constexpr function
      • The new Character Type of UTF-8 Strings: char8_t
      • using enum in Local Scopes
      • Default Member Initializers for Bit Fields
  • Standard Library
    • Ranges Library
      • The Concepts Ranges and Views
      • Direct on the Container
      • Function Composition
      • Lazy Evaluation
      • A Flavor of Python
    • std::span
      • Create a std::span from a Pointer and a Size
      • Modifying the Referenced Objects
      • Addressing its Elements
    • Container Improvements
      • constexpr Container and Algorithms
      • std::array
      • Consistent Container Erasure
      • contains for Associative Containers
      • String prefix and suffix checking
    • Arithmetic Utilities
      • Safe Comparison of Integrals
      • Mathematical Constants
      • Midpoint and Linear Interpolation
      • Bit Manipulation
    • Calendar and Time-Zone
      • Time of day
      • Calendar Dates
      • Time-Zones
    • Formatting Library
      • Format String
      • User-Defined Types
    • Further Improvements
      • std::bind_front
      • std::is_constant_evaluated
      • std::source_location
  • Concurrency
    • Coroutines
      • A Generator Function
      • Details
      • The Framework
    • Atomics
      • std::atomic_ref
      • Atomic Smart Pointer
      • std::atomic_flag Extensions
      • std::atomic Extensions
    • Semaphores
    • Latches and Barriers
      • std::latch
      • std::barrier
    • Cooperatively Interruption
      • std::stop_token, std::stop_source, and std::stop_callback
    • std::jthread
      • Automatically Joining
      • Interrupt a std::jthread
    • Synchronized Outputstreams
  • C++23 and Beyond
    • Coroutines Library
    • Modularized Standandard Library for Modules
    • Executors
    • Network Library
    • Contracts
    • Reflection
    • Pattern Matching

State of the Book

Early Publishing

Although the book is only 50 % done, I publish it at LeanPub. I will update the book at least two times and assume that I’m done with the book in about a year. I decided to publish it half-done because it provides valuable information even in this early stage.

Further Updates

You can expect the following improvements with future updates.

  • More code examples when missing C++20 features are available. Additionally, I reimplement existing examples using the C++20 standard and not prototype libraries such as fmt or date.
  • More details on the C++20 features.
  • A preview of the new C++23 standard.
  • Tutorials to the big four at least: concepts, ranges, modules, and coroutines.

How to Contact Me?

 

Modernes C++,

 

Rainer D 6 P2 500x500Modernes C++ Mentoring

  • "Fundamentals for C++ Professionals" (open)
  • "Design Patterns and Architectural Patterns with C++" (open)
  • "C++20: Get the Details" (open)
  • "Concurrency with Modern C++" (open)
  • "Generic Programming (Templates) with C++": October 2024
  • "Embedded Programming with Modern C++": October 2024
  • "Clean Code: Best Practices for Modern C++": March 2025
  • Do you want to stay informed: Subscribe.

     

    RainerGrimmSmall

     

     

     

     

    Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Stephen Kelley, Kyle Dean, Tusar Palauri, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, Rob North, Bhavith C Achar, Marco Parri Empoli, Philipp Lenk, Charles-Jianye Chen, Keith Jeffery, Matt Godbolt, and Honey Sukesan.

    Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, Slavko Radman, and David Poole.

    My special thanks to Embarcadero
    My special thanks to PVS-Studio
    My special thanks to Tipi.build 
    My special thanks to Take Up Code
    My special thanks to SHAVEDYAKS

    Modernes C++ GmbH

    Modernes C++ Mentoring (English)

    Do you want to stay informed about my mentoring programs? Subscribe Here

    Rainer Grimm
    Yalovastraße 20
    72108 Rottenburg

    Mobil: +49 176 5506 5086
    Mail: schulung@ModernesCpp.de
    Mentoring: www.ModernesCpp.org

    Modernes C++ Mentoring,

     

     

    0 replies

    Leave a Reply

    Want to join the discussion?
    Feel free to contribute!

    Leave a Reply

    Your email address will not be published. Required fields are marked *