Blog 3 min read

C++ 17 In Detail Book Review

Share this article
C++ 17 In Detail Book Review

Since its creation, C++ has evolved continuously and passed many major milestones, from C with Classes to the rise of the new standards. From 1991 to 2011 the language evolved slowly, and the evolution came from libraries like the STL and Boost. However, from 2011 on, many features were added to the standard thanks to C++11, C++14, C++17, and the upcoming C++20. Recently, the C++ community has been promoting the use of the new standards to modernize existing code bases. Bartłomiej Filipek is one of the most active bloggers in the C++ community, and he helps promote 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 intended for students, and other books mainly intended for developers who need advice on how to solve real problems when developing a product. You learn by coding — indeed, few pages do not contain source code, and every explanation is demonstrated by at least one code sample. The code samples are very well formatted, easy to read and clean.

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

The Whole picture from the beginning:

In general, to get an idea of a book’s content we can take a look at the table of contents and read the introduction. However, in many cases that’s not really enough to have a clear idea of the book’s goals. What’s interesting about this book is that it has a “Quick Overview” section of 4 pages that clearly explains the content of the book. New language features demystified: The book covers almost all the new C++17 features, grouped by section. Even though some features are difficult to understand, Bartłomiej Filipek adopts the “keep it simple” approach, and every feature is very well explained using basic samples — for example, in the new template 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 of the explanations and the code samples. Every C++ developer, even a beginner, can understand the purpose of these new features. New standard library features demystified The good news is that the standard library evolves with each new standard, and many interesting new features are added. Here are the C++17 standard library features covered in the book:

  • How to represent nullable types with std::optional.
  • What’s a tagged union? And why do 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 without breaking your application.
  • What new string operations are available in the Standard Library.
  • How to work with the filesystem using the Standard Library.
  • What the parallel algorithms are.

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

More samples and uses cases

At the end of the book, other interesting problems are presented; the author tries to give many solutions and explains how the new standard solves them better than the old features. Conclusion: When reading the book, it’s clear that the author is a programmer who has worked on many C++ projects to solve real problems, which explains the pragmatic approach of the book. We recommend this book to every developer who wants to master the new C++17 standard. The book is available on Leanpub, and as our reader you can buy it ~15% cheaper by using the following coupon link: https://leanpub.com/cpp17indetail/c/codergears

Share this article