This question attempts to collect the few pearls among the dozens of bad C++ books that are released every year.
Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are very many very bad C++ books out there. And we are not talking about bad style, but things like sporting glaringly obvious factual errors and promoting abysmally bad programming styles. And it's even worse with online tutorials. (There is a reason nobody bothered to setup a similar question for online tutorials.)
Please provide quality books and an approximate skill level â preferably after discussing your addition in the C++ chat room. (The regulars might mercilessly undo your work if they disagree with a recommendation.) Add a short blurb/description about each book that you have personally read/benefited from. Feel free to debate quality, headings, etc. Books that meet the criteria will be added to the list. Books that have reviews by the Association of C and C++ Users (ACCU) have links to the review.
To spell it out bluntly: There is no need to add a 75th answer to this question. If you feel like a book should be added, suggest it to the community and let's discuss it.
Note: FAQs and other resources can be found in the C++ tag info and under c++-faq. There is also a similar post for C: The Definitive C Book Guide and List
The C++ Programming Language (Bjarne Stroustrup) (updated for C++11) The classic introduction to C++ by its creator. Written to parallel the classic K&R, this indeed reads very much alike it and covers just about everything from the core language to the standard library, to programming paradigms to the language's philosophy. (Thereby making the latest editions break the 1k page barrier.) [Review] The fourth edition (released on May 19, 2013) covers C++11.
C++ Standard Library Tutorial and Reference (Nicolai Josuttis) (updated for C++11) The introduction and reference for the C++ Standard Library. The second edition (released on April 9, 2012) covers C++11. [Review]
The C++ IO Streams and Locales (Angelika Langer and Klaus Kreft) There's very little to say about this book except that, if you want to know anything about streams and locales, then this is the one place to find definitive answers. [Review]
The C++ Standard (INCITS/ISO/IEC 14882-2011) This, of course, is the final arbiter of all that is or isn't C++. Be aware, however, that it is intended purely as a reference for experienced users willing to devote considerable time and effort to its understanding. As usual, the first release was quite expensive ($300+ US), but it has now been released in electronic form for $30US -- probably the least expensive of the reference books listed here.
Overview of the New C++ (C++11/14) (PDF only) (Scott Meyers) (updated for C++1y/C++14) These are the presentation materials (slides and some lecture notes) of a three-day training course offered by Scott Meyers, who's a highly respected author on C++. Even though the list of items is short, the quality is high.
If you are new to programming or if you have experience in other languages and are new to C++, these books are highly recommended.
C++ Primerâ (Stanley Lippman, JosÃ©e Lajoie, and Barbara E. Moo) (updated for C++11) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. The fifth edition (released August 16, 2012) covers C++11. [Review]
Accelerated C++ (Andrew Koenig and Barbara Moo) This basically covers the same ground as the C++ Primer, but does so on a fourth of its space. This is largely because it does not attempt to be an introduction to programming, but an introduction to C++ for people who've previously programmed in some other language. It has a steeper learning curve, but, for those who can cope with this, it is a very compact introduction into the language. (Historically, it broke new ground by being the first beginner's book using a modern approach at teaching the language.) [Review]
Thinking in C++ (Bruce Eckel) Two volumes; second is more about standard library, but still very good
Programming: Principles and Practice Using C++ (Bjarne Stroustrup) An introduction to programming using C++ by the creator of the language. A good read, that assumes no previous programming experience, but is not only for beginners.
â Not to be confused with C++ Primer Plus (Stephen Prata), with a significantly less favorable review.
Effective C++ (Scott Meyers) This was written with the aim of being the best second book C++ programmers should read, and it succeeded. Earlier editions were aimed at programmers coming from C, the third edition changes this and targets programmers coming from languages like Java. It presents ~50 easy-to-remember rules of thumb along with their rationale in a very accessible (and enjoyable) style. [Review]
Effective STL (Scott Meyers) This aims to do the same to the part of the standard library coming from the STL what Effective C++ did to the language as a whole: It presents rules of thumb along with their rationale. [Review]
More Effective C++ (Scott Meyers) Even more rules of thumb than Effective C++. Not as important as the ones in the first book, but still good to know.
Exceptional C++ (Herb Sutter) Presented as a set of puzzles, this has one of the best and thorough discussions of the proper resource management and exception safety in C++ through Resource Acquisition is Initialization (RAII) in addition to in-depth coverage of a variety of other topics including the pimpl idiom, name lookup, good class design, and the C++ memory model. [Review]
More Exceptional C++ (Herb Sutter) Covers additional exception safety topics not covered in Exceptional C++, in addition to discussion of effective object oriented programming in C++ and correct use of the STL. [Review]
Exceptional C++ Style (Herb Sutter) Discusses generic programming, optimization, and resource management; this book also has an excellent exposition of how to write modular code in C++ by using nonmember functions and the single responsibility principle. [Review]
C++ Coding Standards (Herb Sutter and Andrei Alexandrescu) "Coding standards" here doesn't mean "how many spaces should I indent my code?" This book contains 101 best practices, idioms, and common pitfalls that can help you to write correct, understandable, and efficient C++ code. [Review]
C++ Templates: The Complete Guide (David Vandevoorde and Nicolai M. Josuttis) This is the book about templates as they existed before C++11. It covers everything from the very basics to some of the most advanced template metaprogramming and explains every detail of how templates work (both conceptually and at how they are implemented) and discusses many common pitfalls. Has excellent summaries of the One Definition Rule (ODR) and overload resolution in the appendices. [Review]
Modern C++ Design (Andrei Alexandrescu) A groundbreaking book on advanced generic programming techniques. Introduces policy-based design, type lists, and fundamental generic programming idioms then explains how many useful design patterns (including small object allocators, functors, factories, visitors, and multimethods) can be implemented efficiently, modularly, and cleanly using generic programming. [Review]
C++ Template Metaprogramming (David Abrahams and Aleksey Gurtovoy)
C++ Concurrency In Action (Anthony Williams) A book covering C++11 concurrency support including the thread library, the atomics library, the C++ memory model, locks and mutexes, as well as issues of designing and debugging multithreaded applications.
Advanced C++ Metaprogramming (Davide Di Gennaro) A pre-C++11 manual of TMP techniques, focused more on practice than theory. There are a ton of snippets in this book, some of which are made obsolete by typetraits, but the techniques, are nonetheless, useful to know. If you can put up with the quirky formatting/editing, it is easier to read than Alexandrescu, and arguably, more rewarding. For more experienced developers, there is a good chance that you may pick up something about a dark corner of C++ (a quirk) that usually only comes about through extensive experience.
Note: Some information contained within these books may not be up to date or no longer considered best practice.
The Design and Evolution of C++ (Bjarne Stroustrup) If you want to know why the language is the way it is, this book is where you find answers. This covers everything before the standardization of C++.
Ruminations on C++ - (Andrew Koenig and Barbara Moo) [Review]
Advanced C++ Programming Styles and Idioms (James Coplien) A predecessor of the pattern movement, it describes many C++-specific "idioms". It's certainly a very good book and still worth a read if you can spare the time, but quite old and not up-to-date with current C++.
Large Scale C++ Software Design (John Lakos) Lakos explains techniques to manage very big C++ software projects. Certainly a good read, if it only was up to date. It was written long before C++98, and misses on many features (e.g. namespaces) important for large scale projects. If you need to work in a big C++ software project, you might want to read it, although you need to take more than a grain of salt with it. There's been the rumor that Lakos is writing an up-to-date edition of the book for years.
Inside the C++ Object Model (Stanley Lippman) If you want to know how virtual member functions are commonly implemented and how base objects are commonly laid out in memory in a multi-inheritance scenario, and how all this affects performance, this is where you will find thorough discussions of such topics.
This question has historical significance, but is not a good example of an appropriate question. Read and learn from this post, but please do not use it as evidence that you can ask similar questions.
See the FAQ for more info.
improve this question
Optimizing C++ | Wikibook freely downloadable
From the webpage:
This book is for intermediate C++ programmers (i.e. studying C++ for at least one year) who want to improve the performance of the software they develop.
This book contains guidelines and advices on how to write efficient software using the C++ language. Software correctness and maintainability are taken into account, but are not the primary concerns of the guidelines.
Most of the guidelines presented are not platform specific, and so are applicable to every processor, to every compiler, and to every operating system; the few platform specific advices try to cover most platforms."
If what you're looking for is a fairly complete reference, I like C++ in a Nutshell. I have found it to be more complete and more to the point than "The C++ Programming Language" (which I guess is the point of the Nutshell series). However, it is definitely not for the beginner.
I don't know what it's worth, but there's a book available on Stanford's CS106B - Programming Abstractions web site in PDF format. The site is here:http://www.stanford.edu/class/cs106b/
You can download the book by clicking the "Course Reader PDF" link to the right. The book is called:
Programming Abstractions in C++
Eric Roberts & Julie Zelenski
You may also refer CS106L after completing cs106b
I would like to recommend "Inside the C++ Object Model" by Stanley Lippman. It explains well how C++ object works under the hood. Knowing these details is a must to be a good C++ programmer.
For the 'classics' section I'd like to recommend, John Lakos "Large Scale C++ Software Design". It's quite an old book but it occupies a niche that no other C++ book I know of covers. Probably Intermediate, and if you're working on a big codebase, you'll have to have this book.
I'd also like to recommend Stephen C. Dewhurst's "C++ Gotchas" for the Intermediate developer. It falls into the same category as Herb Sutter's Exceptional C++ books, only with slightly more emphasis on how to avoid shooting yourself in the foot.
About C++ Templates The Complete Guide
I can only say good things about it. Written by two top experts. And you really notice that. The examples are well written, explained and placed.
They start by teaching you the basics on a few pages. Then they talk about all the pitfalls and hidden danger there is in template programming and the cool stuff that can be done with them. At the end, they explain in detail the overload resolution and the one definition rule in Appendix A and B.
Strongly recommended :)
I'd add C++ FAQs to the Beginner list. I find it highly readable, enjoyable, and a succinct summary of a lot of material in "The C++ Programming Language" and the "Effective C++" series of books.
Large Scale C++ Design, by John Lakos
I'd say intermediate level. In any case. read it before you start/join your very first large project (whichever level you're at).
I think Bruce Eckel's Thinking in C++ volumes really stirred me.
New book by Stroustrup Principles and Practice Using C++ should be a great beginner book.
STL links at http://www.stepanovpapers.com especially http://www.stepanovpapers.com/Stepanov-The_Standard_Template_Library-1994.pdf and http://www.stepanovpapers.com/STL/DOC.PDF
What about this book?
by Stanley B. Lippman
It is structured in a few chapters by C++ programming paradigms:
Chapter 1. Basic C++ Programming
Chapter 2. Procedural Programming
Chapter 3. Generic Programming Chapter
Chapter 4. Object-Based Programming
Chapter 5. Object-Oriented Programming
Chapter 6. Programming with Templates
Chapter 7. Exception Handling
Appendix A. Exercise Solutions
Appendix B. Generic Algorithms Handbook
Also every chapter has a bunch of exercises.
The Boost C++ Libraries, written by Boris SchÃ¤ling, and translated to English by Andreas Masur provides an introduction to the Boost libraries. The first edition is available online under a Creative Commons license and covers Boost 1.42.0. There's a newer edition that covers Boost 1.47.0 (but this one is not available for free).
The book focus on Boost and only Boost. It assumes some C++ knowledge, but not too much, so I think it's a good book for the fledgling C++ student that after obtaining a grasp of the language wants to use Boost.
The book covers the most commonly used libraries, and describes each component with examples and enough detail to get you started using each of them. Obviously, given the sheer size of Boost, it can't go into excruciating detail over everything, so this is more of an introductory book than a full reference. Nevertheless, the book is still useful for Boost veterans that want to get started quickly with some part of Boost that they're not familiar with yet.
[Edit]: When it comes to Boost, there are two newer books:
Introduction to the Boost C++ Libraries; Volume I - Foundations
Introduction to the Boost C++ Libraries; Volume II - Advanced Libraries
The Volume one is similar with "The Boost C++ libraries" except that it covers more libraries. And also, in my humble opinion, it has some very good example code which are much better than the Boost docs pages and the book above. The drawback is that it's more expensive but I think the quality of the book worth the money.
The Volume covers some of the more advanced libraries in Boost, things like Math Toolkit, special data structures (Date & Time, Circular Buffer, dynamic bitsets, ...), ASIO and so on. Each of the libraries is discussed in detail with numerous working examples.
If you are an intermediate level programmer, like fresh out of college, used C++ for small kiddish programs but now started working on C++ projects, the first few chapters of the CS106B course of Stanford is a must-read. It refreshes your memory and neatly moves on to the advanced concepts. Amazing explanations and beautiful examples.
The Annotated C++ Reference Manual by Margaret Ellis and Bjarne Stroustrup should be listed under classics.It is still very well regarded almost 20 years later, though somewhat dated.
C++ Common Knowledge by Stephen Dewhurst belongs in the Intermediate section, but just barely. The coverage of templates gets into advanced material near the end.
For German readers, I can recommend the book by Prof. Ulrich Breymann "Der C++ Programmierer", Hanser Verlag, 2009. It's 950 pages cover all possible aspects of C++ from Hello World to STL, smart pointers, thread programming, overriding of operator new, etc. It benefits greatly by being a very recent book (and a standard text for German informaticians), so is targeted to the C++0x standard syntax. It is also a beautifully produced book, which makes for a pleasure to read.
I have coached and consulted in C++ in recent years and this is my constant companion and always my first recommendation.
In spite of being stated beforehand, it is fertile to reiterate Stephen Dewhurst's two books:
C++ Gotchas: Avoiding Common Problems in Coding and Design
C++ Common Knowledge: Essential Intermediate Programming
and Danny Kalev's constantly updated e-book:
C++ Reference Guide
Lastly, don't you think you should add in that list Herb Sutter's other book as well and the best Boost introductory book that exists?
API Design for C++ by Martin Reddy. Good read after Meyers' Effective C++ and and Josuttis's The C++ Standard Library: A Tutorial and Reference.
I got C++ Cookbook as a birthday present and like it a good deal. It's a very practical book, with code examples ("recipes") to solve specific problems. Each recipe is explained in detail by breaking the code down and showing why things have been done a certain way. Many recipes show you how to do things using STL and/or Boost, and sometimes how to roll your own.
I think, while not primarily targetting C++, the GOF's Design Patterns - Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, Vlissides should have a place here, since it teaches basics of solid software design, mostly using C++ for code examples, thus giving good insight into what to do with C++.
I personally really liked Professional C++ as an intermediate or maybe advanced book. It has a great intro without going too basic, great coverage of pointers, STL, even frameworks to use for certain scenarios.
Data Structures in C++ using STL
This was a textbook for a data structures class I took and one of the few that I considered good enough not to sell back at the end of the semester.
The C++ language reference at MSDN. It is a pretty good stuff:
MSDN C++ language Reference
FREE books about C++, design, data structures (excuse me if some of them are not so perfect or I repeat a book mentioned earlier - it is a C++ free book list):
Very good C++ and Java examples and an OPENSOURCE book about data structures
Next data structures book of Goodrich
Very FRESH about data structures
Design patterns in C++ and Java examples
Data Structures and Algorithms with Object-Oriented Design Patterns in C++
Wiki C++ idioms
About boost C++ library
AVL trees book
C++ famous the first free book
For begginers C++
For begginers an old book
C++ book lists:
Free video lectures:
Unfinished online interactive tutorial on data structures in C, C++:
The beginning of all C++ ideas:
Beginning C++ Through Game Programming
Â Â Â Â Â by Michael Dawson
Level: Beginner > Introductory
This book is written for the beginner, and assumes no previous programming experience.
Perspective: Game Programming
This book approaches learning C++ from a game development perspective.
Â Â Â In this book, instead of the traditional "Hello World!" program, it teaches the following "Game Over!" version:
// Game Over
// A first CÃ¾Ã¾ program
std::cout << "Game Over!" << std::endl;
Elements of Programming
This short (but dense) book has a remarkable mix of abstract algebra (e.g. chapter two is dedicated to "Associative Operations") with the concrete algorithmic implementations in relatively short C++ code snippets (abstracted via templates, of course).
For self-taught knowledge of computers and C++, I was really fond of Neil Grey - A Beginners C++ especially since the entire thing is available for free as a series of PDF's (here) - which makes life so much easier when you want to copy paste code for exercises or templates.
When learning about a subject, I like the Wikipedia-style version. There aren't a lot of long-winded introductions, anecdotes and tangents. These make for nice novels, or introductory books for people who aren't really that interested in the subject - but if you want to get down to brass tax and dense facts, this is a great reference.
One of the uniquely useful parts about this book is how is has a column running down the side of every page containing key words referenced in that section - in addition to the usual section headers and running page headers that tell you where you're at. The sections are organized in what is, to me, the most logical approach - a crash course on computer hardware, followed by machine language, and then higher level language, algorithms, design paradigms, OOP, etc. It also gives well annotated examples of code from practical applications, such as air traffic control software - and does a good job of underlying the real world importance of best practice principles like information experts, modularity, and documentation.
It's survived so long for being mostly IDE agnostic, but I wish someone would go back and take out all those embarrassingly outdated references to Borland.
The C++ Standard Library Extensions: A Tutorial and Reference by Pete Becker
Most of what is important is already there:
I would add Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
It is intermediate level, I guess, and has a refreshing approach to it (real-life, is what he said).