The Rook's Guide to C++
rooksguide.org
rooksguide.org
Which since this is a contribution based book is not a bad thing. However this book still needs quite some work. Writing a C++ book is not easy. From all the C++ books I know there's less than a handful which are actually not full of errors and wrong advices.
For beginners a very good book from my experience is C++ Primer by Stanley B. Lippman, Josée LaJoie, Barbara E. Moo. The 5th edition even goes into the newer topics like the aforementioned lambdas, also variadic templates. A nice thing is that it comes with exercises, which in my particular case was how I learned programming. I found a new feature of the language, or a class new to me and I played with it until I understood how it works.
Another good book for beginners is Programming -- Principles and Practice Using C++ by Bjarne Stroustrup, from what I read, he wrote this book with the background of teaching programming at the university and wanted to write a good book which uses a good approach which can be used for teaching students programming in C++.
If you are already further in and not at the beginning of learning C++ there is a list of books I recommend as further readings:
- Effective C++ by Scott Meyers
- More Effective C++ by Scott Meyers
- Effective STL by Scott Meyers
---
- Exceptional C++ by Herb Sutter
- More Exceptional C++ by Herb Sutter
- Exceptional C++ Style by Herb Sutter
---
- C++ Templates - The Complete Guide by David Vandevoorde and Nicolai M. Josuttis
- Modern C++ Design - By Andrei Alexandrescu
- C++ Coding Standards by Herb Sutter and Andrei Alexandrescu
Last but not least, reading the C++ Standard is the last bit on the topic of C++
This is the list of books which I recommend anyone who really wants to become great in C++
HTH :-)
Edit: I should probably mention The C++ Programming Language (4th Edition) by Bjarne Stroustrup as a must have as well ;)
This is a book on STL (updated for C++ 11) is a classic, and actually very readable. Quite a lot for advanced users, but also not too dry!
http://www.amazon.co.uk/gp/product/0321623215/ref=pd_lpo_sbs...
I'd also recommend Zed Shaw's C The Hard Way, because although C++ is not C, getting good at C helps you understand C++ when it goes wrong.
e.g. auto keyword, {} initializers, foreach(), lambdas, etc.
The word template is mentioned 3 times, and never once on how to write your own basic templates (no, that's should not be considered advanced).
Finally, why do you keep using the `.open` member function for your streams rather than specifying the file path in the constructor and then testing the validity of the whole stream rather than individual flags.
ie:
std::ofstream ofs { "my_file" };
if(ofs) { ///sucess...
You also don't even begin to touch on the standard algorithms. Take for example the book "Accelerated C++". It's only 300 pages, but it has the reader writing modern code with containers and standard algorithms with in the first few pages. It's a much better approach in my opinion.The book seems to be written for those that have _some_ but not extensive programming experience, and have a desire to learn C++ as a real first or second (not fifth) language.
It is still rough, but it has all the content proposed now put together.
For those that don't know programming, but want to get into it: You might want to wait a bit, but it should give a gist of what code can be like.
For those that know programming but not C++: this should be a simple book that you can skim through and start writing (valid) C++ code like a college freshman.
For those that know C++ well: Skip this, this won't teach you anything new. You won't learn the internals of how inheritance works at runtime and how virtual methods are called or anything else cool like that.
Within the next week the repo should be opened up for those that wish to contribute.
It definitely is for beginners. The things you learn in the first month, in your first programming class, in your freshman year.
It doesn't get going until chapter 19, but it suddenly cuts off.
For instance there's a very small chapter on const saying it declares a variable you cannot change. A novice will just read it and forget it. It should (again, imo) say "use const for everything possible" and explain why that is.
Likewise, the strnig chapter starts with saying "use code like using namespace std; string blabla; or you can also use std::string" and leaves it like that without further explanation. A novice might read that, think the first one is less effort and just continue using it. It would be better to make clear the second one has some advantages.
I could go on like that (all loops using post-increment, chapter on array while vector is only covered in the last chapter, chapter on pointers but references are mentioned nowhere, really??, new/delete but no smart pointers anywhere, templates, lamdas or most C++11 features for that matter, ...) but of course there's always a line between introductionary and deeper knwoledge and it's not entirley clear to me where the authors wanted to draw the line. Also there's a lot to tell about C++ of course. Yet, we're in 2013, close to C++14, and C++ has evolved a lot. Large parts of modern C++ programs look nowhere close to what is presented in this book.
Otherwise, learn C# or Java or whatever quacks like a duck.
Accelerated C++ used to be that book, don't know if there is a newer and better replacement.
But I still believe that to learn C++ the best way is to start with C, pointer arithmetic, and classic strings. Otherwise you will just miss the point and join the hordes of script kiddies who "once started C++".
So there should be a good guidance of avoiding pointers as much as possible when learner is stepping to C++ from C.
There are plenty of people in my office who are like that and they can't see the wood for the tree. Writing out their own for loops instead of using whatever std algorithm would do the job better. Holding their own owning pointers in the presence of exceptions.
The problem is people tend to not to actually learn C++ properly, cover to cover. They just learn the bits they need as an when they need them missing out all sorts of details in the middle.
Having said that, you probably DO know more C++ than you realised :-)