Book review: Mastering the C++17 STL

Mastering the C++17 STL

Make full use of the standard library components in C++17

Mastering the C++17 STL

Author:

Arthur O'Dwyer

Pages:

384

Published by:

Pack Publishing 2017

  • Topics

    C++, STL, containers, smart pointers, iterators, regular expressions, iotreams, filesystem, algorithms, random numbers, concurrency, threads, synchronization, allocators.

  • Level - Medium

    This book is for programmers with some experience. It requires basic knowledge about classes, inheritance and templates (including metaprogramming).

Review

Mastering C++17 STL by Arthur O’Dwyer is a book which describes design, API and best practices of the C++ STL. Author uses simple, but strict and technical language to describe one by one most important parts of the C++ standard library. Each chapter is devoted to one area. Their order makes reader feel, that each one fulfills and cooperates with the previous one.

Topics in the book include:

  • iterators,
  • algorithms,
  • containers,
  • allocators,
  • iostreams,
  • smart pointers,
  • multithreading,
  • regular expressions,
  • filesystem support.

Each chapter stars by stating some typical programming problem (most have code examples). Next, author introduces reader to the STL mechanisms which solves that problem. Usually presented functionalities have multiple variants. Author skilfully signals their presence and advices when to use each alternative. An excellent example is the chapter about containers. Each of them, except for the general description, is presented in terms of cases where code will benefit the most.

The book is pleasant to read. At every step author sneaks in good points about potential optimizations that compiler can apply when STL is used. The legendary “composability” of standard library mechanisms is clearly visible in many places. An example would be iterators, which are a link between algorithms and containers. In general, author’s great knowledge and his admiration for the well-thought architecture of the standard library can be felt all the time.

When it comes to the subject which usually annoys me, book title, I can’t say that I’m very disappointed. “C++17” in the title is often used as a bait for the potential readers. In practice references to the particular standard are minimal. In the case of Arthur O’Dwyer’s book, it has to be clearly stated that it is a solid guide into the STL as a whole, not the C++17 additions. But wherever new standard introduced significant corrections and improvements, it is clearly emphasized with a side note.

Summing up, I believe that Mastering C ++ 17 STL is at least a highly recommended book for every programmer, both a beginner and an experienced engineer who wants to refresh or organize his existing knowledge. I recommend reading it cover to cover, because among the simple descriptions of STL resources you can find gems related to optimization or non-standard use. 

 

What I liked about the book

  1. Book is very actionable with lot’s of real-world code examples.
  2. Author gives deep insight into the STL architecture.
  3. There are many optimization tips and good practices.
  4. Even experienced programmers will learn a lot new things.

What I didn't like about the book

  1. There are far less C++17 references that I expected.
  2. I missed the exercises after each chapter.