Table of Contents....3
Reader Testimonials....11
Introduction....13
Conventions....14
Special Fonts....14
Special Boxes....14
Source Code....15
Compilation of the Programs....15
How should you read the Book?....16
Personal Notes....17
Acknowledgments....17
About Me....18
About C++....20
Historical Context....21
C++98....21
C++03....22
TR1....22
C++11....22
C++14....22
C++17....23
Standardization....24
Stage 3....25
Stage 2....25
Stage 1....25
A Quick Overview of C++20....27
C++20....28
The Big Four....29
Concepts....29
Modules....31
The Ranges Library....32
Coroutines....33
Core Language....36
Three-Way Comparison Operator....36
Designated Initialization....37
consteval and constinit....40
Template Improvements....41
Lambda Improvements....42
New Attributes....43
The Standard Library....44
std::span....44
Container Improvements....45
Arithmetic Utilities....45
Calendar and Time Zones....46
Formatting Library....47
Concurrency....49
Atomics....49
Semaphores....50
Latches and Barriers....50
Cooperative Interruption....51
std::jthread....53
Synchronized Outputstreams....55
The Details....58
Core Language....59
Concepts....60
Two Wrong Approaches....60
Advantages of Concepts....67
The long, long History....68
Use of Concepts....69
Constrained and Unconstrained Placeholders....83
Abbreviated Function Templates....86
Predefined Concepts....92
Defining Concepts....100
Application....110
Modules....126
Why do we need Modules?....126
Advantages....135
A First Example....136
Compilation and Use....139
Export....141
Guidelines for a Module Structure....143
Module Interface Unit and Module Implementation Unit....144
Submodules and Module Partitions....148
Templates in Modules....154
Module Linkage....157
Header Units....160
Three-Way Comparison Operator....162
Ordering before C++20....162
Ordering since C++20....164
Comparision Categories....168
The Compiler-Generated Spaceship Operator....171
Rewriting Expressions....176
User-Defined and Auto-Generated Comparison Operators....180
Designated Initialization....184
Aggregate Initialization....184
Named Initialization of Class Members....186
consteval and constinit....192
consteval....192
constinit....194
Function Execution....195
Variable Initialization....197
Solving the Static Initialization Order Fiasco....199
Template Improvements....206
Conditionally Explicit Constructor....206
Non-Type Template Parameters....210
Lambda Improvements....214
Template Parameter for Lambdas....214
Detection of the Implicit Copy of the this Pointer....220
Lambdas in an Unevaluated Context and Stateless Lambdas can be Default-Constructed and Copy-Assigned....222
New Attributes....228
[[nodiscard("reason")]]....229
[[likely]] and [[unlikely]]....235
[[no_unique_address]]....236
Further Improvements....239
volatile....239
Range-based for loop with Initializers....241
Virtual constexpr function....243
The new Character Type of UTF-8 Strings: char8_t....244
using enum in Local Scopes....246
Default Member Initializers for Bit Fields....248
The Standard Library....250
The Ranges Library....251
The Concepts Ranges and Views....252
Direct on the Container....254
Function Composition....260
Lazy Evaluation....262
Define a View....266
A Flavor of Python....271
std::span....279
Static versus Dynamic Extent....279
Automatically Deduces the Size of a Contiguous Sequence of Objects....281
Create a std::span from a Pointer and a Size....283
Modifying the Referenced Objects....285
Addressing std::span Elements....286
A Constant Range of Modifiable Elements....289
Container Improvements....292
constexpr Containers and Algorithms....292
std::array....294
Consistent Container Erasure....296
contains for Associative Containers....302
String prefix and suffix checking....305
Arithmetic Utilities....309
Safe Comparison of Integers....309
Mathematical Constants....315
Midpoint and Linear Interpolation....318
Bit Manipulation....320
Calendar and Time Zones....328
Time of day....330
Calendar Dates....333
Time Zones....354
Formatting Library....365
Format String....367
User-Defined Types....378
Further Improvements....386
std::bind_front....386
std::is_constant_evaluated....389
std::source_location....391
Concurrency....394
Coroutines....395
A Generator Function....396
Characteristics....399
The Framework....403
Awaitables and Awaiters....406
The Workflows....410
co_return....414
co_yield....417
co_await....421
Atomics....432
std::atomic_ref....432
Atomic Smart Pointer....442
std::atomic_flag Extensions....448
std::atomic Extensions....458
Semaphores....463
Latches and Barriers....470
std::latch....471
std::barrier....477
Cooperative Interruption....482
std::stop_source....483
std::stop_token....484
std::stop_callback....485
std::jthread....493
Automatically Joining....494
Cooperative Interruption of a std::jthread....497
Synchronized Output Streams....501
Case Studies....511
Fast Synchronization of Threads....512
Condition Variables....513
std::atomic_flag....515
std::atomic....520
Semaphores....523
All Numbers....525
Variations of Futures....526
A Lazy Future....529
Execution on Another Thread....533
Modification and Generalization of a Generator....539
Modifications....544
Generalization....548
Various Job Workflows....552
The Transparent Awaiter Workflow....552
Automatically Resuming the Awaiter....556
Automatically Resuming the Awaiter on a Separate Thread....559
Epilogue....564
Further Information....566
C++23 and Beyond....567
C++23....568
The Coroutines Library....568
Modularized Standard Library for Modules....588
Executors....591
The Network Library....597
C++23 or Later....599
Contracts....599
Reflection....605
Pattern Matching....609
Further Information about C++23....612
Feature Testing....614
Glossary....630
Callable....630
Callable Unit....630
Concurrency....630
Critical Section....630
Data Race....631
Deadlock....631
Eager Evaluation....631
Executor....631
Function Objects....632
Lambda Expressions....632
Lazy Evaluation....633
Lock-free....633
Lost Wakeup....633
Math Laws....633
Memory Location....634
Memory Model....634
Non-blocking....634
Object....634
Parallelism....634
Predicate....635
RAII....635
Race Conditions....635
Regular....635
Scalar....636
SemiRegular....636
Spurious Wakeup....636
The Big Four....636
The Big Six....637
Thread....637
Time Complexity....637
Translation Unit....638
Undefined Behavior....638
Index....639
My book C++20 is both a tutorial and a reference. It teaches you C++20 and provides you with the details of this new thrilling C++ standard. The thrill factor is mainly due to the big four of C++20:
Of course, this is not the end of the story. Here are more C++20 features: