Verdict: Recommended with reservations
I see this book as being a more approachable version of cppreference.com, without the slant towards standardese. C++ is so big that, even in 710 pages, it’s not possible to go into the details of all the features. Or, if it is possible then it takes many years and multiple volumes that don’t all stay current.
There are 12 chapters and over 100 recipes (it says that on the cover, they aren’t numbered and I’m not going to count them). That means around 7 pages per recipe. That’s a nice figure. A few of the recipes are a bit more involved and go beyond just explaining C++ features. For instance, the recipe ‘Implementing parallel map and fold with tasks’ is quite involved. As the name implies, it mixes several features and also the recipe covers several variations with performance measurements and comparisons of the different techniques.
Each recipe is split into ‘Getting ready’, ‘How to do it...’, ‘How it works...’ and ‘See also’ sections. I haven’t tried using the book as a reference to be able to say if there is enough detail to solve real problems. I liked the short recipes when reading the book from cover to cover.
The best thing about the book as that it has a reasonable amount of coverage of the C++ language and library. The worst thing that I noted was sometimes important information was lacking. The recipe ‘Finding elements in a range’ doesn’t give the algorithmic complexity of find()
, binary_search()
, etc. Also, the index is a bit lacking; there’s no entry for std::binary_search
, for instance. That might make using the book as a reference more difficult.
The 3rd edition of this book is now available.
Website: https://www.packtpub.com/en-gb/product/modern-c-programming-cookbook-9781800206205
Code site: https://github.com/PacktPublishing/Modern-CPP-Programming-Cookbook-Second-Edition