Free through lesson 3

C++ for Beginners

From building with clang++ and iostream to classes and RAII, the STL, templates, smart pointers, ranges and threads, and finally CMake and unit tests. Over 50 lessons, you'll get to the point where you "let types manage resource lifetimes, and can build and ship one small tool." Every code sample, compile error, and sanitizer report was actually run with clang++ 21 (C++23).

Curriculum

The 50 lessons are split into 7 chapters. We recommend going in order from chapter 1, but feel free to jump to whatever interests you. Note: C++ can't run in the browser, so compile and try the samples locally with clang++ 16 or later, or g++ 13 or later (with C++23 support). The course assumes you know C (pointers and malloc).

Chapter 1 — From C to C++ (lessons 1–7)

You'll rewrite code you could write in C using C++ tools, learning iostream, references, namespaces, auto, range-based for, and overloading along the way. By the end of this chapter, you'll be able to read and write C code as C++.

1

Your First Steps in C++ (Building with clang++)

Just the differences a C programmer hits first: building with clang++, Hello World with iostream, how it differs from printf, and the one spot where C code stops compiling as C++.

Free
2

std::string and I/O

Freedom from managing char arrays and '\0'. Concatenation, comparison, substrings, reading a line, and measuring why you shouldn't write std::endl on every line.

Free
3

References (&): Modifying Without Writing Pointers

Rewrite C's "modify the caller" functions, full of & and *, with references. Check addresses to see a reference is a non-rebindable alias and that const references avoid copies.

Free
4

Namespaces and using

Create a clash between functions with the same name, then wrap them in a namespace. Why to avoid using namespace std, namespace aliases, and anonymous namespaces as a replacement for C's static.

🔒 Basic
5

auto and Range-Based for

auto lets you skip writing type names, and range-based for replaces index loops. Forgetting auto & makes a copy, and auto can pick up a type you didn't intend.

🔒 Basic
6

Function Overloading and Default Arguments

Provide a same-named function for each type. The order in which one is chosen, cases that stop as ambiguous, and accidents when combined with default arguments.

🔒 Basic
7

nullptr, enum class, and Structured Bindings

Replace risky habits inherited from C with C++ alternatives. NULL vs nullptr, typed enumerations, and structured bindings for receiving two return values.

🔒 Basic

Chapter 2 — Classes and RAII (lessons 8–14)

You'll bundle data and behavior into classes, and let constructors and destructors tie resource lifetimes to types. Then you'll cover copying, moving, and operator overloading, ending with types you wrote yourself that work naturally with = and +.

Chapter 3 — STL (lessons 15–22)

You'll learn vector, map, and set, plus the iterators and algorithms that cut across all of them. Loops you used to write by hand become a single line from <algorithm>, and lambdas let you pass "how to compare" right on the spot.

15

std::vector Basics

Replace the "growable array" you built with malloc and realloc. Adding, accessing, and removing, what happens when you go out of range, and making a 2D vector.

🔒 Basic
16

How vector Grows (capacity and reserve)

Measure the difference between size and capacity. How many reallocations happen, how much faster reserve makes things, and a sanitizer catching references invalidated by reallocation.

🔒 Basic
17

std::map and std::unordered_map

Containers you look up by key. Ordered map vs fast unordered_map, the trap where [] silently creates elements, and when to use contains vs find.

🔒 Basic
18

std::set and Removing Duplicates

A container that drops duplicates and keeps things sorted just by inserting. Use insert's return value to tell if something was new, define your own ordering, and choose vs unordered_set.

🔒 Basic
19

Iterators

A common tool for walking through any container. Half-open ranges with begin and end, the link to pointers, what each kind can do, and invalidation.

🔒 Basic
20

The <algorithm> Essentials

Turn hand-written loops into one line. Sorting, searching, counting, summing, the erase-remove idiom, and binary search.

🔒 Basic
21

Lambda Expressions

Small functions written on the spot. Syntax, capture by value vs by reference, mutable, return types, lifetime traps, and std::function.

🔒 Basic
22

Combining Algorithms and Lambdas

Using sales data, chain sorting, filtering, transforming, and aggregating. back_inserter and transform, binary operations for accumulate, and stable sorting.

🔒 Basic

Chapter 4 — Templates (lessons 23–29)

Stop copying the same logic for every type and fold it into one template. You'll cover specialization, parameter packs, constexpr, and concepts, and get to the point where you can read template errors on your own.

Chapter 5 — Memory and Ownership (lessons 30–36)

First you'll actually break things with new and delete, then replace them with unique_ptr and shared_ptr. You'll learn to write code that doesn't leak resources even when exceptions fly, and finish by checking the Rule of Five with a string class you write yourself.

Chapter 6 — Modern C++ (lessons 37–44)

This chapter covers optional, variant, string_view, span, and ranges, plus threads and synchronization. You'll express "a value that might be missing" and "exactly one of several types" with types, and run multiple tasks at the same time.

Chapter 7 — Building It for Real (lessons 45–50)

You'll put together header splitting, CMake, unit tests, and sanitizers to finish one small tool. Finally, we'll line up the differences from C and Rust and hand you a map of where to go next.

Once you've finished all 50 lessons, move on to Rust for Beginners, where the compiler watches ownership for you; the C Intro Course, the foundation C++ is built on; or Intro to Shipping and Running a Service, to ship what you build. A membership unlocks every course.