C++20/23 and capstone projects

This part of the C++ course is the newest language and then three programs built with it. Modules replace the header, a history lesson puts every standard side by side, and the C++20 and C++23 lessons list what each one added. Legacy code is read and modernised, and C and C++ solve one task side by side. The rest is the capstones: a JSON parser with a writer and tests, a task tracker with a file format and a command line, and an inverted index that is measured and made faster.

131 C++20 modules export module, import, the gcm.cache that g++ writes and a module built with -fmodules-ts Open 132 C++98 to C++23 in one file __cplusplus under each -std value, and a feature that each standard added Open 133 C++20 features designated initialisers, the spaceship operator, std::span, bit operations and consteval Open 134 C++23 features std::expected, std::print, std::flat_map, deducing this and multidimensional subscript Open 135 Reading legacy C++ C-style arrays and casts, malloc in C++, and a class modernised step by step Open 136 C++ and C side by side the same task in C and in C++, and what the C++ version moves to the compiler and the library Open 137 Capstone 1: a JSON tokenizer the project layout, the token type and a lexer that walks a JSON document Open 138 Capstone 1: the parser a recursive descent parser, the value type it builds and the errors it reports Open 139 Capstone 1: a JSON value a variant of object, array, string, number, bool and null, with accessors and printing Open 140 Capstone 1: writing JSON escape strings, indent nested values and round-trip the document Open 141 Capstone 1: testing the parser a table of good and bad documents, a test runner and the bugs it finds Open 142 Capstone 2: a task model a task with an id, a state and a due date, and the operations that keep it valid Open 143 Capstone 2: saving tasks a line-based file format, load and save, and a corrupt line that is skipped Open 144 Capstone 2: the command line parse subcommands, dispatch to handlers and print a task list Open 145 Capstone 2: error handling std::expected through the layers, error messages for the user and a non-zero exit code Open 146 Capstone 2: testing the tracker test the model, the storage and the commands, with a temporary file per test Open 147 Capstone 3: a tokenizer split documents into words, normalise case and keep the positions Open 148 Capstone 3: the inverted index map a word to the documents and positions that hold it, and build it from a directory Open 149 Capstone 3: queries and ranking AND and OR queries, a ranked answer and a phrase search over positions Open 150 Capstone 3: measure and speed it up time the index build and the queries, then improve the hot path and measure again Open

Lessons