C++ by Example
C++ by Example

What's Next

2 min read

What's Next

You have covered the full breadth of modern C++: types, control flow, functions, memory, classes, templates, the standard library, concurrency, and error handling. That foundation covers the vast majority of real C++ code.

Modern C++ you will encounter

C++17 (2017 — widely supported today)

  • Structured bindings: auto [k, v] = pair
  • if/switch with initializer
  • std::optional, std::variant, std::string_view, std::filesystem
  • Parallel execution policies for STL algorithms

C++20 (2020 — broadly supported in GCC 10+, Clang 10+, MSVC 2019+)

  • Concepts and constraints (requires, concept)
  • Ranges and views (std::ranges::sort, std::views::filter)
  • Coroutines (co_await, co_yield, co_return)
  • Modules — a replacement for #include with faster compilation
  • std::span — non-owning view of contiguous memory
  • std::jthread — auto-joining thread
  • std::format — Python-style string formatting
  • Three-way comparison operator <=>

C++23 (2023 — arriving in compilers)

  • std::expected<T, E> — typed error return
  • std::println — formatted output with newline
  • std::flat_map, std::flat_set — sorted-vector backed maps
  • Multi-dimensional operator[]
  • std::generator — stackless coroutine for ranges
  • Explicit object parameters (this as first parameter)

Tools every C++ developer should know

Compilers

  • GCC (g++) — widely used on Linux; excellent diagnostics
  • Clang (clang++) — excellent error messages, macOS default
  • MSVC — Windows native, integrates with Visual Studio

Build systems

  • CMake — the de facto standard for cross-platform C++ projects
  • Ninja — fast build backend, often used with CMake
  • Meson — simpler alternative to CMake

Static analysis

  • clang-tidy — checks for bugs, style issues, and modernization opportunities
  • clang-format — automatic code formatting
  • cppcheck — additional static analysis

Runtime checks

  • AddressSanitizer: -fsanitize=address — detects heap and stack memory errors
  • UBSanitizer: -fsanitize=undefined — catches undefined behavior
  • ThreadSanitizer: -fsanitize=thread — catches data races
  • Valgrind — memory leak and error detection (Linux)
# Development — maximum warnings and sanitizers
g++ -std=c++17 -Wall -Wextra -Wpedantic \
    -g -fsanitize=address,undefined \
    -o app main.cpp

# Release — optimized
g++ -std=c++17 -O2 -DNDEBUG -o app main.cpp

Projects to build

Each of these exercises focuses on a different part of the language:

  • Command-line tool — argument parsing, file I/O, string processing
  • JSON parser — recursive descent, custom class hierarchies, error handling
  • Thread-safe queue — std::mutex, std::condition_variable, move semantics
  • HTTP server — POSIX sockets or <boost/asio>, RAII for descriptors
  • 2D game with SDL2 — rendering loop, input, real-time constraints
  • Generic data structures — your own vector, map, or hash_map from scratch

Books and references

  • cppreference.com — the authoritative reference for every standard library type
  • The C++ Programming Language — Bjarne Stroustrup (language designer)
  • Effective Modern C++ — Scott Meyers (42 practical rules for C++11/14)
  • C++ Concurrency in Action — Anthony Williams (threading and atomics)
  • A Tour of C++ — Stroustrup (short, dense overview of modern C++)

C++ rewards patience and practice. Its complexity is real, but so is its power. The programs you can write in C++ — correct, efficient, expressive — are worth the investment.

Go build something.

C++ by Example
C++ by Example

Learn modern C++ through working code. Each chapter introduces one concept — variables, functions, classes, templates, smart pointers, concurrency — with a clear example, a line-by-line explanation, and notes on how it applies in real programs.

View book →