This web site contains all the code listings from the book Exploring C++ 20 (Apress). They are divided into two folders as follows:
code-modules
These files are extracted from the book verbatim.
They require full support for modules, including
import of standard library headers. Set the CMake variable MODULES
to TRUE
in order to compile these files. At this time
(2020-07-10), no compiler release or prerelease can compile these
files. I will try to keep this site updated as compiler vendors
release more C++ 20 functionality.
code-preprocessor
These files are extracted from the book,
changing import
<header>;
to #include
<header>
. Also module
declarations are commented out, as is the export
keyword.
I provide header files to replace local modules.
In each code folder is a subfolder for every chapter. Every
chapter folder contains the files for that chapter, including
CMakeLists.txt
and test scripts. All files use POSIX
line endings (newline only).
The data directory contains some additional sample files that you can use as input for some of the exercises,.
To compile the examples, you will need cmake and, of course, a C++ compiler. As of 2020-07-10, no compiler and library implements the full C++ 20 draft standard. The GCC compiler and library are the most complete, and what I used when writing the book.
As of GCC 10.1, libstdc++ provides all the parts of C++ 20
that Exploring C++ 20 requires except for modules
and the <format>
header.
The fmt.dev project implements a functional equivalent,
albeit in the fmt
namespace.
In order to emulate the standard, I wrote my own
format
header
to use the fmt
library,
although I actually used a smaller, simpler fork,
called fmt6.
Except for Exploration 74, the tests rely on the run_test.py Python 3 script, as invoked from CMake tests. Some individual tests are themselves Python 3 scripts.
Download all files in a single ZIP file or compressed TAR file.