Cheat Sheets

Cheat Sheets

Quick-reference pages for modern C++ syntax, standard library usage, memory, templates, and more.

C++ Cheat Sheets

Use these pages as a rapid lookup set while coding.

Coverage

Suggested use

Pick one page for the concept you are using today, then jump into the tutorial section when you want fuller explanations and larger examples.

The newest pages emphasize the parts of modern C++ that are easy to miss in older references: std::expected, std::optional, std::variant, modules, coroutines, std::jthread, std::span, and modern formatting.

There are also focused quick references for chrono and formatting, advanced ranges and views, and synchronization primitives beyond std::mutex.

When you need broader coverage rather than a focused cheat sheet, use the full reference section.

Pages in this section

Core

Functions

Declarations, overloads, parameters, return types, and callable objects.

Modern

Modules and Coroutines

A fast reference to two major C++20 features that need deliberate adoption.

Essentials

Core Syntax

Variables, types, operators, expressions, and declarations at a glance.

Modern

Chrono and Formatting

Durations, clocks, time points, and modern text formatting in one quick reference.

Modern

Advanced Ranges and Views

Lazy pipelines, projections, and view-oriented design beyond basic filter/transform examples.

Advanced

Concurrency

Threads, mutexes, atomics, async work, and synchronization basics.

Modern

Modern Error Handling

Use optional, variant, expected, exceptions, and result-oriented APIs deliberately.

Core

Strings and I/O

String handling, streams, formatting, parsing, and common input/output patterns.

Advanced

Algorithms and Ranges

Searching, sorting, transforming, and filtering with the STL and modern ranges.

Essentials

Control Flow

Branching, loops, scope, and common flow-control patterns.

Core

STL Containers

When to use vectors, arrays, maps, sets, queues, and container adapters.

Workflow

Tooling and Testing

Compilation, warnings, sanitizers, formatting, static analysis, and test habits.

Core

Memory and RAII

Object lifetime, stack vs heap, smart pointers, and resource safety patterns.

Advanced

Templates and Generics

Function templates, class templates, constraints, and generic programming patterns.

Modern

C++20 and C++23 Highlights

Key modern language and library features worth adopting in current codebases.

Core

Classes and OOP

Classes, structs, access control, inheritance, virtual functions, and object design.

Modern

Synchronization Primitives

A quick guide to mutexes, shared locks, semaphores, latches, barriers, and coordination patterns.