Skip to content
C++

Language Reference

Core C++ language features — 146 pages covering every standard from C++98 to C++26.

C++98
C++11
C++17
C++20
C++23
C++26

Core Fundamentals

Aggregate Initialization and Designated Initializers

Braced initialization for aggregates, designated initializers (C++20), inheritance aggregates (C++17), and the evolving rules for what counts as an aggregate.

C++98Basic
Arrays

Built-in arrays, std::array, decay, multidimensional layout, initialization rules, and modern replacements, with C++ standard versions noted.

Basic
auto

Type deduction keyword that deduces variable types from initializers, function returns, and parameters. Strips top-level const/references unless explicitly marked.

C++11Beginner
C++ Attributes

Standard attributes provide portable, compiler-understood annotations on declarations, statements, and expressions — [[nodiscard]], [[likely]], [[assume]], and more.

C++11Basic
Conflicting Declarations

Conflicting declarations arise when the same name is declared with incompatible types, linkage, or definitions, violating the One Definition Rule.

Intermediate
Converting Constructor

A constructor not declared explicit, enabling implicit conversions from its argument types to the class type during initialization and function calls.

C++98Intermediate
Copy Elision and NRVO

C++17 guarantees prvalue copy elision. NRVO elides named-local returns. Never std::move a local in return — it disables NRVO.

C++17Intermediate
Designated Initializers (C++20)

Named member initialization for aggregates — initialize exactly the fields you need, in declaration order, with safe defaults for the rest.

C++20Basic
Escape Sequences

Backslash-prefixed sequences in string and character literals that represent otherwise unrepresentable or syntactically ambiguous characters.

C++98Basic
Fundamental Types

Complete reference for C++ fundamental types — void, bool, character, integer, and floating-point types — including sizes, ranges, and standard guarantees.

Basic
Initialization in C++

C++ initialization taxonomy — value-init, default-init, zero-init, list-init, aggregate-init, and the rules that govern each form.

C++98Intermediate
Initializer Lists and Aggregate Initialization

std::initializer_list, brace initialization, aggregate init, designated initializers (C++20), narrowing rules, and constructor overload pitfalls.

C++11Intermediate
Inline Functions

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++98Basic
inline Variables (C++17)

"C++ inline variables: solving ODR for header-defined globals, inline static data members, constexpr implies inline, variable templates, and practical patterns."

C++17Basic
Move Semantics

Transfer resources from expiring objects instead of copying. Foundation of O(1) container operations, unique ownership, and efficient return values.

C++11Intermediate
ODR, Linkage, and Translation Units

One Definition Rule, internal vs external linkage, inline variables, static, anonymous namespaces, and header-only patterns in C++.

C++98Intermediate
Static Initialization Order

How C++ orders initialization and destruction of static-storage objects across translation units, the static initialization order fiasco, and the standard remedies.

Advanced
Static Members

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.

C++98Intermediate
Storage Duration

The four lifetime categories of object storage in C++ — automatic, static, dynamic, and thread — and what determines each.

Basic
String Literals and User-Defined Literals

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++11Basic
Structured Bindings

C++17 decomposition syntax that unpacks arrays, aggregates, pairs, and tuple-like types into named variables in a single declaration.

C++17Basic
Translation-Unit-Local Entities

Entities with internal linkage or no linkage, confined to a single translation unit and invisible to all others — preventing ODR violations and symbol leakage.

Intermediate
Type Deduction

How C++ deduces types for templates, auto, decltype, and decltype(auto) — the three deduction cases, reference collapsing, and pitfalls.

C++11Intermediate
User-Defined Literals

Define custom _suffix operators for strong types, units, and compile-time processing. Covers cooked vs raw forms, all operator signatures, and standard UDLs.

C++11Basic
Value Categories: lvalue, rvalue, xvalue

C++ value categories explained — lvalue, prvalue, xvalue, glvalue, rvalue, move semantics connection, decltype rules, and std::move vs std::forward.

C++11Intermediate

Types & Storage

OOP & Inheritance

Abstract Classes and Pure Virtual Functions

C++ abstract classes — pure virtual functions, NVI pattern, covariant return types, override/final, and virtual destructor semantics.

C++98Basic
Deducing This (C++23)

Explicit object parameter in C++23 — deduce the derived type in base methods, collapse ref-qualifier overloads, and write recursive lambdas cleanly.

C++23Intermediate
Default and Delete Functions

How = default and = delete control special member generation, overload resolution, and template instantiation in C++11 and later, with practical patterns.

C++11Intermediate
Empty Base Optimization

A compiler optimization that eliminates the storage overhead of empty base classes, enabling zero-cost policy-based design patterns in C++.

C++98Intermediate
explicit Constructors and Conversion Operators

C++ explicit keyword — preventing implicit conversions through constructors and conversion operators, plus conditional explicit(bool) in C++20.

C++98Basic
friend Functions and Classes

C++ friend declarations — friend functions, friend classes, hidden friends, templates, operator overloading, and when friendship is appropriate.

C++98Intermediate
Friend Functions and Friend Classes

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++98Basic
Implicit Conversions

C++ implicit conversions — standard conversion sequences, integral promotions, arithmetic conversions, narrowing, explicit constructors, and conversion operators.

C++98Intermediate
Inheritance and Class Hierarchies

C++ inheritance — single, multiple, virtual base classes, diamond problem, access specifiers, object slicing, and override/final semantics.

C++98Intermediate
Multiple Inheritance and Virtual Inheritance

C++ multiple inheritance — diamond problem, virtual base classes, construction order, dominant overriding, and MI best practices.

C++98Intermediate
New and Delete Operators

How new/delete expressions, operator new/delete allocation functions, placement and nothrow forms, class-specific overloads, and the new-handler work in C++.

Intermediate
Operator Overloading

Canonical forms, spaceship operator ordering categories, member vs free functions, conversion operators, and pitfalls that trip up experienced engineers.

C++98Intermediate
override and final

Contextual keywords override and final (C++11) let the compiler verify virtual function overrides and block further overriding or derivation.

C++11Basic
Rule of Five

If a class defines any one of its five special member functions, it should explicitly define all five to avoid resource management bugs.

C++11Intermediate
Special Member Functions

C++ special member function generation, suppression, and deletion rules — Rule of Zero, Rule of Five, =default, =delete, and every generation condition.

C++98Intermediate
Template Specialization

Full and partial specialization, explicit instantiation, specialization ordering, and when to prefer overloads — with C++ version discipline.

C++98Intermediate
Using Declaration

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++98Basic
Virtual Functions and Polymorphism

C++ virtual functions, vtables, dynamic dispatch, override, final, abstract classes, virtual destructors, and performance tradeoffs.

C++98Intermediate
Virtual Inheritance

Share a single base subobject across a diamond hierarchy with `virtual` bases: layout, construction order, casting costs, and pitfalls.

C++98Advanced

Templates & Generic

Address-Of Overload

Overloading unary operator& on class types, its hazards in generic code, and how std::addressof bypasses any overload to retrieve the true address.

C++98Advanced
C++11 Features

Complete reference for C++11 language and library features — the revision that modernised C++ from the ground up.

C++11Intermediate
C++14 Features

Overview of C++14 language and library additions: generic lambdas, variable templates, relaxed constexpr, return type deduction, and more.

C++14Basic
C++17 Feature Reference

Complete C++17 guide: structured bindings, if constexpr, fold expressions, std::optional, std::variant, std::string_view, CTAD, parallel algorithms, and filesystem.

C++17Basic
Class Template Argument Deduction (CTAD)

C++17 CTAD deduces class template arguments from constructors. Covers deduction guides, aggregate and alias template CTAD (C++20), and common pitfalls.

C++17Intermediate
Concepts — Advanced Usage

Advanced C++20 concepts: requires expressions, subsumption, concept composition, abbreviated templates, and constraint-driven API design.

C++20Advanced
Concepts (C++20)

C++20 concepts are named, composable boolean predicates on template parameters that replace SFINAE with readable constraints and precise error messages.

C++20Intermediate
Concepts and requires Expressions

C++20 concepts and requires expressions in depth — four requirement forms, concept definition, subsumption rules, and overload resolution.

C++20Intermediate
Constant Expressions

Expressions evaluated at compile time, enabling array bounds, template arguments, enum values, alignas, and zero-overhead constexpr abstractions.

C++98Intermediate
CRTP — Curiously Recurring Template Pattern

Static polymorphism, mixins, and compile-time interface enforcement via CRTP — zero virtual overhead, resolved entirely at compile time.

C++98Advanced
decltype

The decltype specifier queries the declared type of an entity or the exact type of an expression at compile time, without evaluation.

C++11Intermediate
Dependent Names

Names in a template whose meaning depends on a template parameter, subject to two-phase lookup and requiring typename or template disambiguation.

C++98Advanced
Elaborated Type Specifiers

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.

Intermediate
Fold Expressions (C++17)

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++17Intermediate
Function Overloading and Overload Resolution

"C++ overload resolution: candidate sets, conversion ranking, ADL, ref-qualifiers, deleted overloads, and concept constraints."

C++98Intermediate
Function Template

A parameterized function definition from which the compiler generates concrete functions for each unique set of template arguments, enabling type-generic programming.

C++98Intermediate
if constexpr (C++17)

"C++17 compile-time branching in templates: discards the non-taken branch entirely without instantiating it, replacing most SFINAE and tag-dispatch patterns."

C++17Basic
Injected Class Name

Inside a class body, the class name is implicitly injected as a member, providing unqualified access to the current type or instantiation.

C++98Intermediate
Overload Resolution

How the compiler selects the single best-matching function from a set of candidates for a given call, via conversion sequence ranking.

Advanced
Pack Indexing (C++26)

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.

C++26Intermediate
Partial Specialization

Provide an alternative class template implementation for a constrained subset of template arguments, leaving remaining parameters free.

C++98Intermediate
Phases of Translation

The nine sequential phases the C++ standard mandates to transform raw source text into a linked executable.

Intermediate
Preprocessor

C++ preprocessor — macros, include guards, conditional compilation,

Basic
Ranges (C++20)

"C++20's ranges library: constrained algorithms, lazy view pipelines, and composable adaptors that replace raw iterator-pair APIs."

C++20Intermediate
SFINAE and Concepts

Substitution Failure Is Not An Error — compile-time overload selection via enable_if, void_t, and the C++20 concepts that replace them.

C++11Advanced
Static Reflection (C++26)

P2996 static reflection: query type members and metadata at compile time via std::meta — enabling auto-serialization and zero-cost introspection without macros.

C++26Expert
static_assert and Compile-Time Checks

Compile-time assertions for type checking, configuration validation, template constraints, and platform assumptions — zero runtime overhead.

C++11Basic
template for

Compile-time expansion statement (C++26) that iterates over a parameter pack, instantiating the loop body once per element without recursive template machinery.

C++26Advanced
Templates

Compile-time code parameterization in C++. Function, class, variable, and alias templates; specialization; variadic packs; SFINAE vs C++20 concepts.

C++98Advanced
Templates — Advanced Techniques

Advanced C++ templates: SFINAE, concepts, type traits, specialization, CRTP, policy classes, variadic packs, and expression templates.

C++11Expert
Two-Phase Name Lookup

"C++ two-phase lookup: non-dependent names bind at definition, dependent names at instantiation — typename, template keyword, ADL, and base class pitfalls."

C++98Advanced
Type Aliases

"C++ type aliases: using declarations, typedef, alias templates, dependent type extraction, and pitfalls for working engineers."

C++98Basic
Variadic Arguments

C-style variadic functions using the ellipsis syntax and va_list macros, their type-safety pitfalls, and the modern C++ alternatives that replace them.

C++98Intermediate
Variadic Templates

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++11Intermediate
What's New in C++20

"C++20 complete reference: Concepts, Ranges, Coroutines, Modules, std::format, std::span, spaceship operator, consteval, jthread, and key STL additions."

C++20Basic

Modern C++ (C++11–17)

alignas

Controls the alignment requirement of a type or variable declaration, overriding the compiler's default to meet hardware, ABI, or concurrency constraints.

C++11Intermediate
C++ Memory Model and Atomics

C++ memory model — happens-before, memory orders, std::atomic operations, data races, and lock-free patterns. Deep reference for C++11 and beyond.

C++11Advanced
C++ Performance Optimization

Cache efficiency, branch prediction, SIMD, move semantics, PMR, profiling, and compiler flags — the full C++ performance toolkit.

C++11Advanced
Compile-Time Branching — Advanced

Advanced if constexpr patterns with concepts, consteval guards, SFINAE migration, and if consteval — plus the pitfalls that trip up experienced engineers.

C++17Intermediate
Const Correctness

Applying const to variables, references, pointers, and member functions to express and enforce immutability contracts throughout a C++ codebase.

C++98Intermediate
consteval and constinit

C++20 consteval forces compile-time function evaluation; constinit asserts static initialization without imposing const.

C++20Intermediate
constexpr / consteval / constinit

Compile-time computation in C++. constexpr permits compile-time evaluation; consteval mandates it; constinit ensures safe static initialization of globals.

C++11Intermediate
Enumerations

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++98Basic
Error Handling Strategies

C++ error handling — exceptions, std::expected, std::error_code, noexcept semantics, exception safety guarantees, and RAII-based cleanup.

C++98Intermediate
Exception handling

C++ exception handling — throw, try/catch, noexcept, exception safety guarantees, stack unwinding, and RAII-based resource safety.

C++98Intermediate
Exception Safety Guarantees

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.

C++98Intermediate
Exception Specifications and std::terminate

noexcept specifier and operator, when std::terminate fires, custom terminate handlers, stack unwinding guarantees, and cross-thread exception propagation.

C++11Intermediate
Function Pointers and Callables

Raw function pointers, member function pointers, std::function, std::invoke, and zero-cost template callbacks in modern C++.

C++98Intermediate
if/switch with Initializer (C++17)

if and switch init-statements scope-limit declarations to the conditional block, eliminating variable leakage and enabling tighter RAII guard lifetimes.

C++17Beginner
Lambda Advanced Features

C++ lambda advanced features — template lambdas, perfect forwarding, IIFE, recursive lambdas, overload pattern, constexpr, consteval, static lambdas, and C++23 additions.

C++14Intermediate
Lambda Expressions

Anonymous closures defined inline — syntactic sugar for a local struct with operator(). Core tool for callbacks, algorithms, and initialization patterns.

C++11Basic
Move Semantics — Advanced

Universal references, std::forward, reference collapsing, RVO/NRVO, Rule of Five, noexcept contracts, and the move pitfalls every C++ engineer must know.

C++11Advanced
mutable

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.

C++98Intermediate
noexcept — Exception Specifications

"noexcept specifier and operator: marking functions non-throwing, conditional noexcept, move semantics optimization, and type-system implications since C++17."

C++11Intermediate
nullptr

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.

C++11Basic
Numeric Limits and Fixed-Width Types

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++.

C++98Basic
Perfect Forwarding

Forwarding references and std::forward preserve the value category of arguments through template wrappers — enabling zero-overhead generic factories and emplace-style APIs.

C++11Intermediate
Range-Based for Loop

C++ range-based for — desugaring rules, sentinel support, custom iterators, C++17/20/23 extensions, and iterator-invalidation pitfalls.

C++11Basic
References

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.

C++98Basic
Stack Unwinding

How C++ destroys automatic objects while propagating an exception to a handler, the guarantees it gives, and when it is skipped or fatal.

C++98Intermediate
std::bit_cast and std::source_location (C++20)

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.

C++20Basic
Structured Bindings — Advanced

"Deep dive: the tuple protocol, custom type support, reference semantics, the hidden anonymous object, and C++26 binding packs."

C++17Intermediate

Modern C++ (C++20–26)

Bit Manipulation

Bitwise operators, std::bitset, and C++20's <bit> header — popcount, rotl, countl_zero, std::bit_cast, endianness detection, and portable bit tricks.

Basic
C++23 Features

"Complete C++23 guide: std::print, std::expected, deducing this, std::generator, std::mdspan, flat containers, ranges, import std, and more."

C++23Basic
Contracts (C++26)

C++26 contracts (P2900): [[pre:]], [[post:]], and contract_assert() — formal precondition and postcondition checking with configurable build modes and violation handlers.

C++26Intermediate
Coroutines (C++20)

C++20 coroutines — suspendable functions built on co_await, co_yield, and co_return with a low-level promise/awaitable customization framework.

C++20Advanced
Modules (C++20)

"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++20Intermediate
Spaceship Operator <=> (C++20)

C++20 three-way comparison operator — ordering categories, defaulted synthesis, heterogeneous comparison, and migrating legacy relational operators.

C++20Basic
std::execution — Senders/Receivers (C++26)

"P2300 std::execution: structured async with senders, receivers, schedulers, and composable operation chains targeting C++26."

C++26Expert
std::generator (C++23)

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.

C++23Intermediate
std::print and std::println (C++23)

Type-safe, Unicode-aware formatted output using std::format syntax. Direct FILE* and ostream writes with compile-time format string validation.

C++23Basic
What's New in C++26

"C++26 feature guide: static reflection, contracts, std::execution, std::simd, pack indexing, erroneous behaviour, and library additions including std::inplace_vector."

C++26Intermediate

Memory & Performance

Other

Argument-Dependent Lookup (ADL)

ADL (Koenig lookup) extends unqualified name lookup to include the namespaces of function argument types, enabling ergonomic operator and free-function design.

C++98Intermediate
C++ Casts

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.

C++98Intermediate
Default Arguments

Specify fallback values for trailing function parameters, letting callers omit those arguments when the defaults are appropriate.

C++98Basic
goto

Unconditional jump statement that transfers control to a labeled statement within the same function, respecting RAII destructor semantics.

C++98Basic
Language Linkage

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.

C++98Intermediate
Member Access

The operators and rules governing access to data members and member functions of class and struct types, including pointer-to-member syntax.

Intermediate
Name Lookup

How the C++ compiler associates every name in source code with the declaration that introduced it, before overload resolution begins.

Intermediate
Namespace Alias

Introduce an alternate name for a namespace to shorten deeply-nested paths or pin versioned namespaces to a stable local identifier.

Basic
Object Model

The rules governing how C++ programs create, represent, access, and destroy typed regions of storage, including layout, lifetime, and aliasing.

Advanced
Operator Precedence

Complete C++ operator precedence and associativity reference — all 17 levels with version annotations, pitfalls, and disambiguation techniques.

Basic
Pointers

Variables that store memory addresses, enabling indirection, dynamic allocation, and polymorphism across all C++ versions.

Basic
RTTI and dynamic_cast

Runtime type information in C++: dynamic_cast, typeid, std::type_info, their costs, failure modes, and when to prefer virtual dispatch or variants.

C++98Intermediate
Scope

How C++ scope rules govern name visibility, lookup order, and entity lifetime — from block and function scope to namespace and class scope.

Basic
Statements

Complete reference for all C++ statement categories — expression, compound, selection, iteration, jump, declaration, and try-blocks — with version-tagged features.

Basic
Unions and Anonymous Unions

C++ unions — memory layout, active member rules, type punning with bit_cast, anonymous unions, tagged unions, and std::variant.

C++98Intermediate
Usual Arithmetic Conversions

The implicit type coercion rules applied to both operands of binary arithmetic operators to yield a common result type.

Intermediate