Accelerated C++
Andrew Koenig & Barbara E. Moo (yes, moo)
ISBN: 0-201-70353-X
I've never really bought the claim that you can't learn C++ without first learning C, and this book proves it. As our esteemed C++ guru ariels once said, "it teaches the language like there never was C." From the very beginning you know the authors have been around the language so long it has imprinted itself into their neural pathways, like all good programmers, right down to the numbering of the chapters from 0.
Now this is not just any old programming book (although chapter 0 begins with the obligatory Hello world) - rather than starting with the very basics of the language and moving on to the advanced stuff and STL later, it dives right into explaining every aspect of the "Hello world" source, including operators, operands, operator association, types, manipulators, streams, scope, namespaces and the standard library. While most books introducing C++ will explain the core language first before moving onto the standard library and its containers, iterators, algorithms and so on, this takes the language as a whole and starts from there. Some have complained that it doesn't lend itself to beginner programmers for this reason, but I found that as long as you're willing to actually concentrate (which sometimes involves re-reading a section), it builds more of a foundation for the advanced features of the language later on.
The good thing about this book is that it starts off assuming no knowledge of the C++ language and goes on to explain not only what you can do with it and the standard library, but also why it works that way. It teaches the reader good programming practices and habits, and when/how to figure out for yourself what to do (eg. pass by value vs. pass by reference), in effect teaching how to program in any language. It makes an excellent and concise introduction to C++ programming which can then be built upon with a book such as Teach Yourself C++ by Al Stevens, a very in-depth book exploring pretty much all the fundamental language features in a more systematic manner (which also makes it a handy reference), or probably Bjarne Stroustrup's classic The C++ Programming Language, but I don't actually have that book (hangs head).
To get an idea of what Accelerated C++ covers, I stole this chapter list from the website at http://www.acceleratedcpp.com
Chapter 0 Getting started
0.1 Comments
0.2 #include
0.3 The main function
0.4 Curly braces
0.5 Using the standard library for output
0.6 The return statement
0.7 A slightly deeper look
0.8 Details
Chapter 1 Working with strings
1.1 Input
1.2 Framing a name
1.3 Details
Chapter 2 Looping and counting
2.1 The problem
2.2 Overall structure
2.3 Writing an unknown number of rows
2.4 Writing a row
2.5 The complete framing program
2.6 Counting
2.7 Details
Chapter 3 Working with batches of data
3.1 Computing student grades
3.2 Using medians instead of averages
3.3 Details
Chapter 4 Organizing programs and data
4.1 Organizing computations
4.2 Organizing data
4.3 Putting it all together
4.4 Partitioning the grading program
4.5 The revised grading program
4.6 Details
Chapter 5 Using sequential containers and analyzing strings
5.1 Separating students into categories
5.2 Iterators
5.3 Using iterators instead of indices
5.4 Rethinking our data structure for better performance
5.5 The list type
5.6 Taking strings apart
5.7 Testing our split function
5.8 Putting strings together
5.9 Details
Chapter 6 Using library algorithms
6.1 Analyzing strings
6.2 Comparing grading schemes
6.3 Classifying students, revisited
6.4 Algorithms, containers, and iterators
6.5 Details
Chapter 7 Using associative containers
7.1 Containers that support efficient look-up
7.2 Counting words
7.3 Generating a cross-reference table
7.4 Generating sentences
7.5 A note on performance
7.6 Details
Chapter 8 Writing generic functions
8.1 What is a generic function?
8.2 Data-structure independence
8.3 Input and output iterators
8.4 Using iterators for flexibility
8.5 Details
Chapter 9 Defining new types
9.1 Student_info revisited
9.2 Class types
9.3 Protection
9.4 The Student_info class
9.5 Constructors
9.6 Using the Student_info class
9.7 Details
Chapter 10 Managing memory and low-level data structures
10.1 Pointers and arrays
10.2 String literals revisited
10.3 Initializing arrays of character pointers
10.4 Arguments to main
10.5 Reading and writing files
10.6 Three kinds of memory management
10.7 Details
Chapter 11 Defining abstract data types
11.1 The Vec class
11.2 Implementing the Vec class
11.3 Copy control
11.4 Dynamic Vecs
11.5 Flexible memory management
11.6 Details
Chapter 12 Making class objects act like values
12.1 A simple string class
12.2 Automatic conversions
12.3 Str operations
12.4 Some conversions are hazardous
12.5 Conversion operators
12.6 Conversions and memory management
12.7 Details
Chapter 13 Using inheritance and dynamic binding
13.1 Inheritance
13.2 Polymorphism and virtual functions
13.3 Using inheritance to solve our problem
13.4 A simple handle class
13.5 Using the handle class
13.6 Subtleties
13.7 Details
Chapter 14 Managing memory (almost) automatically
14.1 Handles that copy their objects
14.2 Reference-counted handles
14.3 Handles that let you decide when to share data
14.4 An improvement on controllable handles
14.5 Details
Chapter 15 Revisiting character pictures
15.1 Design
15.2 Implementation
15.3 Details
Chapter 16 Where do we go from here?
16.1 Use the abstractions you have
16.2 Learn more
Appendix A Language details
A.1 Declarations
A.2 Types
A.3 Expressions
A.4 Statements
Appendix B Library summary
B.1 Input-output
B.2 Containers and iterators
B.3 Algorithms
The appencies come in handy as they cover parts of the language taught by the rest of the book in more detail. All in all, highly recommended.