Log In
Join
 for free
Log In
Join
 for free
Back To Course Home
The All-in-One Guide to C++20
0% completed
Introduction
Getting Started
Conventions
Source Code
About C++
Historical Context
Standardization
A Quick Overview of C++20
Introduction to C++20
The Big Four
Core Language
The Standard Library
Concurrency
Concepts
Two Wrong Approaches
Advantages of Concepts
Four Ways to Use Concepts
Exercise: Implement Arithmetic Concept
Solution: Implement Arithmetic Concept
Use-cases for Concepts
More on Uses-cases for Concepts
Constrained and Unconstrained Placeholders
Abbreviated Function Templates
Predefined Concepts - Part I
Predefined Concepts - Part II
Defining Concepts
Exercise: Modify the sum Function
Solution: Modify the sum Function
Requires Expressions
The Concepts Equal and Ordering
The Concepts SemiRegular and Regular
Exercise: Simplifying the Generic Functions
Solution: Simplifying the Generic Functions
Concluding Concepts
Test Yourself: Concepts in C++20
Modules
Need for Modules
Advantages of Modules
A First Example
Compilation and Use
Export
Guidelines for a Module Structure
Module Interface Unit and Module Implementation Unit
Submodules and Module Partitions
Templates in Modules
Module Linkage
Header Units
Test Yourself: Modules in C++20
Three-way Comparison Operator
Ordering before C++20
The Compiler-generated Spaceship Operator
Rewriting Expressions
Exercise: Extend MyInt Class
Solution: Extend MyInt Class
User-defined and Auto-generated Comparison Operators
Test Yourself: Three-way Comparison Operator
Designated Initialization
Aggregate Initialization
Named Initialization of Class Members
Exercise: Detect Narrowing Conversion
Solution: Detect Narrowing Conversion
Test Yourself: Designated Initialization
New Keywords: consteval and constinit
The consteval Keyword
The constinit Keyword
Function Execution and Variable Initialization
Solving the Static Initialization Order Fiasco
Test Yourself: consteval and constinit
Template Improvements
Conditionally Explicit Constructor
Exercise: Manage the Implicit Conversion
Solution: Manage the Implicit Conversion
Non-type Template Parameters
Test Yourself: Template Improvements
Lambda Improvements
Template Parameter for Lambdas
Detection of the Implicit Copy of the this Pointer
Lambdas in an Unevaluated Context and Stateless Lambdas
Test Yourself: Lambda Improvements
New Attributes in C++20
Introduction to Attributes
The [[nodiscard("reason")]] Attribute
The [[likely]] and [[unlikely]] Attributes
The [[no_unique_address]] Attribute
Test Yourself: New Attributes in C++20
Further Improvements in Core Language
The volatile Keyword
Range-based 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
The ranges Library
Overview of the ranges Library
Exercise: Compute the Average
Solution: Compute the Average
The Concepts Ranges and Views
Direct on the Container
Function Composition
Lazy Evaluation
A Flavor of Python
Exercise: Implement Python's map Function
Solution: Implement Python's map Function
Test Yourself: The ranges Library
std::span
Static versus Dynamic Extent
Deducing the Size of a Contiguous Sequence of Object
Create a std::span from a Pointer and a Size
Modifying the Referenced Objects
Addressing the std::span Elements
A Constant Range of Modifiable Elements
Test Yourself: The std::span Container
Container Improvements
constexpr Containers and Algorithms
std::array Container in C++20
Consistent Container Erasure
contains for Associative Containers
Exercise: Erase the Capital Letters
Solution: Erase the Capital Letters
String prefix and suffix checking
Test Yourself: Container Improvements
Arithmetic Utilities
Safe Comparison of Integers
Mathematical Constants
Midpoint and Linear Interpolation
Bit Manipulation
Exercise: Analyze the Output
Solution: Analyze the Output
Test Yourself: Arithmetic Utilities
Calendar and Time Zones
Time of Day
Calendar Dates
Validation of Date
Query Calendar Dates and Weekdays
Calculating Ordinal Dates
Time Zones
Test Yourself: Calendar and Time Zones
Formatting Library
Overview of the Formatting Library
Format Strings
User-defined Types
Test Yourself: Formatting Library
Further Improvements in Standard Library
std::bind_front Library in C++20
std::is_constant_evaluated Library in C++20
std::source_location Library in C++20
Coroutines
Overview of Coroutines
Characteristic of Coroutines
The Framework
Awaitables and Awaiters
The Workflow
The co_return Keyword
The co_yield Keyword
The co_await Keyword
Test Yourself: Coroutines
Atomics
std::atomic_ref
Specializations of std::atomic_ref
Atomic Smart Pointers
std::atomic_flag Extensions
One Time Synchronization of Threads
std::atomic Extensions
Exercise: Try Different Synchronization Techniques
Solution: Try Different Synchronization Techniques
Test Yourself: Atomics
Semaphores
Overview of Semaphores
Thread Synchronization with Semaphores
Test Yourself: Semaphores
Latches and Barriers
Overview of Latches and Barriers
std::latch
std::barrier
Test Yourself: Latches and Barriers
Cooperative Interruption
Overview of Cooperative Interruption Thread
New wait Overloads for the condition_variable_any
Test Yourself: Cooperative Interruption
std::jthread
Automatically Joining
Cooperative Interruption of a std::jthread
Test Yourself: std::jthread
Synchronized Output Streams
Output streams with std::cout
Exercise: Synchronize the Output
Solution: Synchronize the Output
The get_wrapped Function
Test Yourself: Synchronized Output Streams
Case Studies
Case Study I: Fast Synchronization of Threads
Case Study II: Variations of Futures
Case Study III: Modification and Generalization of a Generator
Case Study IV: Various Job Workflows
Summary
What's Next?
C++23
Introduction to C++ 23
Coroutine Types in the Coroutines Library
Awaitable Types and Functions in the Coroutines Library
static_thread_pool in Coroutine Library
Modularized Standard Library for Modules
Executors
The Network Library
C++23 or Later
Contracts
Reflection
Pattern Matching
Further Information about C++23
Feature Testing of C++
Feature Testing
Overview of Coroutines
Get an overview of coroutines.
We'll cover the following
A generator function
Get hands-on with 1400+ tech skills courses.
Start Free Trial