C++ textbook and blog recommendations

Any one have good C++ textbook or blog post recommendations?

Both are great - textbooks are good for an overarching view of the language, or one feature of the language, whereas blogs can give a good periodic dose of application, with code.

What is everyone following, or what have you read? I’m sure I’ve asked before and forgotten, but it’d be great to have this all in one place, so I can add it to my information feed tube.

Even if people have read things like Eigen’s documentation, that’s helpful. I’m more concerned with the ways through which Devs are digesting information, so that I can choose the best combination of routes for me. So if you have a way that’s helped you develop different aspects of your programming, please do share.

I’d like to improve my C++.

@Bob_Carpenter @syclik @stevebronder @rok_cesnovar @tadej


I’m kind of a “monkey at a typewriter” right now and I’d like to change that

I think I read a chapter out of the “Effective Modern C++” book here: https://www.aristeia.com/books.html

I’ve forgotten it now, but the stuff in stan/math/rev/mat/functor/adj_jac_apply.hpp is based on that and I’m super happy with how that works, so it was useful for me!


Instead of textbooks, I prefer to do online coding challenges in the language I want to learn. One site I have used is https://www.codingame.com, but I’m sure there are others.

The advantages are:

  1. There is no temptation to just read the chapter and skip the exercises, since the exercises are the game.
  2. Once you’ve completed the challenge, you can browse other people’s solutions. Often the top rated ones are really ingenious and hard to follow, but the straightforward solutions below them are often educational.
  3. Since the learning approach is presented as a game or competition, there’s additional motivation for you to study the material.


  1. This format is unsuitable for learning entirely new concepts. I assume that you’re trying to refine your existing skills, not learn C++ from scratch. In that case a good beginner textbook would be good, but I don’t know of any; I personally started with C and picked up C++ on the way.

C++ is a big and weird language! I’ll list out the books I find good below, most of them are worth skimming through and then using them as a reference book

C++ Templating: Good for some of the weirder and wackier type traits meta-programming we use from the meta folder. The second edition has a lot of fancy new bells and whistles, some of the stuff in the first edition was, “Well it would be nice if we did this” but now we do those things all the time which is neat

Effective Modern C++: If you know C or C++ < 11 this is a good book to understand the higher level concepts like when to use auto, compile time expressions, perfect forwarding

cppreference is generally useful to see what the std library has available and has lots of examples

Pro TBB: New book for working with TBB!

r/cpp: Oddly enough, the C++ community uses their subreddit v often. Official trip reports for the C++ committee meetings are posted and referenced there! Lots of good articles as well, I’ve enjoyed the discussions I’ve had there.

If I’m testing out one piece of code vs. another for something like refactoring and I know both pieces of code give the same output I use godbolt to check differences in assembly. It can often give you a pretty good idea of which one is faster or slower


Thank you all for the references.

And what about for beginners? Any opinions on where to start learning going towards what is useful for Stan development?

Thanks again


As someone that started out with no programming experience outside of R, what worked for me was just starting with the simpler issues on the stan math github that only required either cosmetic changes or very simple changes to behaviour. Working through those issues (with the help of google and stackoverflow) was great for getting me more comfortable with C++ as a language and how it was being used in Stan.

I also found Vandevoorde’s book on C++ templates very helpful!


All great suggestions, thank you. You guys all read my mind.


1 Like

There’s some stuff at the link below but I’m working right now to expand it more with a tips and tricks section




@andrjohns, I also have little programming experience outside of R and going through simple issues on the Stan math seems like a good place to start. Thanks for the suggestion!


@Bob_Carpenter and I started with “Modern C++ Design” and “C++ Templates: The Complete Guide”. Both were useful at the time (around 2011). Since then, the language has evolved and included a lot of the patterns described in the books into the language. It’s still useful to see how you could build certain things from scratch, but it’s less useful now as a guide to good C++ programming.

I subscribe to the “Awesome C++ Newsletter”. It aggregates a bunch of articles and some of those articles are insightful.

I think more importantly than C++ books, the things that have helped me are reading stuff from Kent Beck, Bob Martin, Martin Fowler, and a few other people that really think about the design. We’re trying to build complicated things, but really thinking about how to break it down so each component is not complicated is one way to do this. Open-source software development takes it to another level… if you want someone new to be able to contribute, you have to make things as easy to understand and communicate to others as possible. Anyway, those people listed promote that sort of ideal in software development and write about it.

1 Like

To have an overview of recently introduced concepts and features, “A Tour of C++ 2ed” is just for that.

@syclik The 2nd edition of “C++ Templates: The Complete Guide” was recently published, so it’s still a good choice.


I like the Vandevoorde and Josuttis book on C++ template programming if you want the hard stuff. Otherwise, the Meyers books are good. I like Herb Sutter’s posts on his blog.

CppCon talks are on YouTube and a great source for specific topics.