Modern C++ Guides: C++20 and C++23, Built and Run
This index covers the nineteen Modern C++ guides on the site — fifteen course guides and four measured head-to-heads. The course guides build real projects; the measured guides time them.
Written November 11, 2026 · Tested with CMake 3.28 · 6 min read
- What this page is
- C++20 and C++23 course — 15 guides
- Measured C++ head-to-heads — 4 guides
- Also on the site
What this page is
An index of the nineteen Modern C++ guides on the site. Each line states what the guide builds or proves, in the guide's own words, and links to the guide, which carries the full code, the compiler output, and the failures that did not make the cut.
C++20 and C++23 course — 15 guides
- C++20 Modules with CMake 3.28 and Ninja: A Working Multi-Target Project — Build a small C++20 geometry library as a named module with partitions, wired through CMake 3.28 and Ninja, and tested on Clang 18 and GCC 13 — including the setups that fail.
- Migrating a Template Library from SFINAE to C++20 Concepts — Migrate a small describe() library from enable_if to C++20 concepts in three steps, keeping the runtime output identical — with the real compiler errors before and after, and the subsumption trap that decides whether the migration works.
- C++23 std::expected Error-Handling Pipelines: Monadic Chains and Error-Type Design — Build a CSV parser whose every fallible step returns std::expected and chains with and_then, transform, or_else, and transform_error — with the same-error-type rule, the void step, and the real compiler results on GCC 13 and Clang 18.
- Testing C++20 Modules: Direct Commands, Then CMake and CTest — Test a C++20 module with direct compiler commands first, then CMake and CTest: the GCC and Clang commands that work, the GCC 13 configure failure quoted verbatim, and the GCC 14 or newer floor for module scanning.
- Header-Only C++20 Modules Library with CMake: Install It Without an INTERFACE Target — CMake rejects INTERFACE libraries with a CXX_MODULES file set. This guide shows the failure on CMake 3.28.3, then installs the same module as a static library and consumes it with find_package.
- C++23 std::mdspan and Deducing This: A Matrix and Image View Library — Build a matrix and image view library with C++23 std::mdspan: row-major, column-major, and strided channel views, plus deducing this member functions. Tested on GCC 16, 14, and 13, with the failures quoted.
- C++20 Coroutines to C++23 std::generator: Hand-Rolled Machinery, Then the Standard Type — Write a coroutine generator from scratch with a promise type, Task, and Generator, then replace it with C++23 std::generator and pipe it through ranges views — tested on GCC 13 and GCC 14, with the GCC 13 failure and the single-pass crash shown.
- C++20 Coroutine Pitfalls: Three Fixtures, Three Compilers, Same Answer — Three small coroutine programs, each run on GCC 13, GCC 16, and Clang 18 at C++20 with byte-identical output: eager versus lazy start, frame destruction on an early exit, and a lazy task that runs nothing until resumed.
- The C++20 Spaceship Operator: One Defaulted <=> Replaces Six Comparisons — Migrate a small value type from six hand-written comparison operators to one defaulted C++20 three-way comparison — with the signed/unsigned, NaN, and missing-
traps, each compiled and run on GCC 13, 14, 16 and Clang 18. - Build a C++ Ranges Pipeline: C++20 Views, Then C++23, With the Compiler Matrix — Build one log-record pipeline twice: C++20 filter, transform, drop, and take over a named owner container, then the C++23 upgrade with enumerate, zip, chunk_by, slide, stride, and cartesian_product, ending in ranges::to — tested on GCC 13, 14, 16, and Clang 18.
- GCC 16 Defaults to C++20: What Breaks in Your Old Code — GCC 16.2.0 compiles C++ as C++20 unless told otherwise. A five-idiom legacy codebase fails with 6 error lines under the new default and runs clean under -std=c++17 and GCC 13. This guide runs each breakage, quotes the errors verbatim, corrects three supposed breakages that are not, and shows the fixed code compiling on both.
- GCC 16 Defaults to C++20: A Migration Checklist for Unpinned Codebases — GCC 16 changes the default C++ standard to C++20. Pin first, then fix each breakage class in order. Every error below was produced on GCC 16.2.0.
- std::formatter That Compiles: A Clang-Only Specialization Project — A working std::formatter specialization project under Clang 18: a quoted-string formatter, a delegating formatter for a point type, the compile-time versus runtime error split, and the range-formatting verdicts that only a GCC 16 frontend can give, because GCC 16 with C++23 does not assemble on this machine.
- Three std::mdspan Traps: The Missing operator(), submdspan in C++26, and assert — Three std::mdspan traps, each proved by a compiled program: libstdc++ 16 ships no operator(), submdspan runs only in C++26, and assert() breaks on a comma in a subscript.
- CMakePresets and vcpkg on a C++20 Modules Project: Four Decisions, All Tested — Four preset and vcpkg decisions on a real C++20 modules project: where VCPKG_ROOT lives, manifest versus classic mode, chainloading a second toolchain, and preset inheritance with GCC 16.
Measured C++ head-to-heads — 4 guides
- GCC 16.2: std::print, ranges::to, and from_range — What Actually Compiles, and the Macro That Does Not Exist — std::print, ranges::to, and the from_range constructor all compile and run on GCC 16.2.0; std::hazard_pointer fails at the include because the header is not shipped; the from_range feature-test macro is
__cpp_lib_containers_ranges, not__cpp_lib_ranges_from_range. - C++20 Coroutines + io_uring: A co_await File Read That Actually Runs — one pump, 36 bytes, content verified (content_match=1, PROBE_OK) — a co_await file read that actually runs, on liburing 2.16, GCC 13.3.0.
- What Does std::generator Cost, Measured? — summing 10 million values costs 0.024 s through std::generator vs 0.014 s through a plain loop (1.57–1.80x); a views::iota pipeline ties the loop at zero allocations; a second pass over a consumed generator segfaults (rc=-11) on GCC 14 / libstdc++ 14.
- How Fast Do std::latch and std::barrier Wake Threads? Measured — 9 to 68 Times Faster Than a Condition Variable — std::latch wakes a waiting thread in 364 ns vs 4,342 ns for a mutex and condition_variable at 2 threads (11.9x), 68.1x at 8 threads; std::barrier beats a hand-rolled condition-variable barrier by 1.39x / 1.70x / 1.84x per phase at 2 / 8 / 32 threads.
Also on the site
- Daily C++ tips and puzzles — one small C++ tip and one puzzle a day, each with runnable code.
- Measured Comparisons: 30 Head-to-Head Guides, November 9–10, 2026 — the full measured series, including the four C++ head-to-heads above and twenty-six sysadmin and command-line guides.
Related guides on this site
Keep Exploring
Paste a [Service] section and get a plain-language verdict on every sandboxing setting it finds.
Paste sshd -G output and get a hardening verdict on the values your server actually runs.
Paste a server block and get WebSocket, TLS, HSTS, and proxy-header verdicts.
Paste a systemd timer expression and get the specific reason it fails, the normalized form, and the past-date traps the built-in check hides.
The full sysadmin hub \u2014 systemd, cgroups, file tools, and measured Linux comparisons.