This book is available with continuous updates: https://leanpub.com/cpp17indetail
C++17 is the second iteration following a three year cycle and at the end of last year (2019) we started getting some books specific to C++17. I felt that C++14 got fairly thin coverage in the publishing world (Programming Principles and Practice, Effective Modern C++ and that’s about it). C++17 seems to be doing better, with second editions of C++ Templates, A Tour of C++ and C++ Concurrency in Action already. Perhaps authors and publishers are having a harder time keeping up with C++ versions? Perhaps also there’s more to write about in C++17.
Getting back to the book itself, the book covers only the new features of C++17. You will need to have to have a good understanding of C++ to be able to get much benefit from the book. The first example on page 3 illustrates several new features. If you are not familiar with
, brace initialisation,
and range based
then you won’t appreciate how much is new.
The book is broken down into three parts: language, library and use cases. There is plenty of information in each chapter on the C++ Standards Committee papers, where the various changes were proposed, and also of which compilers and versions support each feature. The first few chapters cover some fairly basic items that clean up and simplify the language. I expect that Python programmers will appreciate the new Structured Bindings. Chapter 5 Templates (including fold expressions and ‘
’). In my opinion these are the most important changes in C++17 (especially ‘
’) which continue the process of enabling easier and more powerful template programming. The language part ends with a chapter on attributes.
The second part covers the library. The first three items –
– have been with us for some time in
. It’s good to see these in the library and I think that they will be very useful tools. I likes the coverage of performance and exceptions, and there are also summaries of changes from the
The next three chapters are dedicated to strings:
, string conversions and string searching. Searching isn’t really up my street, but it’s always good to know.
and the conversions look promising, at least from a performance perspective. I had already heard some misgivings about the risks of using
, and that is well covered. The next two chapters are big items: Filesystem and Parallel Algorithms. There is a lot to cover for filesystems, but everything is covered albeit briefly, and there are a few decent examples of using the interface. Parallel Algorithms is mostly about performance. A little niggle here, I would have liked to see some more useful example for the uses of
, for instance the variance with an explanation of why
is not suitable for such calculations. There is a fair amount of performance analysis. The last two chapters of Part 2 cover small items and standard library cleanup.
The last part is a brief overview of some use cases. The first three are refactoring using
. The last example parallelises a CSV file reader.
I enjoyed reading the book. It is concise enough that I could read it all in a few days whilst at the same time giving enough coverage that I had a clear impression of the new additions to C++17.