ProgrammingLearning library

Modern C++ foundations

Learn value-oriented C++ with standard containers and explicit resource ownership.

Beginner20 chapters14 practice questions5 references
Start coursePractise questions

Get an in-app notice when new lessons or practice are added.

20 chapters across 7 modules

Course chapters

Explore all 20 chapters in any order. Each chapter has learning goals, a practice prompt, and a primary reference; expanded reading pages are linked from their chapter titles.

01 · Core language4 chapters
  1. Compilation and a first program

    • Distinguish preprocessing, compilation, linking, and execution

    Practice: Compile a greeting and identify a linker versus syntax error.

    Read the primary referenceLesson guide · Ready
  2. Types and initialization

    • Use explicit initialization and identify narrowing conversions

    Practice: Represent a measurement with a suitable numeric type.

    Read the primary referenceLesson guide · Ready
  3. Control flow and functions

    • Trace loops and return values with clear boundaries

    Practice: Implement and test a temperature converter.

    Read the primary referenceLesson guide · Ready
  4. References, const, and parameters

    Choose parameter forms that communicate copying, borrowing, and mutation.

    • Explain mutation and copying at function boundaries

    Practice: Choose parameter forms for a small string-processing API.

    Read the primary referenceExpanded reading · Ready
02 · Collections and algorithms4 chapters
  1. Strings and vectors

    • Prefer standard owning containers for variable-size data

    Practice: Build and traverse a collection of reading durations.

    Read the primary referenceLesson guide · Ready
  2. Iterators and range loops

    • Understand iterator ranges and invalidation risks

    Practice: Remove selected items without using invalid iterators.

    Read the primary referenceLesson guide · Ready
  3. Algorithms and lambdas

    • Express searching, sorting, and transformation with standard algorithms

    Practice: Sort records by a field and explain the comparison contract.

    Read the primary referenceLesson guide · Ready
  4. Associative containers

    • Compare map and unordered_map tradeoffs

    Practice: Count token frequencies and describe lookup costs.

    Read the primary referenceLesson guide · Ready
03 · Resource ownership2 chapters
  1. Object lifetime and RAII

    Use lifetime to make cleanup predictable in C++.

    • Connect cleanup to object lifetime and scope

    Practice: Wrap a resource so normal exits and exceptions release it.

    Read the primary referenceExpanded reading · Ready
  2. Smart pointers

    • Choose unique ownership and justify shared ownership explicitly

    Practice: Model an object graph without raw owning pointers.

    Read the primary referenceLesson guide · Ready
04 · Value types and class design2 chapters
  1. Classes and invariants

    • Keep construction and public operations consistent with valid state

    Practice: Create a bounded counter that rejects invalid updates.

    Read the primary referenceLesson guide · Ready
  2. Copy and move semantics

    • Explain value transfer and the rule of zero

    Practice: Trace copies and moves in a small container example.

    Read the primary referenceLesson guide · Ready
05 · Reliable C++4 chapters
  1. Errors and exceptions

    • Describe error contracts and avoid undefined behavior

    Practice: Handle invalid input and verify cleanup on failure.

    Read the primary referenceLesson guide · Ready
  2. Templates and generic code

    • Write a constrained small generic operation

    Practice: Implement a reusable function for a pair of compatible values.

    Read the primary referenceLesson guide · Ready
  3. Build tools and sanitizers

    • Use diagnostics to investigate memory and lifetime mistakes

    Practice: Run warnings and a sanitizer on a reproduced defect.

    Read the primary referenceLesson guide · Ready
  4. Mini project: text index

    • Combine containers, algorithms, files, and tests

    Practice: Build a searchable index of a small local text collection.

    Read the primary referenceLesson guide · Ready
06 · Toolchains and program boundaries3 chapters
  1. Header and source organization

    • Explain declarations, definitions, and repeated inclusion

    Practice: Separate a small library interface and implementation.

    Read the primary referenceLesson guide · Ready
  2. Concurrency and data races

    • Distinguish shared data, synchronization, and lifetime risks

    Practice: Identify a data race in a shared counter and propose an appropriate contract.

    Read the primary referenceLesson guide · Ready
  3. API ownership review

    • Make resource transfer and error behavior explicit at an API boundary

    Practice: Review a small interface for dangling-reference and ownership ambiguity.

    Read the primary referenceLesson guide · Ready
07 · Further foundations and worked reasoning1 chapter
  1. Values and ownership

    Use standard containers and scoped resource owners to make lifetimes visible.

    • Explain object lifetime, value semantics, and deterministic resource cleanup

    Practice: Replace an owning raw pointer with a standard RAII owner and test the failure path.

    Read the primary referenceExpanded reading · Ready

Learn it. Check it. Try again.

14 original questions with worked explanations and source references. Filter by difficulty, revisit mistakes, and save your attempt as you go.

Open Modern C++ foundations practice

In-depth study guide

Follow the subject from its foundations through worked examples and practice. Each guide includes its scope, version assumptions, solutions, and sources for further study.

OpenLearning study guideEdition 2026.12

Modern C++: values, ownership, and reliable programs

Learn to reason about C++17 programs from types and functions through resource lifetime, containers, algorithms, testing, and an integrated capstone.

pages
72
chapters
14
diagrams
9
exercises with solutions
28

6,826 words of explanations and practice · 15 worked examples · 14 review questions

Improve this guide on GitHubOriginal text · CC BY-SA 4.0

Browse all study guides

Books & references

Free reading at the publisher or author’s site. External materials keep their own licenses.