Discovering Modern C++
608 pages
English
PDF
4.5

Discovering Modern C++

Discovering Modern C++

Author:

Year:

Summary:

Introduction

The book «Discovering Modern C++» (original title Discovering Modern C++) by Peter Gottschling is not just another introduction to the language, but a full-fledged textbook for those already familiar with the basics of C++ who want to master its modern capabilities. The 2021 edition covers the C++11, C++14, C++17, and C++20 standards, making it one of the most up-to-date guides available today. The book's volume is 608 pages of dense but well-structured material.

What is this book about?

The book is structured as a sequential deep dive into the key mechanisms of modern C++. The author does not waste time explaining basic syntax (variables, loops, functions) but immediately moves on to topics that distinguish professional C++ from academic C++:

  • Smart pointers (unique_ptr, shared_ptr, weak_ptr) and memory management without leaks.
  • Move semantics and perfect forwarding.
  • Lambda expressions and closures — from simple to complex with state capture.
  • Templates — from basic to variadic templates and SFINAE.
  • Standard Template Library (STL) — containers, algorithms, iterators, function objects.
  • Concurrency and multithreading — std::thread, mutexes, atomic operations, futures.
  • New features of C++17/20 — std::optional, std::variant, std::any, concepts, coroutines, and ranges.
  • Performance — how to write fast code and how to profile.

Who is this book for?

The book is intended for programmers who already write in C++ (or another compiled language) and want to transition to modern standards. It will be useful for:

  • Developers working with legacy C++98/03 code who want to modernize it.
  • Senior students in technical fields studying systems programming.
  • Engineers transitioning from C or Java to C++ who need a deep understanding of language idioms.
  • Anyone preparing for C++ interviews at major IT companies (Google, Microsoft, JetBrains, etc.).

What will the reader learn?

After reading, you will be able to:

  • Write safe and efficient code using smart pointers and RAII.
  • Understand and apply move semantics for performance optimization.
  • Create generic algorithms using templates and concepts.
  • Use lambdas for concise data processing.
  • Work with multithreading and synchronization without data races.
  • Apply new types from C++17/20 (optional, variant, any) for more expressive code.
  • Design libraries and APIs that are user-friendly.

Strengths of the book

1. Relevance. The book covers standards up to C++20, including new features like coroutines and ranges. This is rare even among English-language publications from 2021-2023.

2. Depth without unnecessary complexity. The author explains complex topics (e.g., SFINAE or move semantics) with examples that can be immediately run and experimented with. At the same time, he avoids academic digressions and focuses on practical application.

3. Structure. Each chapter begins with a brief introduction and ends with a summary and exercises. The exercises are not "write a calculator" but tasks that test understanding of modern mechanisms specifically (e.g., implement your own unique_ptr or write a template function that works with any container).

4. Code. All examples compile and have been tested on several compilers (GCC, Clang, MSVC). The author gives advice on choosing the compiler version and flags.

5. Performance. The book contains a lot of

Recommendations