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.

Pages in this section

Modern

Modules and Coroutines

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

Modern

Chrono and Formatting

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

Advanced

Concurrency

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

Modern

Advanced Ranges and Views

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

Modern

Modern Error Handling

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

Essentials

Core Syntax

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

Essentials

Control Flow

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

Core

Functions

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

Modern

Synchronization Primitives

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

Advanced

Templates and Generics

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

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.

Modern

C++20 and C++23 Highlights

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

Core

STL Containers

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

Core

Classes and OOP

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

Core

Memory and RAII

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

Workflow

Tooling and Testing

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