Skip to content
binshelf/ cpp

Search lessons

Type a C++ term, like vector, reference, unique_ptr or use-after-free.

    Reference

    Glossary

    Every term the lessons define, A to Z: 473 terms from 50 lessons. Each links to the lesson that explains it.

    Symbols

    ->
    Reaches a field through a pointer: p->length means (*p).length. In 2.3 Pointers.
    -ffast-math
    A flag that lets the compiler treat floating-point math as exact: reorder additions, and assume there are no NaN or infinity values. Faster, but results can change. In 9.4 SIMD.
    -Werror
    A flag that turns every warning into an error, so the build fails until you fix it. In 0.2 Setting up: compilers, warnings and sanitizers.
    -Wswitch
    The warning (part of -Wall) for a switch over an enum that misses an enumerator and has no default. In 4.5 enum class.
    .at(i)
    Element access that checks the index and throws std::out_of_range if it's out of bounds. In 2.4 Arrays, std::array and std::span.
    ""s and ""sv
    Suffixes that make a string literal a std::string ("ACGT"s) or a std::string_view ("ACGT"sv). They need using namespace std::literals;. In 3.1 string and string_view.
    [[fallthrough]]
    An attribute, a note to the compiler, that says falling into the next case is on purpose. In 1.4 Control flow.
    [[no_unique_address]]
    An attribute that lets a member of an empty type take no bytes in its struct. In 9.1 Layout, alignment and padding.
    [[nodiscard]]
    An attribute that makes the compiler warn when a caller ignores the function's return value. In 1.5 Functions.
    *opt, value() and value_or(x)
    Ways to get an optional's value. *opt doesn't check (undefined behavior when empty), value() throws std::bad_optional_access when empty, and value_or(x) returns x instead. In 3.4 optional, variant and tuple.
    #define
    Tells the preprocessor to replace a name with some text everywhere after that line. In 0.1 How a C++ program is built.
    #include
    Tells the preprocessor to paste in the contents of another file, usually a header. In 0.1 How a C++ program is built.
    % (remainder)
    What's left over after integer division. 7 % 3 is 1. In 1.2 Integers and floating-point numbers.
    << and >> on streams
    std::cout << x writes x to the stream; std::cin >> x reads a value from the stream into x. In 1.6 Printing and reading: std::print, std::format and streams.
    = default and = delete
    Written instead of a function body: = default asks the compiler to write the function member by member; = delete forbids it, so code that calls it doesn't compile. In 4.3 Copy and move.
    2-bit encoding
    Storing each base as a 2-bit code: A = 00, C = 01, G = 10, T = 11. A std::uint64_t holds 32 bases. In 12.2 2-bit DNA and k-mers.

    A

    abbreviated function template
    A function with auto parameters, like void report(const auto& x). Each auto is a template parameter of its own. In 6.1 Function templates.
    access specifier
    public: or private: inside a struct or class. Members after public: can be used by any code; members after private:, only by the type's own member functions. In 4.1 Structs and classes.
    address
    The number of a byte in memory. Every object starts at some address. In 2.1 Stack, heap and lifetime.
    address-of (&x)
    The operator that gives the address of x. Written before a value, not after a type. In 2.3 Pointers.
    AddressSanitizer (ASan)
    The sanitizer for memory mistakes, such as using memory after it's freed. It includes LeakSanitizer, which reports memory that's never freed. In 0.2 Setting up: compilers, warnings and sanitizers.
    aggregate initialization
    Creating a plain struct by listing its members' values in braces, in the order they're declared: Read r{"r1", "ACGT", 30};. In 4.1 Structs and classes.
    alias template
    A type alias with template parameters: template <std::size_t N> using FloatVec = Vec<float, N>;. In 6.2 Class templates.
    alignas(N)
    Asks for an alignment of at least N bytes for a type or a variable. N must be a power of 2. In 9.1 Layout, alignment and padding.
    alignment
    Where a value sits inside its width: < left, > right, ^ centered. In 1.6 Printing and reading: std::print, std::format and streams, 12.3 Sequence alignment.
    alignment (alignof(T))
    The number every address of a T must be a multiple of. alignof(double) is 8 on this platform, so a double starts at a multiple of 8. In 9.1 Layout, alignment and padding.
    ambiguous call
    A call where two overloads fit equally well, so the compiler can't choose and stops with an error. In 1.5 Functions.
    Amdahl's law
    The speedup is limited by the part of the work that can't be split: if 10% of the run stays serial, no number of threads makes it more than 10 times faster. In 10.3 Parallel work.
    and_then
    Runs the next step, which can itself fail, only if there's a value. An error skips it and passes through. In 5.2 optional and expected for errors.
    argument
    The value you pass when you call a function. In square(4), the argument is 4. In 1.5 Functions.
    array
    A fixed number of values of one type, side by side in memory. int readings[3] holds three ints, at indexes 0, 1 and 2. In 0.2 Setting up: compilers, warnings and sanitizers, 2.4 Arrays, std::array and std::span.
    array of structs (AoS), struct of arrays (SoA)
    Two layouts for many records: a vector of whole structs, or one struct holding a separate vector for each field. In 9.2 Caches and data-oriented design.
    std::array<T, N>
    A standard library array of N elements of type T. Same memory as a C array, but it knows its size and can be copied. In 2.4 Arrays, std::array and std::span.
    assembly
    The text form of machine code: one CPU instruction per line, such as add eax, esi. g++ -S writes it to a .s file. In 9.3 Optimization levels and reading assembly.
    assert(condition)
    From <cassert>: checks a condition while the program runs. If it's false, it prints the condition, file and line, and stops the program. In 5.3 Undefined behavior, assertions and sanitizers.
    assertion (REQUIRE, CHECK)
    One check inside a test case. REQUIRE stops the test case when it fails; CHECK records the failure and goes on. In 8.4 Testing.
    std::atomic<T>
    A type from <atomic> whose operations, such as fetch_add, load and store, happen as one indivisible step, so threads can share it without a data race. In 10.2 Mutexes and atomics.
    attribute
    Extra information for the compiler, written in double square brackets like [[nodiscard]]. In 1.5 Functions.
    auto
    Lets the compiler pick a variable's type from its initial value. In 1.1 Variables and initialization.
    auto return type
    Lets the compiler work out the return type from the return statements. In 1.5 Functions.
    auto-vectorization
    The compiler turning a loop into SIMD instructions by itself, usually at -O2 or -O3. In 9.4 SIMD.
    automated test
    Code that calls your code with known inputs and checks the results, so a program, not a person, decides whether it still works. In 8.4 Testing.
    AVX2
    The x86-64 instructions for 256-bit SIMD, in most x86-64 CPUs from the last ten years. -mavx2 lets the compiler use them. In 9.4 SIMD.

    B

    balanced tree
    Nodes linked so that each has a smaller-key side and a larger-key side, kept about equally deep. std::map is one. In 3.3 Maps and sets.
    base case
    The input where a recursive function returns without calling itself, so the calls stop. In 1.5 Functions.
    base class, derived class
    In struct Relu : Layer, Layer is the base class and Relu the derived class. A derived object is also a base object, so it can be passed wherever a base is expected. In 4.6 Inheritance and virtual functions.
    batch
    A group of reads passed through the queue as one item, so the queue's lock is taken once per batch instead of once per read. In 12.4 Processing reads in parallel.
    bind
    To attach a reference to its object. It happens once, when the reference is created, and can't be changed later. In 2.2 References.
    bit
    One binary digit, 0 or 1. A std::uint8_t holds 8 of them. In 1.3 Operators and bit operations.
    std::bit_cast<To>(from)
    Makes a To with exactly the bits of from. Both types must be the same size and trivially copyable (safe to copy byte by byte). In 9.5 Bits, bit_cast and endianness.
    bitwise operator
    & (AND), | (OR), ^ (XOR) and ~ (NOT): they work on each bit position separately. In 1.3 Operators and bit operations.
    block
    Code between { and }. Variables declared inside it are local to it. In 1.1 Variables and initialization, 1.4 Control flow.
    BMI (built module interface)
    The compiled form of a module interface that the compiler reads on import. GCC writes .gcm files, Clang writes .pcm files. In 8.3 Modules.
    bool
    A truth value: true or false. In 1.1 Variables and initialization.
    bounded queue
    A work queue with a size limit. Adding to it waits while it's full, so a fast reader can't fill memory faster than the workers empty it. In 12.4 Processing reads in parallel.
    brace initialization ({})
    Initializing with braces, as in int n{5};. It refuses conversions that would lose data. In 1.1 Variables and initialization.
    break and continue
    break leaves the innermost loop or switch at once; continue skips to the next iteration. In 1.4 Control flow.
    build
    The whole process of turning source files into a program you can run. It has three steps: preprocess, compile, link. In 0.1 How a C++ program is built.
    build folder
    The folder, often build/, that holds everything CMake makes: build files, object files, libraries and programs. You can delete it at any time and configure again. In 8.2 CMake and libraries.
    build system
    A tool that works out which files need compiling, in what order, and runs the compiler and linker for you. CMake writes the instructions; a tool such as Ninja carries them out. In 8.2 CMake and libraries.
    build type
    A CMake setting that picks a group of flags: Debug for finding bugs, Release for a fast program to ship. In 0.2 Setting up: compilers, warnings and sanitizers.
    byte
    The smallest piece of memory with its own address: 8 bits on this platform and almost every other. In 1.2 Integers and floating-point numbers.
    std::byteswap
    Reverses the order of the bytes in an integer (C++23). In 9.5 Bits, bit_cast and endianness.

    C

    C array (T[N])
    The array built into the language, like int counts[4]. It doesn't carry its size with it. In 2.4 Arrays, std::array and std::span.
    cache
    A small, fast memory inside the processor that keeps copies of recently used parts of main memory (RAM). There are usually three levels: L1, L2 and L3. In 9.2 Caches and data-oriented design.
    cache line
    The block of memory a cache loads and keeps as one piece: 64 bytes on this platform. Reading one byte brings in its whole line. In 9.2 Caches and data-oriented design.
    cache miss
    A read whose data isn't in the cache, so the processor waits for a slower level or for RAM. A hit is a read the cache can answer. In 9.2 Caches and data-oriented design.
    call
    Running a function by writing its name followed by its arguments in parentheses, like square(4). In 1.5 Functions.
    calling convention
    The rules for where a function finds its arguments and leaves its result. On 64-bit Linux, the first integer arguments arrive in rdi, rsi, rdx, rcx, r8, r9, and an integer result goes in eax or rax. In 9.3 Optimization levels and reading assembly.
    canonical k-mer
    The smaller of a k-mer and its reverse complement, so a k-mer and its copy on the other strand count as one. In 12.2 2-bit DNA and k-mers.
    capacity
    How many elements fit in a vector's current heap block. The size is how many it holds now. In 3.2 vector.
    capture list ([])
    The square brackets that start a lambda. [x] captures x by value (the lambda keeps its own copy); [&x] captures it by reference (the lambda refers to the original, but doesn't keep it alive). In 7.1 Lambdas.
    char
    One character, like 'G', written in single quotes. In 1.1 Variables and initialization.
    chunk
    One contiguous piece of the input, such as elements 0 to 249,999, that a single thread works through on its own. In 10.3 Parallel work.
    Clang
    Another free compiler, from the LLVM project. Its C++ compiler is the command clang++, and it takes the same flags as g++ for everything in this course. In 0.2 Setting up: compilers, warnings and sanitizers.
    class
    The same as a struct, except its members are private unless you say otherwise. In 4.1 Structs and classes.
    class template
    A pattern for a type, like template <typename T> struct Interval. Interval<int> is a type made from it. In 6.2 Class templates.
    class template argument deduction (CTAD)
    The compiler working out a class template's arguments from the initializer, as in std::vector v{1, 2, 3}. In 6.2 Class templates.
    closure
    The object a lambda expression creates. It holds the captured variables and can be called. In 7.1 Lambdas.
    CMake
    A tool that writes the build commands for you, from a short description of your project in a file called CMakeLists.txt. In 0.2 Setting up: compilers, warnings and sanitizers.
    comparator
    A function that takes two elements and returns true if the first should come before the second. std::sort uses one to decide the order. In 7.2 Iterators and algorithms.
    compile error
    The compiler can't make sense of a source file, so no object file is made. The message names a file and a line. In 0.1 How a C++ program is built.
    compile time and run time
    Compile time is while the compiler builds your program. Run time is later, while the program runs. In 6.4 constexpr and consteval.
    compiler
    The program that turns C++ source into machine code. This course uses GCC (g++) and Clang (clang++). In 0.1 How a C++ program is built.
    Compiler Explorer
    A website, godbolt.org, that compiles and runs C++ in your browser. Every Run button on this site opens it. In 0.2 Setting up: compilers, warnings and sanitizers.
    complement
    The base paired with a base on the other DNA strand: A with T, C with G. In 12.2 2-bit DNA and k-mers.
    compound assignment (+=)
    x += 5 is short for x = x + 5. Every arithmetic and bit operator has one: -=, *=, |=, <<= and so on. In 1.3 Operators and bit operations.
    compound requirement
    { expression } -> Concept<…>; inside a requires expression: the expression must compile, and its type must satisfy the concept. In 6.3 Concepts.
    concept
    A named constraint: a test on a type that is true or false while compiling, like std::integral<int>. The standard ones are in <concepts>; you define your own with the keyword concept. In 6.3 Concepts.
    condition
    An expression that is true or false, like quality >= 30, that decides what runs next. In 1.4 Control flow.
    std::condition_variable
    Lets a thread sleep until another thread changes some shared state and notifies it. Used with a mutex and std::unique_lock. In 10.2 Mutexes and atomics.
    configure
    CMake's first step: it reads CMakeLists.txt, finds your compiler and writes build files into the build folder. In 8.2 CMake and libraries.
    const
    Marks a variable that can't be changed after it's initialized. In 1.1 Variables and initialization.
    const member function
    A member function with const after its parameter list. It promises not to change the object, so you can call it on a const object or through a const&. In 4.1 Structs and classes.
    const T*
    A pointer you can read through but not change the object through. The pointer itself can be pointed somewhere else. In 2.3 Pointers.
    const T&
    A reference you can read through but not change through. The usual way to pass a big object to a function. In 2.2 References.
    constant evaluation
    The compiler running your code at compile time to work out a constant expression. In 6.4 constexpr and consteval.
    constant expression
    An expression the compiler can work out at compile time. Only these can initialize a constexpr variable, set an array size or go in static_assert. In 6.4 constexpr and consteval.
    constant folding
    Working out an expression while compiling, when its values are known, so the program holds only the answer. In 9.3 Optimization levels and reading assembly.
    consteval function
    A function that must run at compile time. Calling it with a value only known at run time doesn't compile. In 6.4 constexpr and consteval.
    constexpr
    Marks a constant whose value the compiler works out while compiling. In 1.1 Variables and initialization.
    constexpr function
    A function that can run at compile time when its arguments are constants and a constant result is needed, and at run time like any other function. In 6.4 constexpr and consteval.
    constinit
    On a global or static variable: its first value must be worked out at compile time. Unlike constexpr, the variable can change later. In 6.4 constexpr and consteval.
    constrained auto
    std::integral auto x: a parameter or variable whose deduced type must satisfy the concept. In 6.3 Concepts.
    constraint
    A condition a template puts on its types, checked while compiling. A call whose types don't meet it is rejected at the call. In 6.3 Concepts.
    constructor
    A function with the same name as the struct that runs when an object is created. In 2.5 Dynamic memory and RAII, 4.2 Constructors, destructors and the rule of zero.
    contiguous
    Stored side by side in one block of memory, with no gaps. Arrays, std::array and std::vector are contiguous. In 2.4 Arrays, std::array and std::span.
    control block
    A small heap record that shared_ptrs share. It holds the count of owners. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    conversion
    Turning a value of one type into another type, like int into double. In 1.2 Integers and floating-point numbers.
    copy constructor and copy assignment
    T(const T&) builds a new object as a copy of an existing one (T b = a;, or passing a by value). operator=(const T&) makes an object that already exists a copy of another (b = a;). In 4.3 Copy and move.
    copy elision
    The compiler building a returned object directly in the caller's variable, so there's no copy or move at all. In 4.3 Copy and move.
    critical section
    The code that runs while a mutex is held. Only one thread at a time can be inside it. In 10.2 Mutexes and atomics.
    CTest
    The test runner that comes with CMake. add_test registers a test program, and the ctest command runs them all. In 8.4 Testing.
    cycle
    Objects that own each other, directly or through others. With shared_ptr, a cycle never reaches a count of 0, so it leaks. In 2.6 Smart pointers: unique_ptr and shared_ptr.

    D

    dangling iterator
    An iterator into a container that no longer exists. Using it is undefined behavior. In 7.3 Ranges and views.
    dangling reference
    A reference whose object no longer exists. Using it is undefined behavior. In 2.2 References.
    dangling view
    A view whose characters no longer exist, because the string it looked at was destroyed or moved its text. Reading it is undefined behavior. In 3.1 string and string_view.
    data race
    Two threads use the same memory at the same time, at least one of them writes, and nothing makes them take turns. It is undefined behavior. In 10.1 Threads and jthread.
    data-oriented design
    Choosing how to store data by how the program reads it, so the hot loops read only the bytes they need, in order. In 9.2 Caches and data-oriented design.
    deadlock
    Threads that each wait for a lock another one holds, so none of them can ever go on. In 10.2 Mutexes and atomics.
    decay
    The automatic conversion of a C array to a pointer to its first element. The size is lost. In 2.4 Arrays, std::array and std::span.
    declaration
    Tells the compiler that a name exists and what its type is, such as int square(int x);. In 0.1 How a C++ program is built, 1.5 Functions.
    deep copy
    A copy of what a pointer points to: the new object gets its own heap block with the same values. Copying only the pointer is a shallow copy. In 4.3 Copy and move.
    default argument
    A value written next to a parameter (int max_score = 100) that is used when the caller leaves that argument out. In 1.5 Functions.
    default constructor
    A constructor that can be called with no arguments. It runs for Interval empty; and Interval empty{};. In 4.2 Constructors, destructors and the rule of zero.
    default member initializer
    A starting value written where the member is declared: int min_quality = 20;. It's used when a constructor doesn't set that member. In 4.2 Constructors, destructors and the rule of zero.
    defaulted comparison
    A comparison marked = default: the compiler compares the members one by one, in the order they're declared. In 4.4 Operators and comparisons with <=>.
    definition
    Gives a declared name its body. A function's definition is its code in braces. In 0.1 How a C++ program is built, 1.5 Functions.
    delegating constructor
    A constructor whose initializer list calls another constructor of the same class, so the setup code lives in one place. In 4.2 Constructors, destructors and the rule of zero.
    delete
    Destroys an object made with new and gives its memory back. Every new needs exactly one delete. In 2.5 Dynamic memory and RAII.
    dereference (*p)
    Following a pointer to the object it points at. *p is that object. In 2.3 Pointers.
    designated initializer
    Naming each member in braces as you set it: Read r{.id = "r1", .bases = "ACGT", .quality = 30};. In 4.1 Structs and classes.
    destructor (~T())
    A function that runs automatically when an object of type T is destroyed. In 2.1 Stack, heap and lifetime, 2.5 Dynamic memory and RAII, 4.2 Constructors, destructors and the rule of zero.
    deterministic output
    Output that is the same on every run, however the threads happened to be scheduled. In 12.4 Processing reads in parallel.
    directive
    A line that starts with #. It's an instruction for the preprocessor, not C++ code. In 0.1 How a C++ program is built.
    dot product
    Multiply the matching elements of two vectors and add the results. Models use it to measure how alike two vectors are. In 6.2 Class templates.
    double
    A number with a fractional part, like 9.99. In 1.1 Variables and initialization.
    double free
    Freeing the same memory twice. It's undefined behavior and can corrupt the heap. In 2.5 Dynamic memory and RAII.
    dynamic programming
    Solving a problem by filling a table of answers to smaller versions of it, each computed from answers already in the table. In 12.3 Sequence alignment.

    E

    edge case
    An input at the limit of what a function accepts: empty, one element, the largest value. Bugs gather there. In 8.4 Testing.
    edit distance
    The smallest number of single-base changes, insertions and deletions that turn one sequence into the other. In 12.3 Sequence alignment.
    element
    One value in an array. Elements are numbered from 0, so the last one is at size − 1. In 2.4 Arrays, std::array and std::span.
    embedding
    A fixed-size vector of floats that a model uses to stand for a word, an image or a DNA sequence. In 6.2 Class templates.
    emplace_back(args…)
    Builds a new element at the end of a vector from the arguments you'd use to create one, instead of taking a finished element. In 3.2 vector.
    endianness
    The order a number's bytes are stored in. Little-endian puts the lowest byte first; big-endian puts the highest byte first. In 9.5 Bits, bit_cast and endianness.
    enum class (scoped enum)
    An enumeration whose names are written with the type's name in front (Base::G) and whose values never turn into numbers by themselves. In 4.5 enum class.
    enumeration (enum)
    A type whose values come from a fixed list of named constants. In 4.5 enum class.
    enumerator
    One of the named values in an enumeration, like Base::G. In 4.5 enum class.
    error enum
    An enum class that lists the ways a function can fail, so callers can react to each one. It's one common choice for the E in std::expected<T, E>; a message string is another. In 5.2 optional and expected for errors.
    error() and value()
    error() gives the error stored in a std::expected; only call it when there is no value. value() gives the value, or throws an exception if there's none (std::bad_expected_access for a std::expected). In 5.2 optional and expected for errors.
    exception
    A way to report an error by jumping out of the current code. If nothing catches it, the program stops. Module 5 covers exceptions. In 2.4 Arrays, std::array and std::span, 5.1 Exceptions.
    std::exception and what()
    The base class of every exception the standard library throws, from <exception>. Its member function what() returns the error message as text. In 5.1 Exceptions.
    executable
    The file a build produces: a program the operating system can run. In 0.1 How a C++ program is built.
    execution policy
    An extra first argument to a standard algorithm that says how it may run: std::execution::seq (one thread), par (several threads) or par_unseq (several threads and vector instructions). From <execution>. In 10.3 Parallel work.
    exit code
    The whole number main returns to the operating system when the program ends. 0 means success; anything else means something went wrong. In 0.1 How a C++ program is built.
    std::expected<T, E>
    Holds either a value of type T or an error of type E. From <expected>, new in C++23. In 5.2 optional and expected for errors.
    explicit
    Written before a constructor, it stops C++ from using that constructor to convert a value to your type without being asked. You can still call it by name. In 4.2 Constructors, destructors and the rule of zero.
    export
    Marks a declaration in a module interface as visible to files that import the module. In 8.3 Modules.
    extern
    On a global variable without an initializer: a declaration only. It says the variable is defined in another source file. In 8.1 Headers, source files and the one-definition rule.

    F

    fall through
    When a case has no break, running continues into the next case. In 1.4 Control flow.
    false sharing
    Threads that write different variables in the same cache line slow each other down, because the cores keep passing that line back and forth. In 10.2 Mutexes and atomics.
    FASTA
    A text format for sequences. Each record is a header line starting with >, then the sequence, often split over several lines. In 12.1 Reading FASTA and FASTQ.
    FASTQ
    A text format for reads. Each record is exactly four lines: @ and a name, the bases, a + line, and one quality character per base. In 12.1 Reading FASTA and FASTQ.
    fill
    The character used for padding, written before the alignment, like * in {:*^20}. In 1.6 Printing and reading: std::print, std::format and streams.
    find and npos
    s.find(x) gives the position of the first x in s, counting from 0, or the special value std::string::npos if there isn't one. In 3.1 string and string_view.
    fixed-width integer type
    A type from <cstdint> with an exact size on every machine, like std::int32_t (32 bits) or std::uint8_t (8 bits, unsigned). In 1.2 Integers and floating-point numbers.
    flag
    An option you give a command, starting with -, such as -Wall. In 0.2 Setting up: compilers, warnings and sanitizers, 1.3 Operators and bit operations.
    flat count table
    A vector with one counter for every possible k-mer (4^k of them), indexed by the packed k-mer itself. In 12.2 2-bit DNA and k-mers.
    std::flat_map<K, V>
    A sorted map that stores its keys in one vector and its values in another (C++23). From <flat_map>. In 3.3 Maps and sets.
    float
    A smaller floating-point type: 4 bytes on this platform, precise to about 7 decimal digits. In 1.2 Integers and floating-point numbers.
    floating-point type
    A type for numbers with a fractional part, stored as a binary fraction with limited precision: float or double. In 1.2 Integers and floating-point numbers.
    flush
    To send text that is waiting in a buffer out to the terminal or file right away. In 1.6 Printing and reading: std::print, std::format and streams.
    for
    A loop with three parts in one line: a start, a condition and a step, like for (int i = 0; i < 3; ++i). In 1.4 Control flow.
    std::format
    Works like std::println, but returns the text as a std::string instead of printing it. From <format>. In 1.6 Printing and reading: std::print, std::format and streams.
    format spec
    Instructions after a : inside a placeholder, like {:>8} or {:.2f}, that say how to print the value. In 1.6 Printing and reading: std::print, std::format and streams.
    format string
    The text you pass first to std::println or std::format, with {} placeholders where the values go. In 1.6 Printing and reading: std::print, std::format and streams.
    std::formatter<T>
    The standard library type that tells std::format and std::println how to turn a T into text. In 4.4 Operators and comparisons with <=>.
    free (memory)
    To give heap memory back so it can be used again. In 2.5 Dynamic memory and RAII.
    std::from_chars
    Reads a number from a run of characters (from <charconv>). It reports bad input in its result instead of throwing. In 3.1 string and string_view.
    function
    A named block of code that takes some inputs, does one job and can hand back a result. In 1.5 Functions.
    function object
    An object with an operator(), so you can call it like a function. In 4.4 Operators and comparisons with <=>.
    function template
    A function written with template <typename T> in front. The compiler makes a real function from it for each type you use. In 6.1 Function templates.
    std::function<R(Args...)>
    A standard type from <functional> that can hold any callable with that signature, such as std::function<bool(int)>. In 7.1 Lambdas.
    fused multiply-add (FMA)
    One instruction that computes a * b + c for every lane, rounding once at the end. -mfma enables it. In 9.4 SIMD.
    std::future
    A result that isn't ready yet. get() waits for it. std::async runs a function and gives you its result as a future. In 10.1 Threads and jthread.

    G

    gap
    A - in an alignment: a base that one sequence has and the other doesn't (an insertion or a deletion). In 12.3 Sequence alignment.
    GCC
    The GNU Compiler Collection, a free compiler. Its C++ compiler is the command g++. In 0.2 Setting up: compilers, warnings and sanitizers.
    generic lambda
    A lambda with an auto parameter. It works with any type the body can handle, like a function template. In 7.1 Lambdas.
    std::get and std::get_if
    std::get<T>(v) returns the T in a variant and throws std::bad_variant_access if it holds something else. std::get_if<T>(&v) returns a pointer to it, or nullptr. In 3.4 optional, variant and tuple.
    global alignment (Needleman–Wunsch)
    The best-scoring alignment of the two sequences from end to end. In 12.3 Sequence alignment.
    global module fragment
    The part of a module file between module; and the module declaration. It's where #include lines go. In 8.3 Modules.

    H

    half-open range
    A pair of iterators [first, last): it includes the element at first and stops just before last. When first == last, the range is empty. In 7.2 Iterators and algorithms.
    hash table
    An array of buckets. A hash function turns each key into a number, its hash, which picks the key's bucket, so a lookup only checks the few keys in one bucket. In 3.3 Maps and sets.
    header
    A file of declarations meant to be included by other files, such as <print> from the standard library. In 0.1 How a C++ program is built.
    heap
    Memory a program asks for while it runs, for data whose size isn't known in advance or that must outlive a function call. In 2.1 Stack, heap and lifetime.
    hidden friend
    A friend function defined inside a class: a non-member function that may use the class's private members, and that the compiler finds only when an argument has the class's type. In 4.4 Operators and comparisons with <=>.
    horizontal sum
    Adding up the lanes of one vector register, as opposed to adding two registers lane by lane. In 9.4 SIMD.

    I

    IEEE 754
    The standard format for floating-point numbers that float and double use on almost every machine: a sign bit, exponent bits and mantissa bits. In 9.5 Bits, bit_cast and endianness.
    if constexpr
    An if whose condition is decided at compile time. In a template, the branch that isn't taken is discarded and never compiled for that type. In 6.4 constexpr and consteval.
    if with an initializer
    if (init; condition) declares a variable that exists only inside the if and its else. In 1.4 Control flow.
    std::ifstream
    An input stream that reads a file (from <fstream>). It works like std::cin: std::getline and >> read from it. In 12.1 Reading FASTA and FASTQ.
    implementation-defined
    Behavior the standard lets each compiler choose, as long as it documents the choice, like the size of long. Unlike undefined behavior, the result is reliable on a given platform. In 5.3 Undefined behavior, assertions and sanitizers.
    import
    Makes a module's exported names available in this file, like import dna;. In 8.3 Modules.
    include guard
    Lines that stop a header from being pasted into one translation unit twice: #pragma once at the top, or #ifndef, #define and #endif around the whole header. In 8.1 Headers, source files and the one-definition rule.
    increment (++) and decrement (--)
    Add 1 to a variable, or subtract 1. ++x gives the new value; x++ gives the old one. In 1.3 Operators and bit operations.
    index
    The number of an element, written in square brackets: a[2] is the third element. In 2.4 Arrays, std::array and std::span.
    inheritance
    Building a new class from an existing one. The new class gets all the members of the old one and can add its own. In 4.6 Inheritance and virtual functions.
    initialize
    Give a variable its first value, in the same statement that declares it. In 1.1 Variables and initialization.
    inline
    On a function or a variable: it may be defined in several translation units, and the linker keeps one. This lets you define it in a header. In 8.1 Headers, source files and the one-definition rule.
    inlining
    Replacing a function call with a copy of the function's body. It saves the call and lets the optimizer simplify the body with the caller's values. In 9.3 Optimization levels and reading assembly.
    instantiation
    The compiler writing a real function from a template, for one set of template arguments. In 6.1 Function templates.
    int
    A whole number, like 42 or -7. In 1.1 Variables and initialization.
    integer division
    Dividing two integers. The result is an integer too: the fraction is dropped. In 1.2 Integers and floating-point numbers.
    integer promotion
    Before arithmetic, values of types smaller than int (like std::uint8_t or bool) are converted to int. In 1.3 Operators and bit operations.
    integer type
    A type for whole numbers: char, short, int, long and long long, plus the fixed-width types. In 1.2 Integers and floating-point numbers.
    intrinsic
    A function the compiler turns into one particular CPU instruction, such as _mm256_add_ps for vaddps. x86 intrinsics come from <immintrin.h>. In 9.4 SIMD.
    invalidate
    To make a reference, pointer or iterator into a container stale, because the element moved or was removed. Using it afterwards is undefined behavior. In 3.2 vector.
    invariant
    A rule about an object's data that must always hold, like "the bases are only A, C, G or T". In 4.1 Structs and classes.
    iterator
    An object that marks a position in a container. v.begin() is the first element, v.begin() + i is element i, and v.end() is the position just past the last. Lesson 7.2 covers iterators. In 3.2 vector, 7.2 Iterators and algorithms.
    iterator invalidation
    When a change to a container, such as push_back, makes existing iterators, references or pointers into it unusable. In 7.2 Iterators and algorithms.

    J

    join and detach
    t.join() waits until thread t has finished. t.detach() lets it run on its own, and you can never wait for it. In 10.1 Threads and jthread.
    std::jthread
    A thread that joins itself when it's destroyed, and that you can ask to stop (C++20). In 10.1 Threads and jthread.

    K

    k-mer
    A piece of DNA k bases long. A read of n bases has n - k + 1 of them, one starting at each position. In 12.2 2-bit DNA and k-mers.
    key and value
    A map stores pairs: the key is what you look up by, the value is what you get back. Each key appears at most once. In 3.3 Maps and sets.

    L

    lambda
    A function you write inline, where you use it, without giving it a name. It creates an object you can call like a function. In 7.1 Lambdas.
    lazy evaluation
    Doing work only when a result is asked for. A view computes each element when you read it, not when you create the view. In 7.3 Ranges and views.
    LeakSanitizer
    A checker, included in -fsanitize=address on Linux, that lists every leak when the program exits. In 2.5 Dynamic memory and RAII.
    library assertions
    Checks built into the standard library itself, such as an index check in a vector's []. GCC's library runs them when _GLIBCXX_ASSERTIONS is defined, which version 15 does for you in builds without optimization. In 5.3 Undefined behavior, assertions and sanitizers.
    lifetime
    The time during which an object exists, from when it's created to when it's destroyed. In 2.1 Stack, heap and lifetime.
    link error
    Every file compiled, but the linker can't find the definition of a name (or finds two). In 0.1 How a C++ program is built.
    link-time optimization (LTO)
    Optimizing the whole program while linking (-flto), so a function in one source file can be inlined into another. In 9.3 Optimization levels and reading assembly.
    linkage
    Whether a name in one translation unit means the same thing in others. External linkage: shared by the whole program. Internal linkage: private to its own file. In 8.1 Headers, source files and the one-definition rule.
    linker
    The last step of a build. It joins object files and libraries into one executable, and connects every use of a name to that name's definition. In 0.1 How a C++ program is built.
    literal
    A value written directly in the code, like 42, 0.5 or 'G'. In 1.2 Integers and floating-point numbers.
    load balancing
    Giving every thread about the same amount of work, so none sits idle while another finishes. In 12.4 Processing reads in parallel.
    local alignment (Smith–Waterman)
    The best-scoring alignment of a part of one sequence with a part of the other, ignoring the rest. In 12.3 Sequence alignment.
    std::lock_guard and std::scoped_lock
    RAII locks: the constructor locks the mutex, the destructor unlocks it. std::scoped_lock can lock several mutexes at once. In 10.2 Mutexes and atomics.
    lookup table
    An array of answers prepared in advance, so a question becomes an index: the code for base 'G' is table['G']. In 6.4 constexpr and consteval.
    loop
    Code that runs its body again and again while a condition holds. Each run is one iteration. In 1.4 Control flow.
    loop unrolling
    Repeating a loop's body several times per pass, so the loop checks its condition less often. A short loop with a fixed count can disappear entirely. In 9.3 Optimization levels and reading assembly.
    lvalue and rvalue
    An lvalue names an object you can use again, like a variable a. An rvalue is a temporary with no name, or an object passed through std::move; its contents may be taken. In 4.3 Copy and move.

    M

    m[key]
    Gives the value for key, adding the key with a default value first (0 for numbers, empty for strings) if it's missing. In 3.3 Maps and sets.
    machine code
    Instructions the processor runs directly, stored as bytes. Processors can't run C++ text. In 0.1 How a C++ program is built.
    main
    The function every C++ program starts in. When main ends, the program ends. In 0.1 How a C++ program is built.
    std::make_shared<T>(…)
    Creates a T and its control block in one heap allocation and returns a std::shared_ptr<T>. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    std::make_unique<T>(…)
    Creates a T on the heap from the arguments and returns a std::unique_ptr<T> that owns it. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    mantissa
    The bits of a floating-point number that hold its digits. The exponent says where the binary point goes. In 9.5 Bits, bit_cast and endianness.
    std::map<K, V>
    A map that keeps its pairs sorted by key. From <map>. In 3.3 Maps and sets.
    mask
    An integer whose 1 bits pick out the bits you care about, used with &, | or ^. In 1.3 Operators and bit operations.
    matcher
    An object that describes what a value should be, like WithinRel(0.3). Used with REQUIRE_THAT and CHECK_THAT. In 8.4 Testing.
    member
    A named part of a struct or class: a data member is a value stored in every object, like quality in a Read; a member function is a function you call on an object with .. In 4.1 Structs and classes.
    member initializer list
    The part of a constructor between : and the body, like : start_(start), end_(end). It creates each member with the value given. In 4.2 Constructors, destructors and the rule of zero.
    memory leak
    Heap memory that is never freed. The program keeps it until it exits. In 2.5 Dynamic memory and RAII.
    memory order
    How much an atomic operation also orders the memory accesses around it. The default, std::memory_order_seq_cst, is the strictest; std::memory_order_relaxed only keeps the atomic itself correct. In 10.2 Mutexes and atomics.
    memory-bound
    Work whose speed is limited by how fast memory delivers the data, not by the arithmetic. More threads help it little. In 10.3 Parallel work.
    merge
    Combine several count tables into one by adding up the counts for each key. In 12.4 Processing reads in parallel.
    module
    A named, separately compiled piece of a program. It says which names it exports, and files that import it see only those. In 8.3 Modules.
    module implementation unit
    A source file that starts with module name; (no export). It defines what the interface declares; importers never see it. In 8.3 Modules.
    module interface unit (.cppm)
    The file that starts with export module name;. It says what the module exports. In 8.3 Modules.
    module partition
    One piece of a larger module, named name:part. Only files of the same module can import it. In 8.3 Modules.
    std::move
    Marks an object as something whose contents may be taken. Passing a unique_ptr through it hands over ownership. Module 4 covers moving in full. In 2.6 Smart pointers: unique_ptr and shared_ptr, 4.3 Copy and move.
    move constructor and move assignment
    T(T&&) and operator=(T&&): build or overwrite an object by taking the contents of one nobody will use again, instead of copying them. In 4.3 Copy and move.
    moved-from
    The state of an object after its contents were taken. A moved-from unique_ptr is empty: it holds nullptr. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    moved-from state
    What's left of an object after a move. The standard library promises only that it's valid: you can assign it a new value or let it be destroyed. In 4.3 Copy and move.
    mutable
    A keyword after a lambda's parameter list that lets the body change its by-value captures. In 7.1 Lambdas.
    mutex
    A lock that only one thread can hold at a time (std::mutex, from <mutex>). A thread that tries to lock it while another holds it waits. In 10.2 Mutexes and atomics.

    N

    N
    The letter sequencers write for a base they couldn't read. In 12.2 2-bit DNA and k-mers.
    namespace
    A named group of declarations, such as std or dna. From outside, you reach a name in it with ::, as in dna::count_gc. In 8.1 Headers, source files and the one-definition rule.
    narrowing conversion
    A conversion that can lose data, like double to int (the fraction is dropped). In 1.1 Variables and initialization.
    NDEBUG
    A name that, when defined (with #define NDEBUG or the flag -DNDEBUG), turns every assert into nothing. Release builds usually define it. In 5.3 Undefined behavior, assertions and sanitizers.
    nested loop
    A loop inside another loop. The inner loop runs all the way through for each step of the outer one. In 1.4 Control flow.
    new
    Creates an object on the heap and gives you a pointer to it: new int(42). In 2.5 Dynamic memory and RAII.
    new[] and delete[]
    The array forms: new float[n] makes n floats on the heap, and delete[] p frees them. Each form must be paired with its own. In 2.5 Dynamic memory and RAII.
    noexcept
    A promise that a function never throws an exception. When a std::vector grows, it moves elements whose move constructor makes this promise, and copies the others if it can. In 4.3 Copy and move, 5.1 Exceptions.
    non-member function
    A function declared outside any class. a + b can call a non-member operator+(a, b). In 4.4 Operators and comparisons with <=>.
    non-owning
    Used to reach an object, never to delete it. Raw pointers (T*) and references (T&) are non-owning. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    non-type template parameter
    A template parameter that's a value instead of a type, like std::size_t N in Vec<T, N>. It must be known when you compile. In 6.2 Class templates.
    null pointer dereference
    Using * or -> on a pointer that is nullptr. It's undefined behavior. In 2.3 Pointers.
    null terminator ('\0')
    The character with code 0, put after the last character so that C functions can find where text ends. In 3.1 string and string_view.
    nullptr
    The value of a pointer that points at nothing. In 2.3 Pointers.
    std::numeric_limits
    From <limits>: tells you facts about a number type, like its smallest and largest values. In 1.2 Integers and floating-point numbers.

    O

    object file
    What the compiler makes from one source file: machine code, plus a list of the names it defines and the names it still needs. Its name ends in .o. In 0.1 How a C++ program is built.
    object slicing
    Copying a derived object into a base object by value. Only the base part is copied; the derived members and behavior are lost. In 4.6 Inheritance and virtual functions.
    off-by-one error
    A loop that runs one time too many or too few, often by writing <= where < was meant. In 1.4 Control flow.
    offset
    Where a member starts, counted in bytes from the start of its object. offsetof(T, member) from <cstddef> gives it. In 9.1 Layout, alignment and padding.
    one-definition rule (ODR)
    Each ordinary function and global variable that the program uses is defined exactly once in the whole program. Types, templates and inline functions may be defined in every translation unit that uses them, if every copy is the same. In 8.1 Headers, source files and the one-definition rule.
    operator
    A symbol like +, < or && that computes a value from one or two values, its operands. In 1.3 Operators and bit operations.
    operator overloading
    Giving an operator a meaning for your own type by writing a function named operator plus the symbol, like operator+. In 4.4 Operators and comparisons with <=>.
    operator<=> (three-way comparison)
    Compares two values once and says whether the first is less, equal or greater. C++ uses it for <, <=, > and >=. In 4.4 Operators and comparisons with <=>.
    optimization level (-O0 to -O3, -Os, -Og)
    How hard the optimizer works. -O0 translates line by line, -O2 is the usual release level, -O3 tries harder on loops, -Os prefers small code and -Og keeps debugging easy. In 9.3 Optimization levels and reading assembly.
    optimization level (-O0, -O2)
    How hard the compiler's optimizer works to make the program fast. It rewrites your code into faster code that gives the same result, assuming no undefined behavior happens. -O0 (the default) barely optimizes; -O2 is the usual level for release builds. In 5.3 Undefined behavior, assertions and sanitizers.
    std::optional<T>
    Holds either one T or nothing. A new optional is empty, and assigning std::nullopt empties it again. From <optional>. In 3.4 optional, variant and tuple.
    or_else
    Runs a step only if there's an error: to recover from it, report it or swap it for another. In 5.2 optional and expected for errors.
    out of bounds
    An index outside 0 to size − 1. Reading or writing there is undefined behavior. In 2.4 Arrays, std::array and std::span.
    overflow
    A result too big or too small for its type. For signed types it's undefined behavior; unsigned types wrap around. In 1.2 Integers and floating-point numbers.
    overloading
    Defining several functions with the same name but different parameter types. The compiler picks one from the arguments. In 1.5 Functions.
    override, override
    To override is to give a derived class its own version of a base class's virtual function. Writing override after the function says that's what you mean; if it doesn't override anything, the code doesn't compile. In 4.6 Inheritance and virtual functions.
    own
    An object owns memory when it's responsible for freeing it. A std::vector owns its heap block. In 2.1 Stack, heap and lifetime.
    owner
    The one part of the program responsible for freeing a piece of memory or another resource. In 2.5 Dynamic memory and RAII, 2.6 Smart pointers: unique_ptr and shared_ptr.

    P

    package
    A library installed on your machine together with files that tell CMake how to use it. find_package looks for one. In 8.2 CMake and libraries.
    package manager
    A tool that installs software for you, such as apt on Ubuntu or Homebrew (brew) on macOS. In 0.2 Setting up: compilers, warnings and sanitizers.
    packed struct
    A struct whose padding a compiler extension removes, so its members can sit at misaligned addresses. In 9.1 Layout, alignment and padding.
    padding
    Unused bytes the compiler adds inside a struct, between members or at the end, so every member sits at an address its alignment allows. In 9.1 Layout, alignment and padding.
    std::pair<A, B>
    Two values stored together, first and second. From <utility>. In 3.4 optional, variant and tuple.
    parameter
    A variable listed in a function's definition, like n in int square(int n). It holds the value the caller passed in. In 1.5 Functions.
    partial result
    What one thread computes for its chunk. The partial results are combined into the final answer after the threads finish. In 10.3 Parallel work.
    pass by reference
    The function gets a reference to the caller's object, so no copy is made. In 2.2 References.
    pass by value
    The function gets its own copy of each argument. Changing the copy doesn't touch the caller's variable. In 1.5 Functions, 2.2 References.
    past-the-end iterator
    The iterator end() returns: one past the last element. It has no element of its own, so you must not use * on it. In 7.2 Iterators and algorithms.
    per-thread counts
    A separate count table for each thread. Each thread writes only its own, so no locks are needed while counting. In 12.4 Processing reads in parallel.
    Phred quality score
    How sure the machine is of a base: a score Q means the chance it's wrong is 10 to the power -Q/10. Q20 is 1 in 100, Q30 is 1 in 1,000. In 12.1 Reading FASTA and FASTQ.
    Phred+33
    The way FASTQ stores a score as one printable character: the character's code minus 33. ! is Q0, 5 is Q20, ? is Q30 and I is Q40. In 12.1 Reading FASTA and FASTQ.
    pipeline (|)
    Range adaptors joined with |. r | std::views::filter(f) means filter r; each | feeds the result into the next step. In 7.3 Ranges and views.
    placeholder ({})
    A pair of braces in a format string. Each one is replaced by the next argument. In 1.6 Printing and reading: std::print, std::format and streams.
    plain enum (unscoped enum)
    The older kind of enumeration. Its names are visible in the whole surrounding scope, and its values turn into int by themselves. In 4.5 enum class.
    pointer (T*)
    A variable that holds the address of an object of type T. You can change which object it points at. In 2.3 Pointers.
    pointer arithmetic
    Adding to or subtracting from a pointer to move between elements that sit next to each other in memory. In 2.3 Pointers.
    pointer to member (&Read::quality)
    A way to name one member of a struct without naming an object. As a projection, it means use this member of each element. In 7.2 Iterators and algorithms.
    population count
    The number of 1 bits in an integer. std::popcount computes it. In 9.5 Bits, bit_cast and endianness.
    precedence
    Which operator is applied first when an expression has several, like * before +. In 1.3 Operators and bit operations.
    precision
    For a floating-point number, how many digits to show after the decimal point: {:.2f}. In 1.6 Printing and reading: std::print, std::format and streams.
    precondition
    Something that must be true when a function is called, like "count is greater than 0". Breaking it is a bug in the caller. In 5.3 Undefined behavior, assertions and sanitizers.
    predicate
    A function that answers yes or no about a value, by returning a bool. In 3.2 vector, 7.1 Lambdas.
    prefetcher
    Hardware that watches which addresses a loop reads and loads the next cache lines before the loop asks for them. In 9.2 Caches and data-oriented design.
    preprocessor
    The first step of a build. It handles lines that start with #, such as #include, by editing the text before the compiler reads it. In 0.1 How a C++ program is built.
    std::print / std::println
    Print text with values filled in. println adds a newline at the end; print doesn't. From <print>. In 1.6 Printing and reading: std::print, std::format and streams.
    projection
    A function a std::ranges:: algorithm applies to each element before comparing or testing it, such as &Read::quality to sort reads by their quality. In 7.2 Iterators and algorithms.
    PUBLIC, PRIVATE and INTERFACE
    Words in target_… commands. A PRIVATE setting applies to the target itself; a PUBLIC one also passes to every target that links to it; an INTERFACE one passes only to those targets. In 8.2 CMake and libraries.
    pure virtual function, abstract class
    A virtual function declared with = 0 instead of a body is pure virtual. A class with one is abstract: you can't create an object of it, only of derived classes that override it. In 4.6 Inheritance and virtual functions.

    Q

    quality trimming
    Cutting the low-quality bases off the end of a read before using it, because sequencing errors pile up there. In 12.1 Reading FASTA and FASTQ.

    R

    RAII
    Resource Acquisition Is Initialization: an object gets a resource in its constructor and gives it back in its destructor, so it's freed exactly once, automatically. In 2.5 Dynamic memory and RAII.
    random-access iterator
    An iterator that can jump any distance in one step, like it + 5. Iterators of std::vector, std::array and std::string are random-access; std::sort needs them. In 7.2 Iterators and algorithms.
    range
    Anything with a begin() and an end() you can loop over: a vector, a string, an array, or a view. In 7.3 Ranges and views.
    range adaptor
    Something in std::views that makes a view from a range, such as std::views::filter(pred). In 7.3 Ranges and views.
    range-based for
    for (char base : dna) visits each element of a string or container in order. In 1.4 Control flow.
    std::ranges:: algorithms
    Versions of the algorithms that take a whole container instead of two iterators, and accept a projection. In 7.2 Iterators and algorithms.
    std::ranges::dangling
    An empty type a std::ranges:: algorithm returns instead of an iterator when you pass it a temporary container. You can't use * on it, so the mistake becomes a compile error. In 7.3 Ranges and views.
    std::ranges::to<C>()
    A C++23 function that copies the elements of a range into a new container of type C, such as std::vector. In 7.3 Ranges and views.
    read
    One piece of DNA as a sequencing machine reported it: a string of the letters A, C, G and T (and N for a base it couldn't call), usually 50 to a few thousand bases long. In 12.1 Reading FASTA and FASTQ.
    reallocation
    Moving a vector's elements to a new, bigger heap block because the old one is full, then freeing the old block. In 3.2 vector.
    recursion
    A function that calls itself, each time on a smaller version of the problem. In 1.5 Functions.
    reference (T&)
    Another name for an object that already exists. Reading or changing the reference reads or changes that object. In 2.2 References.
    register
    A small, very fast storage slot inside the CPU, such as eax or rdi. Most instructions read and write registers. In 9.3 Optimization levels and reading assembly.
    requires clause
    requires and a condition, written after template <…>. The template can only be used with types that satisfy it. In 6.3 Concepts.
    requires expression
    requires(parameters) { … }: true if every expression listed inside would compile. The usual way to say which operations a type must have. In 6.3 Concepts.
    reserve(n)
    Makes sure a vector has room for at least n elements. It doesn't add any elements. In 3.2 vector.
    resize(n)
    Changes the number of elements to n: adds new ones (zeros for numbers) at the end, or drops elements from the end. In 3.2 vector.
    resource
    Anything you must give back after use: heap memory, an open file, a network connection, a lock. In 2.5 Dynamic memory and RAII.
    return
    Ends the function and hands a value back to the caller. In 1.5 Functions.
    return type
    The type written before a function's name. It says what kind of value the function hands back. In 1.5 Functions.
    reverse complement
    A sequence read backwards with every base complemented: the same stretch of DNA, read from the other strand. In 12.2 2-bit DNA and k-mers.
    rolling encoding
    Updating a packed k-mer as the window slides one base: shift the oldest base out and the new one in, instead of encoding all k bases again. In 12.2 2-bit DNA and k-mers.
    rotate
    A shift where the bits that fall off one end come back in at the other end. In 9.5 Bits, bit_cast and endianness.
    rounding error
    The small difference between a decimal number and the nearest value a floating-point type can store. In 1.2 Integers and floating-point numbers.
    row-major order
    Storing a 2D grid flat, one row after another. Element (row, column) is at index row * width + column. In 2.4 Arrays, std::array and std::span.
    rule of five
    If a class declares a destructor or any copy or move function, it should declare all five, writing each one, or marking it = default or = delete. In 4.3 Copy and move.
    rule of zero
    Build a class from members that clean up after themselves, and write no destructor, copy or move functions for it. In 4.2 Constructors, destructors and the rule of zero.
    std::runtime_error and std::logic_error
    The two main families of standard exceptions, from <stdexcept>: failures outside the program's control, and mistakes in how code was called. In 5.1 Exceptions.

    S

    sanitizer
    A checker the compiler builds into your program. It watches the program as it runs, and stops it with a report when it finds a bug. In 0.2 Setting up: compilers, warnings and sanitizers.
    satisfied
    A constraint is satisfied when it's true for the types in a call. In 6.3 Concepts.
    scope
    The part of the code where a name can be used: from its declaration to the closing } of its block. In 1.1 Variables and initialization, 2.1 Stack, heap and lifetime.
    scoring scheme
    The points an alignment gets for each column: a reward for a match, a penalty for a mismatch, a penalty for a gap. In 12.3 Sequence alignment.
    SECTION
    A part of a Catch2 test case. The test case runs once for each section, from the top, so every section starts from the same setup. In 8.4 Testing.
    std::set<K> and std::unordered_set<K>
    Containers of keys alone, each stored once: sorted, or in a hash table. In 3.3 Maps and sets.
    shadowing
    Declaring a variable in an inner block with the same name as one in an outer block. The inner one hides the outer one. In 1.1 Variables and initialization.
    shared library
    A library, such as libdna.so, that is loaded when the program starts. Programs that use it share one copy, and it can be updated without relinking them. In 8.2 CMake and libraries.
    std::shared_ptr<T>
    A smart pointer that can be copied. All the copies share the object, and the last one to go deletes it. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    shift (<<, >>)
    Moves every bit of an integer left or right by a number of places. In 1.3 Operators and bit operations.
    short-circuit evaluation
    && and || stop as soon as the answer is known, so the right side may never run. In 1.3 Operators and bit operations.
    signed
    An integer type that holds negative and positive values. int is signed. In 1.2 Integers and floating-point numbers.
    SIMD
    Single instruction, multiple data: one CPU instruction that does the same operation on several values at once, such as adding 8 pairs of floats. In 9.4 SIMD.
    size and capacity
    A vector's size is how many elements it holds; its capacity is how many fit in its heap block before it needs a bigger one. In 2.1 Stack, heap and lifetime.
    std::size_t
    The unsigned type the standard library uses for sizes and indexes, like the result of .size(). In 1.2 Integers and floating-point numbers.
    sizeof
    Gives the size of a type or variable in bytes, while compiling. In 1.2 Integers and floating-point numbers.
    small-string optimization (SSO)
    Storing short text inside the string object itself, so it needs no heap block. How short depends on the standard library. In 3.1 string and string_view.
    smart pointer
    An object that holds a pointer and deletes what it points to when it's destroyed. It's RAII for one heap object. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    source file
    A plain text file of C++ code that you write. Its name usually ends in .cpp. In 0.1 How a C++ program is built.
    std::span<T>
    A view of elements that live somewhere else: a pointer to the first one plus a count. It owns nothing and copies nothing. In 2.4 Arrays, std::array and std::span.
    spatial locality
    Using data that sits close to data you just used, so it's already in the same cache line or the next one. In 9.2 Caches and data-oriented design.
    special member functions
    The six functions the compiler can write for a class by itself: the default constructor, the destructor, the copy constructor and copy assignment, and the move constructor and move assignment. In 4.2 Constructors, destructors and the rule of zero.
    specialization (template <>)
    A separate definition of a template for particular arguments. The compiler uses it instead of the general one. In 6.2 Class templates.
    speedup
    How many times faster the parallel version is: the time on one thread divided by the time on several. In 10.3 Parallel work.
    stack
    The memory that holds each function call's local variables. It grows when a function is called and shrinks when it returns. In 2.1 Stack, heap and lifetime.
    stack frame
    The block of memory a call uses for its parameters and local variables. It's created when the call starts and removed when it returns. In 1.5 Functions, 2.1 Stack, heap and lifetime.
    stack overflow
    A crash that happens when the stack runs out of room, usually because of very deep recursion. In 2.1 Stack, heap and lifetime.
    stack unwinding
    While an exception travels to its catch, every local object in the functions it leaves is destroyed, newest first. In 5.1 Exceptions.
    standard error (stderr)
    A second output, kept apart from stdout, for error messages. std::cerr writes here. In 1.6 Printing and reading: std::print, std::format and streams.
    standard input (stdin)
    Where a program reads its input: what you type, or a file you send to it. std::cin reads from here. In 1.6 Printing and reading: std::print, std::format and streams.
    standard library
    The functions and types that come with every C++ compiler. Their names start with std::. In 0.1 How a C++ program is built.
    standard output (stdout)
    Where a program's normal output goes: usually the terminal. std::println and std::cout write here. In 1.6 Printing and reading: std::print, std::format and streams.
    static library
    An archive of object files, such as libdna.a. The linker copies the parts a program uses into the program. In 8.2 CMake and libraries.
    static member
    A member that belongs to the type itself, not to each object. You use it as Type::name, and there is one copy for the whole program. In 4.1 Structs and classes.
    static storage (static)
    Memory for objects that exist for the whole run of the program, like a static local variable. In 2.1 Stack, heap and lifetime.
    static type and dynamic type
    The static type is what the code says a reference or pointer refers to (const Layer&). The dynamic type is the real type of the object there at run time (Relu). In 4.6 Inheritance and virtual functions.
    static_assert(condition)
    Checks a condition while compiling. If it's false, the program doesn't compile. In 5.3 Undefined behavior, assertions and sanitizers.
    static_cast<T>(x)
    Converts x to type T on purpose, so readers and the compiler know you meant it. In 1.2 Integers and floating-point numbers.
    std::stop_token
    What a std::jthread hands its function so the function can check stop_requested() and finish early. In 10.1 Threads and jthread.
    stream
    An object you write text to or read text from in order, like std::cout or std::cin. From <iostream>. In 1.6 Printing and reading: std::print, std::format and streams.
    strict aliasing rule
    Reading an object through a pointer to an unrelated type, like a float through a std::uint32_t*, is undefined behavior. Byte types (char, unsigned char, std::byte) are the exception. In 9.5 Bits, bit_cast and endianness.
    stride
    The distance in bytes from one element of an array to the next. For an array of T it's sizeof(T), padding included. In 9.1 Layout, alignment and padding.
    strided split
    Thread t of n takes items t, t + n, t + 2n and so on, so long and short reads spread evenly over the threads. In 12.4 Processing reads in parallel.
    std::string
    A piece of text of any length, like "GATTACA", written in double quotes. It comes from <string>. In 1.1 Variables and initialization.
    string literal
    Text in double quotes in your code, like "ACGT". Its type is an array of const char, not std::string. In 3.1 string and string_view.
    std::string_view
    A read-only view of characters that live somewhere else: a pointer to the first one and a length. It owns nothing and copies nothing. In 3.1 string and string_view.
    std::strong_ordering, std::partial_ordering
    What <=> returns: less, equal or greater, plus unordered for a partial ordering, where some values (like a floating-point NaN) can't be compared. In 4.4 Operators and comparisons with <=>.
    struct
    A type you define yourself, made of named fields. Module 4 covers it. In 2.1 Stack, heap and lifetime, 4.1 Structs and classes.
    structured binding
    auto [a, b] = x; gives a name to each part of a pair, tuple, array or struct. auto& makes the names refer to the parts of x itself. In 3.4 optional, variant and tuple.
    subspan
    A smaller span over part of a span: s.subspan(offset, count). In 2.4 Arrays, std::array and std::span.
    suffix
    Letters after a literal that set its type: 42u is unsigned, 2.5f is a float. In 1.2 Integers and floating-point numbers.
    switch and case
    switch (x) jumps to the case label that matches x, or to default if none does. In 1.4 Control flow.
    symbol
    A name in an object file's table, such as a function, marked either as defined in that file or as needed from another. In 0.1 How a C++ program is built.

    T

    T* const
    A pointer that can't be pointed at another object. The object can still be changed through it. In 2.3 Pointers.
    target
    Something CMake builds, an executable or a library, with its own source files, flags and dependencies. In 8.2 CMake and libraries.
    TBB
    oneAPI Threading Building Blocks, a C++ library of thread pools and parallel loops. GCC's standard library runs the parallel algorithms on it; link it with -ltbb. In 10.3 Parallel work.
    template
    A pattern for a function or a type, with placeholders that the compiler fills in. Code written this way, once for many types, is called generic code. In 6.1 Function templates.
    template argument
    The real type that fills a template parameter, like int in larger<int>. Written in angle brackets, it's an explicit template argument. In 6.1 Function templates.
    template argument deduction
    The compiler working out the template arguments from the types of the function's arguments. In 6.1 Function templates.
    template parameter
    A placeholder in a template, like T in template <typename T>. typename (or class, which means the same here) says it stands for a type. In 6.1 Function templates.
    temporal locality
    Using the same data again soon, while it's still in the cache. In 9.2 Caches and data-oriented design.
    terminal
    A window where you type commands for the computer to run, such as a build command. In 0.1 How a C++ program is built.
    std::terminate
    The function C++ calls when exception handling can't continue, such as an exception nobody catches. It ends the program. In 5.1 Exceptions.
    ternary operator (c ? a : b)
    Gives a if the condition c is true and b if it's false. In 1.3 Operators and bit operations.
    test case (TEST_CASE)
    One named test: a block of code with checks in it. A test program usually has many. In 8.4 Testing.
    test framework
    A library that runs your tests and reports which ones failed, where, and with what values. This lesson uses Catch2. In 8.4 Testing.
    this
    Inside a member function, a pointer to the object the function was called on. In 4.1 Structs and classes.
    thread
    One path of execution through your program. A program starts with one thread, the one running main; it can start more, and they all share the program's memory. In 10.1 Threads and jthread.
    thread pool
    A fixed set of threads started once and reused for many small tasks, so you don't pay to start a thread per task. In 10.3 Parallel work.
    ThreadSanitizer
    A sanitizer that finds data races while the program runs. Turn it on with -fsanitize=thread; it can't be combined with AddressSanitizer. In 10.1 Threads and jthread.
    throw
    Starts an exception: throw std::runtime_error("disk full");. The rest of the function doesn't run. In 5.1 Exceptions.
    std::to_underlying
    A function from <utility> (C++23) that turns an enum value into its number, in the enum's underlying type. In 4.5 enum class.
    traceback
    Walking back through a filled table from the final cell, following the choices that produced each score, to recover the alignment itself. In 12.3 Sequence alignment.
    trailing return type (-> T)
    A return type written after the parameter list, as in [](int q) -> double { … }. In 7.1 Lambdas.
    transform
    Changes the value with a step that can't fail, if there is one. An error passes through unchanged. In 5.2 optional and expected for errors.
    translation unit
    One source file after the preprocessor has pasted in its headers. The compiler works on one translation unit at a time and knows nothing about the others. In 8.1 Headers, source files and the one-definition rule.
    trivially copyable
    A type whose objects can be copied byte by byte, like a struct of numbers. std::is_trivially_copyable_v<T> checks it. In 9.1 Layout, alignment and padding.
    try and catch
    try { … } marks code whose exceptions you want to handle. Each catch (const T& e) { … } after it runs when an exception of type T (or a type derived from it) leaves the try block. In 5.1 Exceptions.
    std::tuple<A, B, C, …>
    Any fixed number of values, of any types, reached by position with std::get<0>, std::get<1> and so on. From <tuple>. In 3.4 optional, variant and tuple.
    two's complement
    How signed integers are stored: negative numbers count down from all bits set, so -1 is every bit set to 1. In 1.2 Integers and floating-point numbers.
    type
    What kind of value a variable holds, like a whole number or text. It decides how many bytes the variable uses and what you can do with it. In 1.1 Variables and initialization.
    type alias (using)
    A second name for a type: using Embedding = Vec<float, 4>;. In 6.2 Class templates.
    type constraint (template <std::integral T>)
    A concept written in place of typename in the template header. Short for a requires clause on that one type. In 6.3 Concepts.

    U

    undefined behavior
    Code the C++ rules give no meaning to. The compiler doesn't have to catch it, and the program might crash, print garbage or seem to work. In 0.2 Setting up: compilers, warnings and sanitizers, 1.1 Variables and initialization, 1.2 Integers and floating-point numbers, 5.3 Undefined behavior, assertions and sanitizers.
    UndefinedBehaviorSanitizer
    A checker built in with -fsanitize=undefined. It stops the program and reports undefined behavior like signed overflow. In 1.2 Integers and floating-point numbers.
    UndefinedBehaviorSanitizer (UBSan)
    The sanitizer for broken rules such as a number too big for its type, or an array index past the end. In 0.2 Setting up: compilers, warnings and sanitizers.
    underlying type
    The integer type an enumeration is stored as. int for an enum class unless you choose another with : type. In 4.5 enum class.
    std::unexpected(e)
    Wraps an error so it can be returned as a std::expected: return std::unexpected(BaseError::ambiguous);. In 5.2 optional and expected for errors.
    uninitialized variable
    A variable declared inside a function without a first value. It holds whatever bytes were already in its memory, and reading it is undefined behavior. In 1.1 Variables and initialization.
    std::unique_ptr<T>
    A smart pointer with exactly one owner. It can't be copied, only moved. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    unnamed namespace
    namespace { … } in a source file. Everything inside has internal linkage, so other files can't see it or clash with it. In 8.1 Headers, source files and the one-definition rule.
    std::unordered_map<K, V>
    A map that keeps its pairs in a hash table, in no particular order. Usually faster than std::map. From <unordered_map>. In 3.3 Maps and sets.
    unsigned
    An integer type that holds only zero and positive values, up to about twice as high. unsigned int is an example. In 1.2 Integers and floating-point numbers.
    unsigned int
    A whole number that can't be negative. In 0.2 Setting up: compilers, warnings and sanitizers.
    use_count()
    The number of shared_ptrs that currently own the object. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    using enum
    Makes an enumeration's names usable without the type's name in front, inside the current scope. In 4.5 enum class.

    V

    variable
    A named piece of memory that holds one value of a fixed type. In 1.1 Variables and initialization.
    std::variant<A, B, …>
    Holds exactly one value at a time, of one of the listed types, called its alternatives. From <variant>. In 3.4 optional, variant and tuple.
    vector register (xmm, ymm), lane
    A wide CPU register that holds several values side by side: an xmm register is 128 bits (4 floats), a ymm register 256 bits (8 floats). Each value's slot is a lane. In 9.4 SIMD.
    view
    A range that's cheap to copy or move because it doesn't hold a copy of the elements. Usually it refers to another range and describes a step, such as keep the good ones, to apply as you read it. In 7.3 Ranges and views.
    virtual destructor
    A destructor marked virtual, so deleting a derived object through a base pointer runs the derived class's destructor too. In 4.6 Inheritance and virtual functions.
    virtual function
    A member function whose version is picked at run time, from the object's dynamic type, when you call it through a base reference or pointer. In 4.6 Inheritance and virtual functions.
    std::visit(f, v)
    Calls f, the visitor, with whatever the variant v holds. The visitor must accept every alternative. In 3.4 optional, variant and tuple.
    void
    The return type of a function that hands nothing back. In 1.5 Functions.
    void*
    A pointer to an object of unknown type. std::println prints one as an address. In 2.3 Pointers.
    vtable and vptr
    How GCC and Clang implement virtual calls: one table of function addresses per class (the vtable), and a hidden pointer to it in each object (the vptr). In 4.6 Inheritance and virtual functions.

    W

    warning
    A message about code that compiles but is probably a mistake. On its own, a warning doesn't stop the build. In 0.2 Setting up: compilers, warnings and sanitizers.
    weak symbol (W)
    A symbol that several object files may define. The linker keeps one copy and drops the rest. In 6.1 Function templates.
    std::weak_ptr<T>
    A pointer to an object owned by shared_ptrs that doesn't count as an owner. lock() gives you a shared_ptr if the object still exists. In 2.6 Smart pointers: unique_ptr and shared_ptr.
    while and do/while
    while checks its condition before each iteration; do/while checks it after, so the body runs at least once. In 1.4 Control flow.
    whitespace
    Spaces, tabs and newlines. >> skips it before a value and stops reading at it. In 1.6 Printing and reading: std::print, std::format and streams.
    width
    The least number of characters a value takes up. Shorter values are padded. In 1.6 Printing and reading: std::print, std::format and streams.
    work queue
    A queue, safe to use from several threads, that one thread fills with work and worker threads take work from. In 12.4 Processing reads in parallel.
    wrap around
    Going past the largest value starts again at zero, and going below zero starts again at the largest value. In 1.2 Integers and floating-point numbers.
    WSL
    Windows Subsystem for Linux: a real Linux, such as Ubuntu, running inside Windows. In 0.2 Setting up: compilers, warnings and sanitizers.