Language Reference
Core C++ language features — 146 pages covering every standard from C++98 to C++26.
Core Fundamentals
Braced initialization for aggregates, designated initializers (C++20), inheritance aggregates (C++17), and the evolving rules for what counts as an aggregate.
Built-in arrays, std::array, decay, multidimensional layout, initialization rules, and modern replacements, with C++ standard versions noted.
Type deduction keyword that deduces variable types from initializers, function returns, and parameters. Strips top-level const/references unless explicitly marked.
Standard attributes provide portable, compiler-understood annotations on declarations, statements, and expressions — [[nodiscard]], [[likely]], [[assume]], and more.
Conflicting declarations arise when the same name is declared with incompatible types, linkage, or definitions, violating the One Definition Rule.
A constructor not declared explicit, enabling implicit conversions from its argument types to the class type during initialization and function calls.
C++17 guarantees prvalue copy elision. NRVO elides named-local returns. Never std::move a local in return — it disables NRVO.
Named member initialization for aggregates — initialize exactly the fields you need, in declaration order, with safe defaults for the rest.
Backslash-prefixed sequences in string and character literals that represent otherwise unrepresentable or syntactically ambiguous characters.
Complete reference for C++ fundamental types — void, bool, character, integer, and floating-point types — including sizes, ranges, and standard guarantees.
C++ initialization taxonomy — value-init, default-init, zero-init, list-init, aggregate-init, and the rules that govern each form.
std::initializer_list, brace initialization, aggregate init, designated initializers (C++20), narrowing rules, and constructor overload pitfalls.
Inline functions may be defined identically across translation units and hint to the compiler to expand their body at each call site instead of using the normal call mechanism.
"C++ inline variables: solving ODR for header-defined globals, inline static data members, constexpr implies inline, variable templates, and practical patterns."
Transfer resources from expiring objects instead of copying. Foundation of O(1) container operations, unique ownership, and efficient return values.
One Definition Rule, internal vs external linkage, inline variables, static, anonymous namespaces, and header-only patterns in C++.
How C++ orders initialization and destruction of static-storage objects across translation units, the static initialization order fiasco, and the standard remedies.
Static data members and static member functions belong to the class type itself, not to any instance, and are shared across all objects of that class.
The four lifetime categories of object storage in C++ — automatic, static, dynamic, and thread — and what determines each.
Raw strings, Unicode prefix variants, standard-library UDL suffixes, and custom operator literal — with precise C++ version coverage from C++11 through C++23.
C++17 decomposition syntax that unpacks arrays, aggregates, pairs, and tuple-like types into named variables in a single declaration.
Entities with internal linkage or no linkage, confined to a single translation unit and invisible to all others — preventing ODR violations and symbol leakage.
How C++ deduces types for templates, auto, decltype, and decltype(auto) — the three deduction cases, reference collapsing, and pitfalls.
Define custom _suffix operators for strong types, units, and compile-time processing. Covers cooked vs raw forms, all operator signatures, and standard UDLs.
C++ value categories explained — lvalue, prvalue, xvalue, glvalue, rvalue, move semantics connection, decltype rules, and std::move vs std::forward.
Types & Storage
The compiler may transform code in any way that preserves the observable behavior of the abstract machine, enabling aggressive optimization.
"C++ bit fields: allocation rules, signed semantics, implementation-defined behavior, volatile MMIO patterns, and portable alternatives for systems programming."
A class template defines a parameterized family of classes, enabling type-safe generic data structures and algorithms without code duplication.
C++ namespaces — declarations, nesting, using directives, ADL, anonymous namespaces, inline namespaces for versioning, and namespace aliases.
"C++ variadic templates: parameter packs, fold expressions, index_sequence, pack indexing, and compile-time iteration patterns."
sizeof returns byte sizes, alignof queries alignment requirements, alignas enforces alignment — the toolkit for precise memory layout control in C++.
Variable templates parameterize a variable by type or value — powering _v trait shortcuts, mathematical constants, and type-safe compile-time lookups.
volatile prevents the compiler from caching or eliding accesses to memory that changes outside program control — essential for MMIO, not a substitute for std::atomic.
OOP & Inheritance
C++ abstract classes — pure virtual functions, NVI pattern, covariant return types, override/final, and virtual destructor semantics.
Explicit object parameter in C++23 — deduce the derived type in base methods, collapse ref-qualifier overloads, and write recursive lambdas cleanly.
How = default and = delete control special member generation, overload resolution, and template instantiation in C++11 and later, with practical patterns.
A compiler optimization that eliminates the storage overhead of empty base classes, enabling zero-cost policy-based design patterns in C++.
C++ explicit keyword — preventing implicit conversions through constructors and conversion operators, plus conditional explicit(bool) in C++20.
C++ friend declarations — friend functions, friend classes, hidden friends, templates, operator overloading, and when friendship is appropriate.
Friend declarations grant non-member functions or other classes access to a class's private and protected members — the canonical use is operator overloading and hidden-friend idiom.
C++ implicit conversions — standard conversion sequences, integral promotions, arithmetic conversions, narrowing, explicit constructors, and conversion operators.
C++ inheritance — single, multiple, virtual base classes, diamond problem, access specifiers, object slicing, and override/final semantics.
C++ multiple inheritance — diamond problem, virtual base classes, construction order, dominant overriding, and MI best practices.
How new/delete expressions, operator new/delete allocation functions, placement and nothrow forms, class-specific overloads, and the new-handler work in C++.
Canonical forms, spaceship operator ordering categories, member vs free functions, conversion operators, and pitfalls that trip up experienced engineers.
Contextual keywords override and final (C++11) let the compiler verify virtual function overrides and block further overriding or derivation.
If a class defines any one of its five special member functions, it should explicitly define all five to avoid resource management bugs.
C++ special member function generation, suppression, and deletion rules — Rule of Zero, Rule of Five, =default, =delete, and every generation condition.
Full and partial specialization, explicit instantiation, specialization ordering, and when to prefer overloads — with C++ version discipline.
Brings a single name from a namespace or base class into the current scope, giving precise control over which names are visible and accessible.
C++ virtual functions, vtables, dynamic dispatch, override, final, abstract classes, virtual destructors, and performance tradeoffs.
Share a single base subobject across a diamond hierarchy with `virtual` bases: layout, construction order, casting costs, and pitfalls.
Templates & Generic
Overloading unary operator& on class types, its hazards in generic code, and how std::addressof bypasses any overload to retrieve the true address.
Complete reference for C++11 language and library features — the revision that modernised C++ from the ground up.
Overview of C++14 language and library additions: generic lambdas, variable templates, relaxed constexpr, return type deduction, and more.
Complete C++17 guide: structured bindings, if constexpr, fold expressions, std::optional, std::variant, std::string_view, CTAD, parallel algorithms, and filesystem.
C++17 CTAD deduces class template arguments from constructors. Covers deduction guides, aggregate and alias template CTAD (C++20), and common pitfalls.
Advanced C++20 concepts: requires expressions, subsumption, concept composition, abbreviated templates, and constraint-driven API design.
C++20 concepts are named, composable boolean predicates on template parameters that replace SFINAE with readable constraints and precise error messages.
C++20 concepts and requires expressions in depth — four requirement forms, concept definition, subsumption rules, and overload resolution.
Expressions evaluated at compile time, enabling array bounds, template arguments, enum values, alignas, and zero-overhead constexpr abstractions.
Static polymorphism, mixins, and compile-time interface enforcement via CRTP — zero virtual overhead, resolved entirely at compile time.
The decltype specifier queries the declared type of an entity or the exact type of an expression at compile time, without evaluation.
Names in a template whose meaning depends on a template parameter, subject to two-phase lookup and requiring typename or template disambiguation.
A class-key or enum keyword prefix that disambiguates a type name from other names in scope, enables forward declarations, and resolves lookup in complex contexts.
C++17 fold expressions reduce parameter packs with a binary operator — all four fold forms, empty-pack rules, practical patterns, type-checking, and the overload visitor trick.
"C++ overload resolution: candidate sets, conversion ranking, ADL, ref-qualifiers, deleted overloads, and concept constraints."
A parameterized function definition from which the compiler generates concrete functions for each unique set of template arguments, enabling type-generic programming.
"C++17 compile-time branching in templates: discards the non-taken branch entirely without instantiating it, replacing most SFINAE and tag-dispatch patterns."
Inside a class body, the class name is implicitly injected as a member, providing unqualified access to the current type or instantiation.
How the compiler selects the single best-matching function from a set of candidates for a given call, via conversion sequence ranking.
C++26 pack indexing (P2662): access individual elements of parameter packs with pack...[N] — no more recursive TMP or std::tuple_element to grab the Nth type or value from a variadic pack.
Provide an alternative class template implementation for a constrained subset of template arguments, leaving remaining parameters free.
The nine sequential phases the C++ standard mandates to transform raw source text into a linked executable.
C++ preprocessor — macros, include guards, conditional compilation,
"C++20's ranges library: constrained algorithms, lazy view pipelines, and composable adaptors that replace raw iterator-pair APIs."
Substitution Failure Is Not An Error — compile-time overload selection via enable_if, void_t, and the C++20 concepts that replace them.
P2996 static reflection: query type members and metadata at compile time via std::meta — enabling auto-serialization and zero-cost introspection without macros.
Compile-time assertions for type checking, configuration validation, template constraints, and platform assumptions — zero runtime overhead.
Compile-time expansion statement (C++26) that iterates over a parameter pack, instantiating the loop body once per element without recursive template machinery.
Compile-time code parameterization in C++. Function, class, variable, and alias templates; specialization; variadic packs; SFINAE vs C++20 concepts.
Advanced C++ templates: SFINAE, concepts, type traits, specialization, CRTP, policy classes, variadic packs, and expression templates.
"C++ two-phase lookup: non-dependent names bind at definition, dependent names at instantiation — typename, template keyword, ADL, and base class pitfalls."
"C++ type aliases: using declarations, typedef, alias templates, dependent type extraction, and pitfalls for working engineers."
C-style variadic functions using the ellipsis syntax and va_list macros, their type-safety pitfalls, and the modern C++ alternatives that replace them.
Variadic templates accept any number of type arguments via parameter packs. Used in tuple, make_unique, std::visit, and any generic factory or forwarding wrapper.
"C++20 complete reference: Concepts, Ranges, Coroutines, Modules, std::format, std::span, spaceship operator, consteval, jthread, and key STL additions."
Modern C++ (C++11–17)
Controls the alignment requirement of a type or variable declaration, overriding the compiler's default to meet hardware, ABI, or concurrency constraints.
C++ memory model — happens-before, memory orders, std::atomic operations, data races, and lock-free patterns. Deep reference for C++11 and beyond.
Cache efficiency, branch prediction, SIMD, move semantics, PMR, profiling, and compiler flags — the full C++ performance toolkit.
Advanced if constexpr patterns with concepts, consteval guards, SFINAE migration, and if consteval — plus the pitfalls that trip up experienced engineers.
Applying const to variables, references, pointers, and member functions to express and enforce immutability contracts throughout a C++ codebase.
C++20 consteval forces compile-time function evaluation; constinit asserts static initialization without imposing const.
Compile-time computation in C++. constexpr permits compile-time evaluation; consteval mandates it; constinit ensures safe static initialization of globals.
C++ enum and enum class — scoped vs unscoped, underlying types, bitmask flags, enum-to-string, std::to_underlying, using enum (C++20), forward declarations, and zero-value pitfalls.
C++ error handling — exceptions, std::expected, std::error_code, noexcept semantics, exception safety guarantees, and RAII-based cleanup.
C++ exception handling — throw, try/catch, noexcept, exception safety guarantees, stack unwinding, and RAII-based resource safety.
C++ exception safety levels — no-throw, strong, basic, and none — and techniques for writing exception-safe code using RAII, copy-and-swap, noexcept, and std::move_if_noexcept.
noexcept specifier and operator, when std::terminate fires, custom terminate handlers, stack unwinding guarantees, and cross-thread exception propagation.
Raw function pointers, member function pointers, std::function, std::invoke, and zero-cost template callbacks in modern C++.
if and switch init-statements scope-limit declarations to the conditional block, eliminating variable leakage and enabling tighter RAII guard lifetimes.
C++ lambda advanced features — template lambdas, perfect forwarding, IIFE, recursive lambdas, overload pattern, constexpr, consteval, static lambdas, and C++23 additions.
Anonymous closures defined inline — syntactic sugar for a local struct with operator(). Core tool for callbacks, algorithms, and initialization patterns.
Universal references, std::forward, reference collapsing, RVO/NRVO, Rule of Five, noexcept contracts, and the move pitfalls every C++ engineer must know.
The mutable specifier lets a non-static data member be modified inside const member functions and const objects, enabling logical constness for caches, locks and counters.
"noexcept specifier and operator: marking functions non-throwing, conditional noexcept, move semantics optimization, and type-system implications since C++17."
The null pointer literal introduced in C++11, typed as std::nullptr_t, that replaces NULL and 0 in pointer contexts with full type safety.
std::numeric_limits for compile-time type properties, <cstdint> fixed-width integers, std::numbers math constants, epsilon/ULP arithmetic, and safe overflow detection in C++.
Forwarding references and std::forward preserve the value category of arguments through template wrappers — enabling zero-overhead generic factories and emplace-style APIs.
C++ range-based for — desugaring rules, sentinel support, custom iterators, C++17/20/23 extensions, and iterator-invalidation pitfalls.
A reference is an alias for an existing object; C++ provides lvalue references (C++98) and rvalue references (C++11) with distinct binding and lifetime rules.
How C++ destroys automatic objects while propagating an exception to a handler, the guarantees it gives, and when it is skipped or fatal.
Type-safe bit reinterpretation with std::bit_cast and compile-time call-site capture with std::source_location — replacing reinterpret_cast punning and preprocessor logging macros.
"Deep dive: the tuple protocol, custom type support, reference semantics, the hidden anonymous object, and C++26 binding packs."
Modern C++ (C++20–26)
Bitwise operators, std::bitset, and C++20's <bit> header — popcount, rotl, countl_zero, std::bit_cast, endianness detection, and portable bit tricks.
"Complete C++23 guide: std::print, std::expected, deducing this, std::generator, std::mdspan, flat containers, ranges, import std, and more."
C++26 contracts (P2900): [[pre:]], [[post:]], and contract_assert() — formal precondition and postcondition checking with configurable build modes and violation handlers.
C++20 coroutines — suspendable functions built on co_await, co_yield, and co_return with a low-level promise/awaitable customization framework.
"C++20 modules replace preprocessor-based #include with a compile-once binary interface model: no macro leakage, no include-order bugs, dramatically faster builds."
C++20 three-way comparison operator — ordering categories, defaulted synthesis, heterogeneous comparison, and migrating legacy relational operators.
"P2300 std::execution: structured async with senders, receivers, schedulers, and composable operation chains targeting C++26."
C++23 std::generator produces lazy, pull-based sequences via co_yield. Models input_range — compose with views, use recursive elements_of, yield by reference.
Type-safe, Unicode-aware formatted output using std::format syntax. Direct FILE* and ostream writes with compile-time format string validation.
"C++26 feature guide: static reflection, contracts, std::execution, std::simd, pack indexing, erroneous behaviour, and library additions including std::inplace_vector."
Memory & Performance
Rules governing when operands, subexpressions, and side effects are evaluated within a C++ expression, and which orderings produce undefined behavior.
How C++ defines when objects begin and end their lives: storage duration, initialization, destruction order, temporaries, lifetime extension, and dangling references.
The rule that restricts which lvalue types may access an object, enabling type-based alias analysis, and the safe alternatives to type punning.
How C++ temporaries are created, when they are destroyed, how lifetime extension works, and the dangling-reference traps that follow from the rules.
Reinterpreting the raw bit pattern of one type as another—from UB-laden union tricks to the safe std::bit_cast in C++20.
C++ undefined behavior — what it is, how compilers exploit it, the most dangerous forms, and how to detect and eliminate it.
Other
ADL (Koenig lookup) extends unqualified name lookup to include the namespaces of function argument types, enabling ergonomic operator and free-function design.
C++ cast operators — static_cast, dynamic_cast, const_cast, reinterpret_cast, std::bit_cast — what each does, when to use it, and what can go wrong.
Specify fallback values for trailing function parameters, letting callers omit those arguments when the defaults are appropriate.
Unconditional jump statement that transfers control to a labeled statement within the same function, respecting RAII destructor semantics.
Controls how a symbol's name is encoded in the object file and which calling conventions apply, enabling C++ code to interoperate with C and other languages.
The operators and rules governing access to data members and member functions of class and struct types, including pointer-to-member syntax.
How the C++ compiler associates every name in source code with the declaration that introduced it, before overload resolution begins.
Introduce an alternate name for a namespace to shorten deeply-nested paths or pin versioned namespaces to a stable local identifier.
The rules governing how C++ programs create, represent, access, and destroy typed regions of storage, including layout, lifetime, and aliasing.
Complete C++ operator precedence and associativity reference — all 17 levels with version annotations, pitfalls, and disambiguation techniques.
Variables that store memory addresses, enabling indirection, dynamic allocation, and polymorphism across all C++ versions.
Runtime type information in C++: dynamic_cast, typeid, std::type_info, their costs, failure modes, and when to prefer virtual dispatch or variants.
How C++ scope rules govern name visibility, lookup order, and entity lifetime — from block and function scope to namespace and class scope.
Complete reference for all C++ statement categories — expression, compound, selection, iteration, jump, declaration, and try-blocks — with version-tagged features.
C++ unions — memory layout, active member rules, type punning with bit_cast, anonymous unions, tagged unions, and std::variant.
The implicit type coercion rules applied to both operands of binary arithmetic operators to yield a common result type.