Skip to content
homer6Public

About

A hands-on reference for modern C++ (C++11 → C++26), from the basics to reflection, contracts and senders, plus guidelines for writing C++ well. Every snippet compiles and every claim is tested on GCC and Clang.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

cpp-docs

A hands-on reference for learning modern C++ — the language and the standard library, from C++11 through the latest standard (C++26) — organized as bite-sized, example-driven Markdown notes, plus opinionated guidelines on how to write C++ well.

The reference mirrors how cppreference.com organizes C++. Facts can come from any good source — cppreference, the standard draft, WG21 papers, compiler and library docs — as long as they've been verified locally (the snippet compiles, and behaves as described when run).

Linux: 33 of 33 toolchains passing macOS: 14 of 14 toolchains passing Windows: 8 of 8 toolchains passing FreeBSD: 4 of 4 toolchains passing Local: 3 of 3 toolchains passing

Platform support notes →

Full platform / compiler / architecture support →

Layout

Everything is clickable. The reference lives in docs/examples/ (master index and progress); each area has its own README.

Standard library

Core language

Everything else

Every area on cppreference's main page has pages, and every snippet compiles (or is tagged with why it can't). A GoogleTest suite that checks each page's claims at run time is in progress: #41.

Guidelines

The reference tells you what each feature is; docs/guidelines/ tells you how to use it well:

Sources and edition dates are in sources.md. To refresh them or import a new reference, ask Claude to use the refresh-guidelines skill.

Use it while you write C++ (Claude Code)

The modern-cpp skill makes Claude Code check this reference before writing C++. It:

  • looks up the page for a facility and follows its gotchas and version notes;
  • checks that the feature is supported on every compiler you build with, against this repo's measured results on about 50 toolchains;
  • applies the guidelines and validates the result.

Start with /modern-cpp. It's the preferred entry point for writing, modernizing or reviewing C++, and it calls /cpp-guidelines itself when the guidelines matter. Use /cpp-guidelines directly only for:

  • Reviewing or auditing existing code against the Core Guidelines, where you want findings with rule IDs (R.11, C.13) and no new code.
  • A question about a specific rule ("what does F.16 say, and does this code follow it?") or about one guidelines page.
  • A focused ownership, lifetime or memory-safety fix in code that already uses the right facilities.
  • Measuring the guidelines skill with the case suite in evals/ (31 cases across ownership, classes, expressions, concurrency and errors; it also has a suite for modern-cpp).

For security, use /cpp-security. It reviews code where an attacker controls part of the input (trust boundaries, sizes and bounds, parsing, secrets, fail-closed errors), hardens a build for your actual compiler and standard library, and plans the security tests, citing docs/security/, Core Guidelines and SEI CERT rule IDs.

Install it once for all your projects: clone this repo and run make install. That links modern-cpp, cpp-guidelines (review C++ against the Core Guidelines, citing rule IDs) and cpp-security into ~/.claude/skills.

git clone https://github.com/homer6/cpp-docs.git
cd cpp-docs && make install        # make uninstall removes the links

Then ask for it by name (/modern-cpp), or just ask for modern C++.

Upgrading: run make update. It pulls the latest release (stay on main) and re-links. The links point back at your checkout, so a plain git pull upgrades the skills too. make install also upgrades an older install: it re-points a link to another checkout, and moves an older copied folder to ~/.claude/skills-backup/ before linking. SKILLS_DIR=… make install installs somewhere else.

How to use these notes

Every reference page has the same shape:

  1. What it is — one-line summary, header, and the C++ version that introduced it.
  2. Mental model — how to picture it.
  3. Complexity / key facts — the numbers and rules that matter.
  4. When to use it (and when not to).
  5. Examples — short, focused, modern C++ snippets.
  6. Gotchas — the non-obvious traps.
  7. See also — where to read more.

How it's tested

  • Testing and CI: checking the snippets, running the tests (also under AddressSanitizer, UBSan and ThreadSanitizer), the toolchain presets (local, portable, MSVC and clang-cl from a VS Developer shell, GCC 16 in Docker) and the manual GitHub Actions workflows.
  • Platform support: the full results behind the table below (counts, skip reasons, known gaps per toolchain), generated by tools/collect_results.py.
  • Running a workflow: how a consented run is started, watched and read.

Conventions

Examples target the latest C++ standard and prefer modern idioms (CTAD, structured bindings, ranges, auto, designated initializers, etc.). The C++ version is noted whenever a feature isn't available everywhere. The full house style is in CLAUDE.md.

Progress

Latest release: v0.5.0 (2026-11-03). All releases are listed in docs/releases/.

See docs/examples/README.md for the full index and status across every topic.

License

MIT, © 2026 Steve Sperandeo: the notes, snippets, tests, tools and skills in this repo. PRs are welcome under the same licence. The submodules in modules/ keep their own licences: the C++ Core Guidelines allow copies for personal or internal business use only, so this repo links to them instead of copying their text.

Tested platforms

62 platform × compiler × architecture combinations, results as of 2026-11-03. Tests: GoogleTest cases passed / total; snippets: compile-checked blocks passed / checked. report-only: that toolchain's snippet results don't fail its run yet (no reviewed baseline). Skip reasons, known gaps and full counts: docs/platform-support.md, with the feature support matrix and one page per toolchain (every feature and example) in docs/platform-support/. The GitHub Actions runs here cover all areas (the areas input); the local runs cover the whole suite.

Platform Compiler Arch Tests Snippets Run
Linux (Docker) GCC 16.2.0 arm64 ✅ 1505/1544 (39 skipped) ✅ 1698/1698 (154 skipped) local, 2026-11-03
macOS (Darwin 23.6.0) Clang 22.1.8, libc++ arm64 ✅ 1396/1541 (145 skipped) ✅ 1679/1698 (19 baselined, 154 skipped) local, 2026-11-03
macOS (Darwin 23.6.0) GCC 15.2.0 arm64 ✅ 1423/1541 (118 skipped) ✅ 1698/1698 (154 skipped) local, 2026-11-03
FreeBSD 14.5 Clang 21.1.8, libc++ x86_64 ✅ 1387/1544 (157 skipped) ❌ 1675/1698 (19 baselined, 154 skipped, report-only) 2026-11-03
FreeBSD 15.1 Clang 19.1.7, libc++ x86_64 ✅ 1350/1544 (194 skipped) ❌ 1663/1698 (19 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libstdc++ arm64 ✅ 1398/1544 (146 skipped) ❌ 1679/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 26.04 Clang 22.1.2, libstdc++ arm64 ✅ 1435/1544 (109 skipped) ❌ 1691/1698 (154 skipped, report-only) 2026-11-03
Debian 12 GCC 13.5.0 x86_64 ✅ 1323/1544 (221 skipped) ❌ 1620/1698 (154 skipped, report-only) 2026-11-03
Debian 13 GCC 14.4.0 x86_64 ✅ 1385/1544 (159 skipped) ❌ 1664/1698 (154 skipped, report-only) 2026-11-03
Debian 13 GCC 16.2.0, ASan+UBSan x86_64 ✅ 1503/1544 (41 skipped) - 2026-11-03
Ubuntu 24.04 Clang 21.1.8, libc++ x86_64 ✅ 1388/1544 (156 skipped) ✅ 1681/1698 (17 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libc++, ASan+UBSan x86_64 ✅ 1398/1544 (146 skipped) - 2026-11-03
Ubuntu 24.04 Clang 23.1.5, libstdc++ x86_64 ✅ 1395/1544 (149 skipped) ❌ 1679/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 26.04 Clang 22.1.2, libstdc++ x86_64 ✅ 1433/1544 (111 skipped) ❌ 1691/1698 (154 skipped, report-only) 2026-11-03
macOS 15 Apple Clang 17.0.0 arm64 ✅ 1338/1541 (203 skipped) ❌ 1635/1698 (154 skipped, report-only) 2026-11-03
macOS 15 Clang 23.1.4, libc++ arm64 ✅ 1402/1541 (139 skipped) ✅ 1683/1698 (15 baselined, 154 skipped, report-only) 2026-11-03
macOS 26 Apple Clang 21.0.0 arm64 ✅ 1375/1541 (166 skipped) ❌ 1659/1698 (154 skipped, report-only) 2026-11-03
macOS 26 Clang 23.1.4, libc++ arm64 ✅ 1402/1541 (139 skipped) ✅ 1683/1698 (15 baselined, 154 skipped, report-only) 2026-11-03
macOS 26 Clang 23.1.4, libc++, ASan+UBSan arm64 ✅ 1402/1541 (139 skipped) - 2026-11-03
macOS 26 Clang 23.1.4, libc++, hardened arm64 ✅ 1410/1541 (131 skipped) - 2026-11-03
macOS 26 Apple Clang 21.0.0 x86_64 ✅ 1373/1541 (168 skipped) ❌ 1658/1698 (154 skipped, report-only) 2026-11-03
FreeBSD 14.5 GCC 14.2.0 x86_64 ✅ 1373/1544 (171 skipped) ❌ 1663/1698 (154 skipped, report-only) 2026-11-03
FreeBSD 15.1 GCC 14.2.0 x86_64 ✅ 1365/1544 (179 skipped) ❌ 1663/1698 (154 skipped, report-only) 2026-11-03
Debian 13 GCC 15.3.0 arm64 ✅ 1435/1544 (109 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
Debian 13 GCC 16.2.0 arm64 ✅ 1505/1544 (39 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libc++ arm64 ✅ 1399/1544 (145 skipped) ✅ 1681/1698 (17 baselined, 154 skipped) 2026-11-03
Ubuntu 24.04 Clang 23.1.5, libc++ arm64 ✅ 1406/1544 (138 skipped) ✅ 1687/1698 (11 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 23.1.5, libstdc++ arm64 ✅ 1396/1544 (148 skipped) ❌ 1679/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 26.04 Clang 22.1.2, libc++ arm64 ✅ 1402/1544 (142 skipped) ✅ 1681/1698 (17 baselined, 154 skipped) 2026-11-03
Ubuntu 26.04 GCC 15.2.0 arm64 ✅ 1442/1544 (102 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
Debian 13 GCC 15.3.0 x86_64 ✅ 1433/1544 (111 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
Debian 13 GCC 16.2.0 x86_64 ✅ 1503/1544 (41 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
Debian 13 GCC 16.2.0, hardened x86_64 ✅ 1502/1544 (42 skipped) - 2026-11-03
Ubuntu 24.04 Clang 18.1.8, libstdc++ x86_64 ✅ 1361/1544 (183 skipped) ❌ 1665/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 19.1.7, libc++ x86_64 ✅ 1350/1544 (194 skipped) ❌ 1668/1698 (17 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 19.1.7, libstdc++ x86_64 ✅ 1387/1544 (157 skipped) ❌ 1678/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 20.1.8, libc++ x86_64 ✅ 1374/1544 (170 skipped) ❌ 1676/1698 (17 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 20.1.8, libstdc++ x86_64 ✅ 1391/1544 (153 skipped) ❌ 1678/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 21.1.8, libstdc++ x86_64 ✅ 1393/1544 (151 skipped) ❌ 1679/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libc++ x86_64 ✅ 1397/1544 (147 skipped) ✅ 1681/1698 (17 baselined, 154 skipped) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libstdc++ x86_64 ✅ 1395/1544 (149 skipped) ❌ 1679/1698 (154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libstdc++, TSan x86_64 ✅ 1393/1544 (151 skipped) - 2026-11-03
Ubuntu 24.04 Clang 23.1.5, libc++ x86_64 ✅ 1404/1544 (140 skipped) ✅ 1687/1698 (11 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 26.04 Clang 22.1.2, libc++ x86_64 ✅ 1400/1544 (144 skipped) ✅ 1681/1698 (17 baselined, 154 skipped) 2026-11-03
Ubuntu 26.04 GCC 15.2.0 x86_64 ✅ 1440/1544 (104 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
macOS 15 GCC 16.2.0 arm64 ✅ 1494/1541 (47 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
macOS 15 Apple Clang 17.0.0 x86_64 ✅ 1335/1541 (206 skipped) ❌ 1635/1698 (154 skipped, report-only) 2026-11-03
macOS 15 GCC 16.2.0 x86_64 ✅ 1492/1541 (49 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
macOS 15 Clang 22.1.8, libc++ x86_64 ✅ 1394/1541 (147 skipped) ✅ 1679/1698 (19 baselined, 154 skipped) 2026-11-03
macOS 26 GCC 16.2.0 arm64 ✅ 1494/1541 (47 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
macOS 26 GCC 16.2.0 x86_64 ✅ 1492/1541 (49 skipped) ✅ 1698/1698 (154 skipped) 2026-11-03
macOS 26 Clang 22.1.8, libc++ x86_64 ✅ 1394/1541 (147 skipped) ✅ 1679/1698 (19 baselined, 154 skipped) 2026-11-03
Windows 11 MSVC 19.51.36260 arm64 ✅ 1372/1544 (172 skipped) ❌ 1654/1679 (173 skipped, report-only) 2026-11-03
Windows Server 2022 MSVC 19.44.35229 x86_64 ✅ 1342/1544 (202 skipped) ❌ 1641/1679 (173 skipped, report-only) 2026-11-03
Windows Server 2025, MSYS2 CLANG64 Clang 23.1.4, libc++ x86_64 ✅ 1394/1544 (150 skipped) ❌ 1683/1698 (13 baselined, 154 skipped, report-only) 2026-11-03
Windows Server 2025, MSYS2 UCRT64 Clang 23.1.4, libstdc++ x86_64 ✅ 1448/1544 (96 skipped) ❌ 1687/1698 (154 skipped, report-only) 2026-11-03
Windows Server 2025, MSYS2 UCRT64 GCC 16.2.0 x86_64 ✅ 1485/1544 (59 skipped) ❌ 1694/1698 (154 skipped, report-only) 2026-11-03
Windows Server 2025 clang-cl 22.1.3 x86_64 ✅ 1393/1544 (151 skipped) ❌ 1658/1679 (173 skipped, report-only) 2026-11-03
Windows Server 2025 MSVC 19.51.36260 x86_64 ✅ 1372/1544 (172 skipped) ❌ 1654/1679 (173 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 18.1.8, libc++ x86_64 ✅ 1325/1544 (219 skipped) ❌ 1658/1698 (17 baselined, 154 skipped, report-only) 2026-11-03
Ubuntu 24.04 Clang 22.1.8, libc++, hardened x86_64 ✅ 1405/1544 (139 skipped) - 2026-11-03
Windows Server 2025 MSVC 19.51.36260, hardened x86_64 ✅ 1380/1544 (164 skipped) - 2026-11-03

About

A hands-on reference for modern C++ (C++11 → C++26), from the basics to reflection, contracts and senders, plus guidelines for writing C++ well. Every snippet compiles and every claim is tested on GCC and Clang.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages