REVIEW - Introducing C++ - The Easy Way to Start Learning Modern C++


Title:

Introducing C++

The Easy Way to Start Learning Modern C++

Author:

Frances Buontempo

ISBN:

9781098178130

Publisher:

O’Reilly Media (2026)

Pages:

348

Reviewer:

Lieven de Cock

Reviewed:

September 2026

Rating:

★★★★★


Highly recommended.

My expectations were high, I knew this book was coming, and based upon Frances’ previous book, Learn C++ by Example, I knew I was in for a treat and expected no less. Spoiler alert: mission accomplished.

In Chapter 1 we gently learn how to compile a one-file program, and before the traditional “hello world” comes along, the simplest C++ program is made: a main not containing any statements. This approach is typical of the book: focus – focus on one item, one building block at a time. And gradually expand, an approach I use myself too, and which breathes the spirit of TDD.

Both modern println and the ostream variant are used for ‘hello world’. One could argue, why even bother with ostream? There is a valid reason: in order to introduce its symmetric buddy, which will be used in the next chapter, reading from an istream.

Talking about TDD, in Chapter 2 this technique is already presented, where we learn how to read a number from standard input, shortly generalized to istream, for testing purposes.

While doing that, the concepts of variables and functions are introduced, together with error handling. Personally I am not so fond of the input/output arguments approach, and would have preferred the hinted-at approach coming in chapter 3 to be used directly. On the flip side, it allowed the author to fully cover what passing by value, or by reference means. Sheer joy, we got good advice on [[nodiscard]], and on initializing variables (UB and erroneous behaviour is also no longer a stranger to us). See how modern C++ features are just coming naturally, early on, and not in some obscure appendix. This is the way we should teach C++; these are just basic blocks, OK they might be new, but we are turning to the future, not the past.

Which brings us to chapter 3, giving us the options to use exceptions and std::expected. Each time a little drawing pops up, it has a welcome additional value, to visualize the concept at hand. Nothing fancy, but oh so accurate. By the way, stack unwinding, is a mastered mechanism by now.

Next in chapter 4, the first containers are joining us on stage (array, vector), and we are starting to spin some loops. This is again introduced in a nice incremental way on the examples of the previous topics: let’s get multiple numbers from input, and store those. Fixed size, or variable size, by using the appropriate container. We already have some explanations on what those STL things are, based on (un)scary templates. Nobody got scared, we are just getting itchy to shift into the next gear.

With a minimal knowledge of how vectors work and (re)allocate storage we are ready for the next step.

In Chapter 5, we start of by using multiple source files, and writing our own headers, and what including headers actually means. After mastering that little increment, it is time for algorithms. Starting out with some simple (range) algorithms, the non-range forms of such algorithms are visited. After looking into the modern way of erasing elements of a vector, the old way is inspected, down to the manual way. Along the way showing the increase of potential errors. This gives a good sense of “don’t go down this road”, do the most modern thing. Currently predicates are small named functions, one can already guess what the next logical extension to this will be, the topic of the next chapter… The TDD style is again promoted during the extension of our little toy program.

You guessed it right, in Chapter 6 we are using lambdas. Gradually we adjust different types, and capturing by value and reference has no more secrets for us. The same principle, of turning up 1 notch at a time, makes this an easy trip for the reader. We continue to play with the initial toy example of getting prices, valid prices that is. And to obtain the latter we are using views, and composing a few views.

In Chapter 7, rather than having to run the program to manually enter a certain amount of numbers (prices), it is time to have them generated. For that purpose we start generating random numbers, and as such we learn about seeds, engines and distributions. Closing the chapter with the good advice, if we know the size of things we will end up with, reserving space in the container is a good idea.

We are nearly halfway through the book. There is another nice thing to notice: we haven’t seen the ugly bad things we would like nobody to know about, no C arrays yet, no pointers. Fair enough, we haven’t seen heap allocation yet.

It is no surprise that we could also write and read those ‘prices’ from a file. This is what we learn in Chapter 8. Along the way, we even pick up some notion of std::filesystem. This keeps organically growing, teaching us the bit-oriented operators (&,|,~) for manipulating file modes. The chapter ends by extending the toy example to intelligently re-use existing data/numbers/prices from a file, before adding new data.

To my personal joy, we are finally going to ditch the cout and the formatting/printing times have arrived, welcome in Chapter 9. We learn some basic ‘format strings’, and use the print(ln) way also to print to a ‘stream’. Just before we inspected a bit the power of the string class, together with string_views. Personally, I would have liked that another danger of string_views was pointed out: not being guaranteed to be null terminated. I have seen code from colleagues in the past treating these as null terminated in further processing, while this is not guaranteed, and those error cases had occurred. During the discussion of string literals, the old C style char arrays were mentioned, allowing to correctly deal with command line arguments passed to main.

In Chapter 10, we generalized our prices and other data into an ‘object’, a Stock. Use of struct versus class, access specifiers, constructor, destructor and some member functions (const or not) are gently introduced. While still in the building up phase, good advice was given, while for the sake of the example, the non-good way was tried out first. The class got implemented by means of a header + source file, explaining also the consequences of doing to much in the header file. The picture describing private/public members is so jolly nice, trivial but powerful.

We are starting out with optimizing out temporaries in Chapter 11, bringing a not so easy topic to the table ‘move semantics’. This allows us to study, the member methods the compiler generates for us, and what we should do to take matters in our own hands. Rule of 5 or 0, check. A reflection is made on how std::string is doing such things. Again we glimpse at ‘heap memory’, which will be tackled for real in the next chapter.

Chapter 12, allocating memory from the heap. Excellent, this is how it should be done, we start out with unique_ptr. I love it, no new and delete yet (that is the ‘addendum topic’); it is mentioned these are called behind the curtains, but we are not calling them directly yet. A small mention of shared/weak pointer, and how manually allocating memory works, and how cumbersome it is to correctly keep track of that and delete at the appropriate time, pointing out not to go that route. Next up the author has me jumping up and down, while during inspection of a unique_ptr as a class member, a new class is made, which has a one argument constructor, not being explicit. Oh my god, all to be resolved 2 pages further on, after showing the unwanted effects. I was kind of expecting this to happen, nevertheless my heart skipped a beat when my eyes saw the code.

And how easily can it be, to add a second constructor and explain delegating constructors, it is all so natural. Even a few type_traits pop up, simple and sensible, and not in the context of a 5 pages header file containing a template. Bring the small blocks first before constructing bigger things. This is a consistent approach in this book, which is so valuable.

Next up, inheritance. We are already at chapter 13. The thing I really like, is that we start by talking about abstract classes (interfaces), and implementations of those, which is typically at the core of OOP. The good advice of using ‘override’ is given, as the virtual destructor. In a simple example, it is shown what can go wrong when that advice is not followed. Dynamic polymorphism is applied by having 2 different implementation of the interface, showing the benefits of inheritance. The drawbacks are also pointed out, making the link to the next chapter which will discuss std::variant.

In Chapter 14, the focus is on extending the operations, and have a more or less closed set of types, the area where std::variant with std::visit shines. The book shows in an easy way the pros and cons, and trade offs between the different approaches (inheritance versus variant). And briefly a sneak peek is thrown at std::optional and std::any. I would have liked for std::optional to have been present in Chapter 2/3. Optional output (or optional input), erroneous output, exceptions.

And that brings us to the final chapter, the ride is coming to an end. We are learning the in and outs of unordered_map, and use this to write some first simple templates because we need to provide some hash implementations for our custom types. Small, simple, easy to grasp. Next increment, structured bindings so we can have a more readable loop. And the final thing we are learning, in order to constrain those templates, concepts. Look at that, how up to date can we be on writing templates.

Would there be things I would have done differently ? Maybe, ditch cout earlier, and bring in full use of format/print earlier, so we don’t even need to know about those IO manipulators. The book did not warn on the stickiness of those, which is often a surprise to newcomers or something overlooked by experienced developers.

I would have used brace initialization in the member initializer list of constructors. And as mentioned used std::optional already in the early chapters. A bit more const on the automatic variables, and I include first my own headers, and next the std headers. But hey, once modules are everywhere this is something from the past. And style wise I stick to Scott Meyers layout of class, first public, next private. But this is nit picking, people have different styles.

In conclusion, this is an excellent book to learn C++, of course I know C++, so I never had a learning curve anywhere, so a real newbie is better suited to judge. But if we compare this book to many other existing text books, we know most of them are old fashioned (even recent ones, unfortunately), discussing the wrong things, and the modern things are hopefully mentioned in an appendix. This book starts with the correct (modern) things, and even tries not to mention those old bad things/habits. Occasionally it does, because in the end that old code is out there and we need to be able to understand it. But along the way it became very clear why those things are to be avoided. I don’t think there was a steep learning curve anywhere along the journey, and each new piece was added in small increments. The book can be read as such in many sessions; one can easily digest a chapter or a dozen of pages and have a good feeling that again some progress was made. See, C++ is easy to learn, don’t let anyone tell you otherwise.

New to C++: this is the book to start out with, and next go to a more advanced book. The ‘book with the parrots’, this is today THE basic C++ book, your journey starts here, enjoy it: it was and will be a fun ride. Don’t forget to thank the driver (author).

By the way, as a second book, I would suggest Frances’ other book Learn C++ by Example. I read it a couple of years ago, and it used the same incremental approach. This is how C++ should be taught, I fully agree on this approach. I use a similar approach in my sessions/talks.

Website: https://www.oreilly.com/library/view/introducing-c/9781098178130/

Code Site: https://github.com/doctorlove/IntroducingCpp






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.