Your Library
Appendix · C++ Glossary
Contents
Appendix

C++ Glossary

This glossary defines the working vocabulary used throughout A Tour of C++. Entries distinguish terms that are often used loosely or confused with one another.

A

Abstract type
A class with at least one pure virtual function. It specifies an interface and cannot be instantiated directly; use derived concrete classes through references or pointers.
any
A type-erased container for one copyable value of an arbitrary type, with the concrete type checked at retrieval. Prefer a more explicit type such as std::variant when the alternatives are known.
Atomic type
A type such as std::atomic<T> that provides atomic operations on an object and participates in inter-thread synchronization. Atomic access to one object does not automatically make a larger operation or surrounding data structure thread-safe.

C

Class hierarchy
A family of classes related by derivation. Virtual functions support runtime dispatch through a base-class interface; dynamic_cast can perform checked runtime conversions in appropriate polymorphic hierarchies.
Concept
A compile-time predicate that names requirements on template arguments. Concepts constrain declarations and help select overloads; they are not runtime interfaces.
Container
An object whose primary purpose is to hold a sequence or collection of elements, such as std::vector, std::list, or std::map. Containers manage their elements and provide operations for traversal and modification.
CTAD
Class template argument deduction: deducing a class template’s arguments from initialization, as in std::pair p{1, 2.0}.
constexpr and consteval
constexpr permits an entity or function to participate in constant evaluation when its use and inputs allow it; consteval requires an immediate invocation to be evaluated at compile time. const instead means an object cannot be modified through that name after initialization.
Condition variable
A synchronization mechanism for waiting until shared state may satisfy a condition. Wait with a predicate because wakeups can occur without the condition becoming true.
Concrete type
A type whose objects can be created directly and whose values have a usable representation. A concrete class can provide value-like behavior, as std::complex and std::vector do.
Coroutine
A function that can suspend and resume while retaining state, using constructs such as co_await and co_yield. Coroutines provide a language mechanism; scheduling and asynchronous behavior depend on the coroutine’s supporting library and program.

D

Data race
Conflicting concurrent accesses to the same memory location, at least one of which is a write, with neither access ordered by synchronization. A data race is undefined behavior. A race condition is a broader class of timing-dependent bugs and does not necessarily involve a data race.
dynamic_cast
A runtime-checked conversion used in polymorphic class hierarchies. For pointer casts it yields null on failure; for reference casts it throws std::bad_cast.
Declaration
A program construct that introduces or refers to a name and describes its type or other properties. A declaration need not provide the entity’s full definition.
Definition
A declaration that provides the entity’s implementation or, for an object, its storage. Some entities may have multiple declarations but only one definition where required by the language rules.
Dangling pointer, reference, or view
A pointer, reference, iterator, or non-owning view that refers to an object or storage whose lifetime has ended or whose location is no longer valid. Accessing it is generally undefined behavior.

E

Exception
A value thrown to transfer control from the point where a failure is detected to a handler. Stack unwinding destroys automatic objects in exited scopes, enabling RAII cleanup.
Essential operations
The destructor, copy constructor, copy assignment operator, move constructor, and move assignment operator—the special member functions that govern object cleanup and copying or moving.
Extent
The range or amount covered by an object or sequence. For object lifetime, it refers to the period during which the object exists; distinguish this from scope, which is a region of program text.

F

Fold expression
A C++17 expression that applies an operator across a parameter pack, such as (args + ...).
Free store
The region of dynamically allocated storage managed through allocation functions such as new and delete. “Heap” can be ambiguous because it also names a data structure.
Function overloading
Declaring multiple functions with the same name but different parameter lists. Overload resolution selects the best viable candidate or reports ambiguity.
Future and promise
A one-shot communication pair: a std::promise supplies a value or exception, and its associated std::future lets another part of the program retrieve the result.

H

Half-open range
A range written [first, last) that includes first and excludes last. It is empty when the endpoints are equal; algorithms commonly return last to indicate that a search found no match.

I

Invariant
A condition that must remain true for an object or system to be considered valid. A class’s constructors establish its invariants, and its operations preserve them.
Instantiation
The creation of a concrete specialization from a template and its arguments during compilation. Do not confuse template instantiation with creating a runtime object.
Iterator
An object that identifies an element in a sequence and supports traversal according to an iterator concept. Standard algorithms commonly operate on iterator ranges rather than directly on containers.

J

jthread
A C++20 thread type that requests cooperative stop and joins automatically when destroyed. The function running on it must observe and respond to a stop request if cancellation is needed.

L

Lambda expression
An inline expression that creates a function object, optionally capturing variables from its surrounding scope. The closure type is unique and compiler-generated.
Lifetime
The period during which an object exists and may be used, from its creation to its destruction. Lifetime is temporal; scope is textual.

M

Module
A C++20 language facility for organizing declarations and translation units using module interfaces and import, rather than relying solely on textual inclusion. Compiler and library support depends on the toolchain.
Move semantics
Operations that can transfer resources from an object, commonly when the source is an expiring value, instead of copying those resources. std::move itself only casts an expression to an rvalue; the selected operation determines what happens.
Moved-from state
The state of an object after a move operation. It is valid but may be unspecified unless the type promises more; only perform operations allowed by that type’s guarantees, commonly destruction or assignment.
Mutex and scoped lock
A mutex provides mutual exclusion for protected shared state. A scoped lock such as std::lock_guard or std::scoped_lock acquires a mutex and releases it automatically at scope exit.

N

Namespace
A named scope that groups declarations and helps avoid name collisions. std is the namespace containing standard-library declarations. A namespace is not a module or package.
Narrowing conversion
A conversion that may lose information, such as converting a floating-point value to an integer. List-initialization rejects many narrowing conversions that assignment-style initialization permits.
noexcept
A function specification indicating that exceptions are not permitted to escape the function. If an exception does escape a non-throwing function, std::terminate is invoked.

O

optional
A wrapper that holds either a value of type T or no value. Check whether it contains a value before accessing it.
Object
A region of storage with a type and lifetime that can contain a value. “Variable” is often used informally but is not a precise synonym for every object.
Operator overloading
Defining how an existing operator works with user-defined types. Operators should retain conventional expectations; C++ does not allow programs to invent new operator tokens.

P

Parameter pack
A template parameter pack or function parameter pack representing zero or more arguments. It can be expanded in a context that supports pack expansion, such as a fold expression or a forwarding call.
Perfect forwarding
Passing a deduced argument onward while preserving whether it was an lvalue or rvalue. It commonly uses a forwarding reference parameter and std::forward<T>.
Pointer
An object that can hold the address of another object or function. A pointer can be null and can be reassigned; it does not by itself express ownership or lifetime.
std::pair and std::tuple
Standard-library types that group a fixed number of values, possibly of different types. Prefer a named class when the fields have meaningful domain-specific names.
Predicate
A callable used to answer a yes-or-no question, usually returning a value usable as bool. Algorithms such as std::find_if accept predicates to customize their behavior.

R

RAII
Resource Acquisition Is Initialization: bind a resource’s lifetime to an object’s lifetime, typically acquiring it in a constructor and releasing it in a destructor. Scope exit, including exception unwinding, then performs cleanup automatically.
Range-based for
A loop that traverses the elements of a range without manually managing its iterator and end condition. The range must provide the required begin and end operations.
Range
A sequence that can be traversed, commonly described by a begin iterator and an end iterator or sentinel. C++20 range algorithms accept suitable ranges directly, and range views can compose lazy operations.
Reference
An alias bound to an existing object. A reference is not reseated after initialization and is not a nullable ownership handle; it differs from a pointer.
Regular type
A type that behaves in broadly value-like ways, with operations such as construction, assignment, and equality that meet regularity requirements. Exact formal requirements are expressed by concepts such as std::regular.
Rule of Zero
A design principle: when members already manage their own resources, do not define special member functions just to manage those members again. Let member types provide correct copying, moving, and destruction.
Requires-expression
A compile-time expression that checks whether listed expressions and types are valid. It can define a concept; a requires-clause instead constrains a template or function declaration.
Rvalue reference
A reference type written T&&. In a deduced template context, T&& may be a forwarding reference; otherwise it is an rvalue reference. Rvalue references support move operations and perfect forwarding.

S

std::async
A standard-library facility that starts or defers a task according to its launch policy and returns a future for the result. Specify a launch policy when the choice between deferred and asynchronous execution matters.
Scope
The region of source code in which a name can be used. Scope is lexical; it is not the lifetime of an object with that name.
Sentinel
An end marker for a range that need not have the same type as its iterator. An iterator and sentinel need only support the comparisons required to determine when traversal ends.
Separate compilation
Compiling program components independently and combining them through linking. C++ uses translation units, headers, and increasingly modules to support this organization.
shared_ptr
A smart pointer that shares ownership using a control block; the object is destroyed when its last shared owner is released. Use it when shared ownership is part of the design, not merely to avoid choosing an owner.
Sized integer type
A fixed-width integer type, when provided by the implementation, such as std::int32_t or std::uint64_t from <cstdint>. Built-in types such as int and long do not have one universal width across platforms.
Special member functions
The destructor, copy constructor, copy assignment operator, move constructor, and move assignment operator. Their implicit generation and interactions follow related language rules; the Rule of Zero avoids declaring them when member types suffice.
span
A non-owning view over a contiguous sequence, carrying a pointer and a size. It is useful for function parameters that would otherwise pass a pointer and element count separately.
Stream
A typed I/O abstraction that converts between values and character sequences and maintains state. Standard streams include std::cin, std::cout, and std::cerr; file streams provide file I/O.
string_view
A non-owning, read-only view over a character sequence. It is cheap to copy, but does not extend the lifetime of the characters it refers to.
Template
A class, function, variable, or alias parameterized by types, values, or other templates. Template specializations are instantiated as needed during compilation; this is distinct from creating a runtime object.
Task
A unit of computation that may be scheduled to run concurrently. A task describes work; a thread is one possible execution resource for that work.
Thread
An execution of a program that can run concurrently with other threads in a shared address space. Threads are one way to execute work; task abstractions may provide a more suitable level of organization.
Time point
A point on a clock’s timeline. Subtracting two compatible time points produces a duration; adding a duration shifts a time point.
Translation unit
The source unit presented to the compiler after preprocessing, traditionally formed from a source file and included headers. Translation units are compiled separately before linking.
Type
A set of values and the operations permitted on them, with rules that determine representation and behavior.
Type erasure
A technique that hides a concrete type behind a uniform interface. std::function, for example, can store different compatible callable types behind one signature, with possible runtime and allocation costs.
Type trait
A compile-time library facility for querying or transforming types. The _v form commonly exposes a value, while the _t form names a resulting type.
Type generator
A type trait that produces a type from input types or values, such as std::conditional_t or std::remove_reference_t.
Type predicate
A compile-time type trait whose result is a Boolean value, such as std::is_integral_v<T>. A concept can express a named requirement using predicates and other constraints.
Type function
A compile-time operation that examines types or computes a type or value from them. Standard type traits use _v for variable-template Boolean/value forms and _t for type aliases.

U

Undefined behavior
Behavior for which the C++ standard imposes no requirements. Once a program has undefined behavior, its result cannot be relied upon; common causes include data races and using invalid pointers.
union
A class-like type whose non-static data members share storage. At most one member is active at a time, so code must respect the active-member and object-lifetime rules.
unique_ptr
A move-only smart pointer that provides sole ownership of a dynamically allocated object and destroys it when the owner is destroyed. Prefer std::make_unique for construction.
User-defined type
A type introduced by a program, commonly a class, enumeration, or union, rather than a built-in type.
User-defined literal
A literal with a user-defined suffix that invokes a literal operator to produce a value of a chosen type, such as a quantity or complex-number type.

V

Value category
A classification of an expression that affects overload resolution and binding. The key categories for everyday move and forwarding discussions are lvalues and rvalues.
Value semantics
Using objects as values: copying or assigning produces values that behave independently according to the type’s contract. This is the familiar model of built-in numbers and standard value types.
variant
A type-safe object that holds one value from a fixed set of alternative types. std::visit provides type-based dispatch over the active alternative.
Variadic template
A template that accepts a variable number of template or function arguments using parameter packs. This is separate from C-style variadic functions and their less type-safe ... arguments.
View
A lightweight range abstraction that typically refers to or lazily transforms other data rather than owning a separate copy. A view’s validity may depend on the lifetime and invalidation rules of its underlying range.

W

weak_ptr
A non-owning observer of an object managed by std::shared_ptr. Calling lock() attempts to obtain a temporary shared owner; weak pointers can also break shared-ownership cycles.

Search terms and definitions