C++20. Get the Details

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Rainer Grimm
Publisher: leanpub.com
Year: 2020

Language: English
Commentary: This version was published on 2021-06-06 || NOTE: F865868C626C7386C2B61E45536E24DD is newer (2021-08-28)
Tags: C++; C++20; C++ Programming Language; Object-Oriented Programming; Coroutines; Concepts; Modules; Ranges; Concurrency Programming

Table of Contents
Reader Testimonials
Introduction
Conventions
Special Fonts
Special Boxes
Source Code
Compilation of the Programs
How should you read the Book?
Personal Notes
Acknowledgments
About Me
About C++
Historical Context
C++98
C++03
TR1
C++11
C++14
C++17
Standardization
Stage 3
Stage 2
Stage 1
A Quick Overview of C++20
C++20
The Big Four
Concepts
Modules
The Ranges Library
Coroutines
Core Language
Three-Way Comparison Operator
Designated Initialization
consteval and constinit
Template Improvements
Lambda Improvements
New Attributes
The Standard Library
std::span
Container Improvements
Arithmetic Utilities
Calendar and Time Zones
Formatting Library
Concurrency
Atomics
Semaphores
Latches and Barriers
Cooperative Interruption
std::jthread
Synchronized Outputstreams
The Details
Core Language
Concepts
Two Wrong Approaches
Advantages of Concepts
The long, long History
Use of Concepts
Constrained and Unconstrained Placeholders
Abbreviated Function Templates
Predefined Concepts
Defining Concepts
Application
Modules
Why do we need Modules?
Advantages
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
Three-Way Comparison Operator
Ordering before C++20
Ordering since C++20
Comparision Categories
The Compiler-Generated Spaceship Operator
Rewriting Expressions
User-Defined and Auto-Generated Comparison Operators
Designated Initialization
Aggregate Initialization
Named Initialization of Class Members
consteval and constinit
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 Implicit Copy of the this Pointer
Lambdas in an Unevaluated Context and Stateless Lambdas can be Default-Constructed and Copy-Assigned
New Attributes
[[nodiscard("reason")]]
[[likely]] and [[unlikely]]
[[no_unique_address]]
Further Improvements
volatile
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 Standard Library
The Ranges Library
The Concepts Ranges and Views
Direct on the Container
Function Composition
Lazy Evaluation
Define a View
A Flavor of Python
std::span
Static versus Dynamic Extent
Automatically Deduces the Size of a Contiguous Sequence of Objects
Create a std::span from a Pointer and a Size
Modifying the Referenced Objects
Addressing std::span Elements
A Constant Range of Modifiable Elements
Container Improvements
constexpr Containers and Algorithms
std::array
Consistent Container Erasure
contains for Associative Containers
String prefix and suffix checking
Arithmetic Utilities
Safe Comparison of Integers
Mathematical Constants
Midpoint and Linear Interpolation
Bit Manipulation
Calendar and Time Zones
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
Characteristics
The Framework
Awaitables and Awaiters
The Workflows
co_return
co_yield
co_await
Atomics
std::atomic_ref
Atomic Smart Pointer
std::atomic_flag Extensions
std::atomic Extensions
Semaphores
Latches and Barriers
std::latch
std::barrier
Cooperative Interruption
std::stop_source
std::stop_token
std::stop_callback
std::jthread
Automatically Joining
Cooperative Interruption of a std::jthread
Synchronized Output Streams
Case Studies
Fast Synchronization of Threads
Condition Variables
std::atomic_flag
std::atomic
Semaphores
All Numbers
Variations of Futures
A Lazy Future
Execution on Another Thread
Modification and Generalization of a Generator
Modifications
Generalization
Various Job Workflows
The Transparent Awaiter Workflow
Automatically Resuming the Awaiter
Automatically Resuming the Awaiter on a Separate Thread
Epilogue
Further Information
C++23 and Beyond
C++23
The Coroutines 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
Glossary
Callable
Callable Unit
Concurrency
Critical Section
Data Race
Deadlock
Eager Evaluation
Executor
Function Objects
Lambda Expressions
Lazy Evaluation
Lock-free
Lost Wakeup
Math Laws
Memory Location
Memory Model
Non-blocking
Object
Parallelism
Predicate
RAII
Race Conditions
Regular
Scalar
SemiRegular
Spurious Wakeup
The Big Four
The Big Six
Thread
Time Complexity
Translation Unit
Undefined Behavior
Index