The Missing
C++17 Reference

Learning to program, in C++17, from nothing.

Start with Chapter 0 →

Contents

Part 0 — Getting a compiler to obey

  1. 0Installing a Compiler Without Losing Your MindBefore you can write a line of C++, your computer needs a compiler. This is the hour that stops most people. Read the section for your own machine, ignore the other two, and finish with a program you built yourself.Project: Your toolchain

Part 1 — Writing programs

Productive from the first chapter, using the tools C++ actually gives you.

  1. 1Hello, World — and What Actually HappenedYou typed four lines in chapter 0 and a computer said hello back. Now find out what every single character in them was for — and print something of your own.Project: A fortune card
  2. 2Your First Error MessageYou are going to see thousands of these. Most people learn to read them by accident, slowly, over years. Here is the short version — the shape of a message, which one to read first, and the six you'll meet this week.Project: Fix the broken card
  3. 3Variables, and the Types They Insist OnChapter 1's program said the same thing every time. Here is how a program holds on to something — and why C++ makes you announce, up front, what kind of thing you are holding.Project: A receipt
  4. 4Strings: Text That Doesn't Fight BackIn most languages text is easy. In C++ it used to be famously awful, and then std::string arrived. Here is how to join it, measure it, cut pieces out of it, and find things inside it.Project: An initials formatter
  5. 5Input: Letting the Reader Talk Backcoming sooncin, getline, and why they disagree.
  6. 6Arithmetic, and Where It Betrays Youcoming soonInteger division, remainder, precedence, and floating point.
  7. 7Deciding Things: if, else, and Booleanscoming soonComparison, and, or, and nesting without knots.
  8. 8Loops: Doing It Again Until It's Donecoming soonwhile, for, break, and the infinite loop you'll write anyway.
  9. 9Functions: Giving Work a Namecoming soonParameters, return values, and why you'd bother.
  10. 10std::vector: A List That Growscoming soonpush_back, indexing, and range-for.
  11. 11Printing, Poking, and Proving It Workscoming soonFinding a bug by hand, then with a debugger.
  12. 12Copies, References, and Not Wasting Workcoming soonBy value, by const reference, and by reference.
  13. 13Sorting and Searching Without Writing Eithercoming soonsort, find, and accumulate.
  14. 14struct: Things That Belong Togethercoming soonGrouping fields into one type of your own.
  15. 15Files: Making Your Program Remembercoming soonifstream, ofstream, and reading line by line.
  16. 16Maps: Looking Things Up by Namecoming soonstd::map and structured bindings.
  17. 17Validation: Assuming the Worstcoming soonChecking input, at() vs [], and std::optional.
  18. 18Classes: Types You Design Yourselfcoming soonMember functions, and why data goes private.
  19. 19Constructors, and Types That Can't Be Brokencoming soonInitialization, invariants, const members.
  20. 20Splitting a Program Across Filescoming soonHeaders, include guards, a Makefile, and linker errors.
  21. 21Interlude: Build Something Realcoming soonNo new syntax. An expense tracker that remembers.

Part 2 — Lifting the floor

Back to the machinery the standard library was handling for you.

  1. 22What a Variable Really Iscoming soonMemory, addresses, sizeof, and the stack.
  2. 23Pointers, Finallycoming soonStars and ampersands, and why they were worth waiting for.
  3. 24What std::string Was Hidingcoming soonchar arrays and the null terminator you never saw.
  4. 25Raw Arrays, and Why vector Existscoming soonNo size, no bounds, and decay.
  5. 26The Heap: new, delete, and What Goes Wrongcoming soonManual memory, so you can read old code.
  6. 27Ownership: Destructors Doing the Workcoming soonRAII and unique_ptr.
  7. 28Templates: One Function, Any Typecoming soonThe angle brackets from chapter 10, explained at last.
  8. 29Iterators, and What range-for Becomescoming soonbegin, end, and lambdas properly.
  9. 30Borrowing Without Owningcoming soonReferences, pointers, string_view, and dangling.
  10. 31Undefined Behaviour: When C++ Stops Promisingcoming soonSanitizers, and reading a crash.
  11. 32Where to Go Nextcoming sooncppreference, newer C++, and reading other people's code.