# Modern C++ Course (Basics → C++26) A hands-on C++ course with **56 Google Test exercises** organized into **14 modules**, from your first functions to modern standard-library features. ## Requirements - **CMake** 3.20+ - **C++ compiler** with C++23 support for later modules - Apple Clang 15+, GCC 13+, or MSVC 19.34+ recommended - **CLion** (recommended) or any CMake-aware IDE - Internet access on first configure (Google Test is fetched automatically) ## Quick Start (CLion) 1. Open this folder in CLion (`File → Open…`). 2. CLion detects `CMakeLists.txt` and configures automatically. 3. Pick an exercise target (e.g. `01_fundamentals_hello_world`) in the run configuration dropdown. 4. Implement the TODOs in the matching `src/*.cpp` file. 5. Run the test target until all assertions pass. ## Quick Start (Terminal) ```bash cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug cmake --build build ctest --test-dir build --output-on-failure ``` Run a single exercise: ```bash cmake --build build --target 01_fundamentals_hello_world ./build/modules/01_fundamentals/01_fundamentals_hello_world ``` ## Project Structure ``` cppc/ ├── CMakeLists.txt # Root project + Google Test ├── cmake/ │ ├── CourseExercise.cmake # add_course_exercise() helper │ └── CourseOptions.cmake # Warnings and standards └── modules/ ├── 01_fundamentals/ # Types, operators, I/O ├── 02_control_flow/ # if, switch, loops ├── 03_functions/ # Functions and recursion ├── 04_arrays_and_strings/ # Arrays, string, vector ├── 05_pointers_and_references/ ├── 06_oop_basics/ # Classes, inheritance ├── 07_stl_containers/ ├── 08_stl_algorithms/ ├── 09_cpp11/ # C++11 features ├── 10_cpp14/ ├── 11_cpp17/ ├── 12_cpp20/ # Concepts, ranges, <=> ├── 13_cpp23/ # expected, mdspan, format └── 14_cpp26/ # Frontier / C++26 direction ``` Each module contains: - `README.md` — learning goals and exercise list - `include/` — function and class declarations (your contract) - `src/` — **your implementation** (start here) - `test/` — Google Test files (do not edit unless extending) ## How to Study 1. Read the module `README.md`. 2. Open the exercise header to understand the required API. 3. Implement TODOs in the corresponding `src/` file. 4. Run that exercise’s test target in CLion or via CTest. 5. Move to the next exercise only when tests pass. ## Course Map | Module | Topic | Exercises | C++ Standard | |--------|-------|-----------|--------------| | 01 | Fundamentals | 4 | C++17 | | 02 | Control flow | 4 | C++17 | | 03 | Functions | 4 | C++17 | | 04 | Arrays & strings | 4 | C++17 | | 05 | Pointers & references | 4 | C++17 | | 06 | OOP basics | 4 | C++17 | | 07 | STL containers | 4 | C++17 | | 08 | STL algorithms | 4 | C++17 | | 09 | C++11 | 4 | C++11 | | 10 | C++14 | 4 | C++14 | | 11 | C++17 | 4 | C++17 | | 12 | C++20 | 4 | C++20 | | 13 | C++23 | 4 | C++23 | | 14 | C++26 frontier | 4 | C++23+ | ## CMake Options | Option | Default | Description | |--------|---------|-------------| | `COURSE_BUILD_TESTS` | ON | Build Google Test exercise targets | | `COURSE_WARNINGS_AS_ERRORS` | OFF | Treat warnings as errors | Example: ```bash cmake -S . -B build -DCOURSE_WARNINGS_AS_ERRORS=ON ``` ## CLion Tips - Use **Run | Run…** and filter by module prefix (e.g. `12_cpp20`). - Enable **Google Test** integration in CLion to see individual tests in the tree view. - Set breakpoints in your `src/` implementation while debugging failing tests. - `compile_commands.json` is exported for clangd/clang-tidy if you use external tools. ## Notes on C++26 C++26 is still in active standardization. Module 14 focuses on techniques and library directions that remain relevant—deep `constexpr`, monadic `expected`, ranges pipelines, and `std::formatter`—using C++23 as the practical baseline. Happy learning!