Description
In this course, you will learn :
- Learn the specifics of the new standard, with a focus on the big four: concepts, modules, range libraries, and coroutines.
- You will also go over the standard library additions and concurrency in depth. To help the information sink in, each chapter includes a plethora of example code that will give you a clear picture of what to expect from each feature.
- You will work through some case studies in order to put the theory into practise.
- Writing more generic programs using concepts
- Overcoming the deficiency of legacy headers and macros with modules
- Using algorithms that operate directly on containers
- Writing asynchronous programs that are highly valuable in event-driven systems
Syllabus :
1. About C++
- Historical Context
- Standardization
2. A Quick Overview of C++20
- The Big Four
- Core Language
- The Standard Library
- Concurrency
3. 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
- Defining Concepts
- Exercise: Modify the sum Function
- Solution: Modify the sum Function
- Requires Expressions
- The Concepts Equal and Ordering
- The Concepts SemiRegular and Regular
- Concluding Concepts
- Test Yourself: Concepts in C++20
4. 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
5. Three-way Comparison Operator
- Ordering before C++20
- The Compiler-generated Spaceship Operator
- Rewriting Expressions
- User-defined and Auto-generated Comparison Operators
6. Designated Initialization
- Aggregate Initialization
- Named Initialization of Class Members
- Test Yourself: Designated Initialization
7. New Keywords: consteval and constinit
- The consteval Keyword
- The constinit Keyword
- Function Execution and Variable Initialization
- Solving the Static Initialization Order Fiasco
8. Template Improvements
- Conditionally Explicit Constructor
- Non-type Template Parameters
9. Lambda Improvements
- Template Parameter for Lambdas
- Detection of the Implicit Copy of the this Pointer
- Lambdas in an Unevaluated Context and Stateless Lambdas
10. New Attributes in C++20
- Introduction to Attributes
- The [[nodiscard("reason")]] Attribute
- The [[likely]] and [[unlikely]] Attributes
- The [[no_unique_address]] Attribute
11. 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
12. The ranges Library
- The Concepts Ranges and Views
- Direct on the Container
- Function Composition
- Lazy Evaluation
- A Flavor of Python
13. 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
14. Container Improvements
- constexpr Containers and Algorithms
- std::array Container in C++20
- Consistent Container Erasure
- contains for Associative Containers
- String prefix and suffix checking
15. Arithmetic Utilities
- Safe Comparison of Integers
- Mathematical Constants
- Midpoint and Linear Interpolation
- Bit Manipulation
16. Calendar and Time Zones
- Time of Day
- Calendar Dates
- Validation of Date
- Query Calendar Dates and Weekdays
- Calculating Ordinal Dates
- Time Zones
17. Formatting Library
- Format Strings
- User-defined Types
18. 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
19. Coroutines
- Characteristic of Coroutines
- The Framework
- Awaitables and Awaiters
- The Workflow
- The co_return Keyword
- The co_yield Keyword
- The co_await Keyword
20. Atomics
- std::atomic_ref
- Specializations of std::atomic_ref
- Atomic Smart Pointers
- std::atomic_flag Extensions
- One Time Synchronization of Threads
- std::atomic Extensions
21. Semaphores
- Thread Synchronization with Semaphores
22. Latches and Barriers
- std::latch
- std::barrier
23. Cooperative Interruption
- Overview of Cooperative Interruption Thread
- New wait Overloads for the condition_variable_any
24. std::jthread
- Automatically Joining
- Cooperative Interruption of a std::jthread
- Test Yourself: std::jthread
- Synchronized Output Streams
- Output streams with std::cout
- The get_wrapped Function
25. 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
26. C++23 or Later
- Contracts
- Reflection
- Pattern Matching
- Further Information about C++23