C++ 17 In Detail Book Review

Since its creation, C++ evolved continuously and it passed many major milestones from the C with classes to the rise of the new standards. From 1991 to 2011 the language evolved slowly and the evolution comes from the libraries like STL and Boost. However, from 2011 many features were added to the standard, thanks to the new standards C++11, C++14, C++17, and the coming C++20.

Recently the C++ community promotes the use of new standards to modernize the existing code base.  Bartłomiej Filipek is one of the most active bloggers from the C++ community who contribute to promoting the new standards. He wrote an excellent book about the C++17 standard features. And here’s a quick review of his book.

Pragmatic approach

In the computer science world, there are many academic books mostly destined to students and there are some other books mainly destined to the developers who need an advice of how to resolve real problems when developing a product.  You learn by coding, indeed few pages do not contain source code. Every explanation is demonstrated by at least one code sample.

The code samples are very well formatted, easy to read and clean.

Also, the book author gives us much practical info like the compiler support for each feature.

The Whole picture from the beginning:

In general to have an idea about a book content we can take a look at the index and read the introduction. However, in many cases, it’s not really sufficient to have a clear idea about the goal of the book.

What’s interesting in this book is that we have a “Quick Overview” section which contains 4 pages and explains clearly the content of the book.

New Language features demystified:

The book enumerates almost all the new C++17 features grouped by section.

Even if some features are difficult to understand, Bartłomiej Filipek adopts the “Keep it simple” approach and any feature is very well explained using basic samples. For example in the templates new features section which includes:

  • Template argument deduction for class templates
  • template<auto>
  • Fold expressions
  • if constexpr – the compile-time if for C++! •
  • Plus some smaller, detailed improvements and fixes

You will be impressed by the clarity provided by the explanations and the code samples. Every C++ developer even a beginner one could understand the utility of these new features.

New standards library features demystified

The good news is that the standard library evolves in each new standard and many new interesting features are added. Here are the C++17 standard library features treated in the book:

  • How to represent nullable types with std::optional.
  • What’s a tagged union? And why we need a type-safe union in the form of std::variant.
  • How to represent any type with std::any.
  • How to use string_view to gain performance and not break your application
  • What are the new string operations available in the Standard Library.
  • How to work with the filesystem using the Standard Library.
  • What are the parallel algorithms.

Each feature is explained in detail using many code samples.  And what’s interesting is that the author talks also about performance & memory consideration and explains how a feature could impact the performance and memory usage.

More samples and uses cases

At the end of the book, other interesting problems are exposed. The author tries to give many solutions and explains how the new standard resolve them better than the old features.

Conclusion:

When reading the book it’s clear that the author is a programmer who worked on many C++ projects to resolve real problems. Which explains the pragmatic approach of the book. We recommend this book to each developer who wants to master the new C++17 standard.

The book is available @Leanpub, and as our reader, you can buy it ~15% cheaper by using the following coupon link:

https://leanpub.com/cpp17indetail/c/codergears