0. How to Use This Book

This book picks up where Gorgo Starting C++ left off. It assumes you are comfortable with variables, strings, control flow, functions, containers, I/O, exceptions, classes, and memory management. If any of those topics feel shaky, revisit the relevant chapter in Gorgo Starting C++ before continuing.

Each chapter introduces topics that working C++ programmers use regularly, with explanations, code examples, and exercises.

Tips

Tips call out details that you need to pay special attention to. Traps warn you of common mistakes made. Wut calls out a detail that is counter-intuitive, so make sure you pay attention.

Function Signatures

When this book introduces a new function, it shows the function’s signature and return type. A function’s signature is its name and parameter list — it uniquely identifies the function. We also show the return type so you know what the function gives back. For example:

std::optional<T> find_value(const std::map<K, V>& m, const K& key);

This tells you that find_value takes a map and a key and returns an std::optional. You do not need to understand every detail the first time you see it, but it gives you three things at a glance: what the function is called, what goes in, and what comes out.

Try It

As the intro to the most amazing programming language book ever written starts out:

The only way to learn a new programming language is by writing programs in it.

You need to write some code. Make sure you try writing some programs from scratch. At the end of most sections is a starter program that you can type in and modify to play with. Don’t use it as an excuse to avoid writing some of your own starter programs. It’s the only way to master a language.

Exercises

Don’t skip the exercises at the end of the chapters. You can get the answer key, but don’t look at the answer key before you work out the answer yourself. If you look at the answer key first, the concepts will not sink in.