I’m thrilled to announce the print/paperback edition of “C++ Initialization Story!” After nearly a year of updates and enhancements for the electronic version, this comprehensive resource is now complete! You can purchase the book in a variety of formats, and to celebrate this major update, I’m hosting a giveaway where you can get the book for free :)

What’s new  

The latest update brings the total page count to 275 for the ebook and 295 for the print edition. Some of the most notable updates include:

  • An index at the back of the print book for easy reference
  • A sleek new front cover design
  • Numerous layout improvements and fixes to ensure optimal print quality
  • A separate repository for code samples, available at: https://github.com/fenbf/cppinitbook_public


The journey of creating my book on C++ Initialization began with a simple blog post on in-class data member initialization in C++11. From there, I continued to add more examples and use cases, expanding the article and turning it into an Educative course on the topic. However, as I tried to convert the course into a PDF, I noticed that there were some gaps in the flow of the content. This led me to explore more related areas like constructors, destructors, and C++14 and C++17 additions like inline variables.

As I delved deeper into the subject, I realized that I had accumulated enough knowledge to expand the text with C++20 topics. Before I knew it, the book had grown to over 150 pages, filled with use cases and practical examples.

I am incredibly proud of this book as it not only covers ways to create and manage objects but also helps readers understand the complexities of modern C++. Whether you’re a seasoned C++ developer or just starting, I believe this book will provide valuable insights and practical knowledge that will help you take your skills to the next level.

And just as with my other books (C++17, Lambdas), I made it available at Leanpub initially. The platform makes it easy for me to publish new updates, and everyone who has the book can immediately access the latest changes (at no charge). Also, the platform allows you to read it as PDF and Epub, Mobi or Online.

As the final step, I made the book available in Print on Amazon.

Learning objectives  

The goal is to equip you with the following knowledge:

  • Explain rules about object initialization, including regular variables, data members, and non-local objects.
  • How to implement special member functions (constructors, destructors, copy/move operations) and when they are helpful.
  • How to efficiently initialize non-static data members using C++11 features like non-static data member initialization, inheriting, and delegating constructors.
  • How to streamline working with static variables and static data members with inline variables from C++17.
  • How to work with container-like members, non-copyable data members (like const data members) or move-able only data members, or even lambdas.
  • What is an aggregate, and how to create such objects with designated initializers from C++20.

The structure of the book  

The book contains 14 chapters in the following structure:

  • Chapters 1 to 5 create a foundation for the rest of the book. They cover basic initialization rules, constructors, destructors, and the basics of data members.
  • Chapter 6 is a short quiz on constructors. You can check your knowledge from the first “part” of the book.
  • Chapter 7 Type deduction: auto, decltype, AAA
  • Chapter 8 describes Non-static Data Member Initialization (NSDMI), a powerful feature from C++11 that improves how we work with data members. At the end of the chapter, you can solve a few exercises.
  • Chapter 9 discusses how to initialize container-like data members.
  • Chapter 10 contains information about non-regular data members and how to handle them in a class. You’ll learn about const data members, unique_ptr as a data member, and references.
  • Chapter 11 describes static non-local variables, static objects, various storage duration options, inline variables from C++17 and constinit from C++20.
  • Chapter 12 moves to C++20 and describes Designated Initializers, a handy feature based on similar thing from the C language.
  • Chapter 13 shows various techniques like passing strings into constructors, strong typing, CRTP class counter, Copy and swap idiom, and more.
  • Chapter 14 is the final quiz with questions from the whole book.

And there are two appendices:

  • Appendix A - a handy guide about rules for compiler-generated special member functions.
  • Appendix B - answers to quizzes and exercises.


This book wouldn’t be possible without valuable input from many C++ experts and friends.

I especially would like to thank to the following people:

They spent a lot of time finding even little things that could be improved and extended.

Last but not least, I got a lot of feedback and comments from the blog readers, Patreon Discord Server (See @C++Stories @Patreon), and discussions at C++ Polska. Thank you all!

With all of the help from those kind people, the book quality got better and better!

I completed the ebook version in Late 2022 and spent the recent months adjusting the content for the print version.

Amazon KDP makes it easy to publish this book in Print on Demand form.

Here’s a photo of a few versions:

And the final form:

And inside the paperback, black&white version:

You can buy the book here:

Hardcover and full color  

Additionally, I also created a full-colour version, hard cover with a nice syntax colouring and images. The price is much higher than the black&white version (50+$ ech…) though. It’s because of the Amazon printing cost os way over 20$ vs 4.5$. The royality for the that version is even lower than then black&white version.

What people say?  

By Michael @GoodReads

Well written comprehensive books like the “C++ Initialization Story” provide a good opportunity for developers of all skill levels to thoroughly study this important aspect of C++ development. Bartłomiej does an excellent job of taking a very diverse topic and presenting it with plenty of examples and text that is both interesting to read and easy to comprehend. The ordering of the chapters of the book has been very well thought out and provides a great path through the topic, from fundamental ideas every developer should know, to more tangential areas leaving one with thoughts ranging from, “I didn’t know this behavior changed in one of the newer Standards”, to frequent bouts of, “I have to write this down, because this is the most complete and concise discussion of topic ‘XYZ’ that I have come across to date…”

By Ji @GoodReads

As far as I know, Bartłomiej is one of the best authors for C++! His books always provides very sensibly contents for real world and I think we couldn’t find more better book!

By Adrian: @Leanpub

Initialization in C++ is a complex subject, but C++ Initialization Story simplifies it in a way anyone can understand. Bartłomiej takes you on a journey full of practical examples, useful techniques, and best practices, showing you how they evolve with recent C++ standards. Not only will you learn about initialization but many other areas of the language as well. By the end of this book, you will have the skills to write idiomatic code and design bug-resistant types with ease.

How to Get the Book and Join ~600 Readers?  

There are several options:

You can also download a free sample which contains almost 60 pages (available from the Leanpub page)!

Giveaway (ended)  

I have three copies of the Print Version of C++ Initialization Story (Black&white print, assuming Amazon.com can reach your destination), if you want one, please add a comment below this article and answer one of following questions:

  • What’s the most complex topic for you regarding initialization of objects and variables in C++?
  • In your opinion, has initialization got better/easier in Modern C++ or worse?

I’ll randomly pick three winners and contact them. Make sure I can see your email address from your GitHub profile or have some other way to contact you.

(I’m using utteranc.es commenting system which is based on GitHub issues (see a separate repo with discussion for cppstories.com), so you need to have a Github account and authorise this small and safe bot, read more here.

The giveaway is valid till next Sunday 2nd April 2023, I’ll send you an email if you win next week.