Skip to content
Codescope

Track 02 · C++

The C++ track

Objects, RAII, move semantics, containers and vtables — as memory, not rules.

42 concepts mapped · 8 interactive now · 52 steps · free, no login

BeginnerStart here — no prior programming experience required.

01Beyond C

2 of 4 live

What C++ adds before you touch a class.

  1. 01

    References vs pointers

    A pointer is a box holding an address. A reference is not a box at all.

    intro8 min7 steps
    0%
  2. 02

    auto & type deduction

    upcoming

    What auto actually deduces, and when it drops const and references.

  3. 03

    Namespaces

    Scoping names, and why `using namespace std` belongs in no header.

    intro7 min6 steps
    0%
  4. 04

    Overloading & default arguments

    upcoming

    How the compiler picks between candidates, and when it refuses.

IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

02Objects

2 of 4 live

Classes as memory with rules attached.

  1. 05

    Class layout & this

    Members laid out like a struct; methods take a hidden `this` pointer.

    core8 min6 steps
    0%
  2. 06

    RAII: constructors, destructors & scope

    The closing brace is the cleanup code. That is the whole idea.

    core9 min6 steps
    0%
  3. 07

    Member initialisation

    upcoming

    Init lists vs assignment, and why declaration order wins.

  4. 08

    static members & lifetime

    upcoming

    One copy per class, initialised once, destroyed last.

03Value semantics

1 of 3 live

What happens when an object is copied.

  1. 09

    Copy vs move semantics

    A copy duplicates the data. A move just changes who owns it.

    core10 min6 steps
    0%
  2. 10

    The rule of five

    upcoming

    If you write one of them, you probably need all five.

  3. 11

    Operator overloading

    upcoming

    Giving your type built-in syntax, and when that is a mistake.

04Memory & ownership

1 of 3 live

Who deletes what, and when.

  1. 12

    new & delete

    upcoming

    Manual heap allocation, and why you should rarely write it.

  2. 13

    unique_ptr & shared_ptr

    Ownership written into the type, so the compiler enforces what a comment used to.

    core10 min7 steps
    0%
  3. 14

    weak_ptr & reference cycles

    upcoming

    Two shared_ptrs pointing at each other never reach zero.

05Containers & the STL

1 of 4 live

What the standard library is doing underneath.

  1. 15

    How std::vector grows

    Contiguous, dynamic, and occasionally it moves everything you own.

    core10 min7 steps
    0%
  2. 16

    std::string & small-string optimisation

    upcoming

    Short strings live inside the object; long ones do not.

  3. 17

    map vs unordered_map

    upcoming

    A balanced tree against a hash table — ordering versus speed.

  4. 18

    Iterators & ranges

    upcoming

    A generalised pointer, and the invalidation rules that bite.

06Polymorphism

1 of 3 live

One interface, many implementations.

  1. 19

    Inheritance & object layout

    upcoming

    The base class sits at the front of the derived object.

  2. 20

    Virtual functions & the vtable

    The object carries a hidden pointer that decides which function runs.

    deep11 min7 steps
    0%
  3. 21

    Abstract classes & interfaces

    upcoming

    Pure virtual functions, and designing to an interface.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

07Templates & generics

0 of 3 live

Code written once, compiled per type.

  1. 22

    Templates & instantiation

    upcoming

    One template, one generated function per type you use.

  2. 23

    Specialisation

    upcoming

    Overriding the generic version for a specific type.

  3. 24

    Concepts & constraints

    upcoming

    Saying what a template requires, and getting readable errors.

IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

08Errors & modern C++

0 of 3 live

Failure handling and the features that changed the style.

  1. 25

    Exceptions & stack unwinding

    upcoming

    Every destructor between throw and catch runs, in order.

  2. 26

    Lambdas & captures

    upcoming

    A generated class with the captured variables as members.

  3. 27

    Structured bindings & std::optional

    upcoming

    Unpacking values, and representing absence without a sentinel.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

09Template metaprogramming

0 of 4 live

Using the template system as a compile-time programming language.

  1. 28

    SFINAE & tag dispatch

    upcoming13 min

    Substitution failure is not an error — the compiler just tries the next overload.

    • Read enable_if declarations without flinching
    • Choose between overloads with tag types
    • Understand why concepts (C++20) replace most SFINAE
  2. 29

    Variadic templates & parameter packs

    upcoming12 min

    One template that takes any number of arguments of any types.

    • Write a template that recurses on Head, Tail...
    • Use fold expressions to sum, join, or apply over packs
    • Implement a simple make_tuple
  3. 30

    CRTP (Curiously Recurring Template Pattern)

    upcoming11 min

    A derived class passing itself back to the base — static polymorphism without vtables.

    • Recognise the class Derived : public Base<Derived> shape
    • Implement compile-time polymorphism with zero runtime cost
    • Use CRTP to add operators (== implies !=) via mixin base
  4. 31

    Type traits & <type_traits>

    upcoming10 min

    Ask the compiler what a type is, at compile time.

    • Use is_integral, is_pointer, remove_const, decay, etc.
    • Write your own trait with template specialisation
    • Combine traits with if constexpr for typed branches

10Concurrency (C++)

0 of 4 live

The standard library primitives for concurrent code.

  1. 32

    std::thread & joining

    upcoming11 min

    Launching a function on another core, and making sure it actually finishes.

    • Start threads with std::thread and pass arguments
    • Understand the difference between join() and detach()
    • Use jthread (C++20) to auto-join on destruction
  2. 33

    std::async, futures & promises

    upcoming12 min

    Ship a value from one thread to another without touching a mutex yourself.

    • Return a value from an async task
    • Chain work with then-continuations
    • Recognise the launch::async vs launch::deferred trap
  3. 34

    std::atomic & memory_order

    upcoming13 min

    The C++ version of C's atomics — with proper types and clear ordering.

    • Use atomic<int> for counters
    • Choose between memory_order_relaxed, acquire, release, seq_cst
    • Implement a spinlock with atomic_flag
  4. 35

    Coroutines in C++20

    upcoming14 min

    co_await, co_yield, co_return — functions that can suspend and resume.

    • Understand the promise_type / awaiter machinery
    • Write a generator with co_yield
    • Use a coroutine to unify sync and async code

11Modern C++ features

0 of 4 live

Language changes from C++17, 20, and 23 that shape modern style.

  1. 36

    Ranges & views

    upcoming12 min

    Compose transformations over sequences — filter, transform, take — without intermediate containers.

    • Chain views::filter | views::transform | views::take
    • Understand lazy evaluation and why views hold no state
    • Convert between iterator pairs and ranges
  2. 37

    Modules (C++20)

    upcoming10 min

    The replacement for #include, with proper encapsulation and faster compiles.

    • Write a module interface and implementation partition
    • Understand why modules compile faster than headers
    • Migrate a small library from #include to import
  3. 38

    Three-way comparison (<=>)

    upcoming9 min

    Define one operator and get ==, <, >, <=, >= for free.

    • Return strong_ordering, weak_ordering, partial_ordering appropriately
    • Default the spaceship for aggregate comparison
    • Understand why float uses partial_ordering
  4. 39

    constexpr & consteval

    upcoming11 min

    Force computation at compile time — errors surface before the program runs.

    • Mark functions constexpr and see what compiles at build time
    • Use consteval to require compile-time evaluation
    • Compute lookup tables at build time to shrink runtime cost

12Performance & customization

0 of 3 live

Tuning allocation and layout when the profiler points at std::.

  1. 40

    Writing a custom allocator

    upcoming13 min

    Give std::vector its own memory pool — one call to malloc, thousands of pushes.

    • Satisfy the Allocator concept with rebind and allocate
    • Build an arena allocator for short-lived objects
    • Measure the throughput win versus std::allocator
  2. 41

    Polymorphic memory resources (PMR)

    upcoming11 min

    Runtime-selectable allocators without changing the container's type.

    • Use std::pmr::vector with monotonic_buffer_resource
    • Understand why pmr avoids template code bloat
    • Nest resources to build a fallback chain
  3. 42

    Empty base optimisation (EBO)

    upcoming8 min

    An empty base class takes zero bytes — a plain empty member takes one.

    • Explain why a stateless comparator as a base is free
    • Use [[no_unique_address]] (C++20) to shrink members
    • Recognise EBO in the standard library

The full syllabus is listed above in teaching order. Concepts marked upcoming are mapped but not yet built as visualizations. Progress is kept in this browser only.