The 2nd edition of Modern C++ Programming Cookbook has been published

 2 years ago
source link: https://mariusbancila.ro/blog/2020/09/16/the-2nd-edition-of-modern-cpp-programming-cookbook-has-been-published/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The 2nd edition of Modern C++ Programming Cookbook has been published

Posted on September 16, 2020September 16, 2020 by Marius Bancila

I am happy to announce that the 2nd edition of my book Modern C++ Programming Cookbook has been published by Packtpub. The book is updated with content for the new C++20 core language and library features. The book can be ordered from both Packtpub and Amazon. The ISBN of the book is 9781800208988.


The book is organized in recipes, much like a cookbook. These recipes, in turn, are organized in sections that introduce you to the topic, list any necessary pre-requisites and then explain how to do something and how that works. This second edition comes with 130 recipes covering language and library features from C++11/14/17/20, including the libraries for strings, containers, algorithms, iterators, input/output, regular expressions, threads, filesystem, atomic operations, and utilities. Besides that, there is a chapter for patterns and idioms and one dedicated for testing frameworks, that covers everything you need to know to get started with Boost.Test, Google Test and Catch2. There is also a entire new chapter for the C++20 major features: modules, concepts, coroutines, and ranges. Apart from the new C++20 content, this 2nd edition comes with improved examples, additional details for existing recipes where it was needed, and corrections of issues from the first edition.

This book is intended for all C++ developers, regardless of their experience. The beginner and intermediate developers will benefit the most from the book in their attempt to become prolific with C++. Experienced C++ developers, on the other hand, will find a good reference for many C++11/14/17/20 language and library features that may come in handy from time to time. However, the book requires prior basic knowledge of C++, such as functions, classes, templates, namespaces, macros, and others. If you are not familiar with C++ at all, you should first read an introductory book to familiarize yourself with the core aspects.

The C++20 standard passed its final technical approval ballot on September 4 and is expected to be published by the end of the year. Therefore, I hope this book comes at the right time in order to help you get a good grasp of the changes from the new C++20 standard. The C++20 features discussed in the book are:

  • modules
  • concepts
  • coroutines
  • ranges
  • text formatting library (std::format)
  • chrono calendars and time zones
  • std::span
  • bit manipulation utilities
  • std::jthread and std::stop_source
  • latches, barriers, and semaphores
  • atomic operations
  • immediate functions (consteval)
  • three-way comparison (spaceship operator <=>)
  • using enums
  • template lambdas
  • changes to lambda captures

At this time, not all these features are supported by all compilers. To check your compiler’s support for C++20 features check this list.

You can check the table of contents of the book, as well as some excerpt from the book on Amazon, with the Look inside feature.

Information about the 1st edition of the book can be found here.

You can try all the examples from the book using an online compiler. My preferred resources for this are wandbox and Compiler Explorer. The former supports GCC and Clang, while the latter supports many compilers including GCC, Clang, and VC++.

You can find all the code snippets from the book available in the Modern C++ Programming Cookbook – 2nd Edition repository on GitHub.

I hope you will enjoy the book and find it helpful for learning new things about C++. Your feedback/review of the book is always welcomed.

Like this:


About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK