Contents
Preface
Chapter 1 Getting Started
1.1 Writing a Simple C++ Program
1.1.1 Compiling and Executing Our Program
1.2 A First Look at Input/Output
1.3 A Word about Comments
1.4 Flow of Control
1.4.1 The while Statement
1.4.2 The for Statement
1.4.3 Reading an Unknown Number of Inputs
1.4.4 The if Statement
1.5 Introducing Classes
1.5.1 The Sales_itemClass
1.5.2 A First Look at Member Functions
1.6 The Bookstore Program
Chapter Summary
Defined Terms
Part I: The Basics
Chapter 2 Variables and Basic Types
2.1 Primitive Built-in Types
2.2 Variables
2.3 Compound Types
2.4 Const Qualifier
2.5 Dealing with Types
2.6 Defining Our Own Data Structures
Chapter Summary
Defined Terms
Chapter 3 Strings, Vectors, and Arrays
3.1 Namespace using Declarations
3.2 Library string Type
3.3 Library vector Type
3.4 Introducing Iterators
3.5 Arrays
3.6 Multidimensional Arrays
Chapter Summary
Defined Terms
Chapter 4 Expressions
4.1 Fundamentals
4.2 Arithmetic Operators
4.3 Logical and Relational Operators
4.4 Assignment Operators
4.5 Increment and Decrement Operators
4.6 The Member Access Operators
4.7 The Conditional Operator
4.8 The Bitwise Operators
4.9 The sizeof Operator
4.10 Comma Operator
4.11 Type Conversions
4.12 Operator Precedence Table
Chapter Summary
Defined Terms
Chapter 5 Statements
5.1 Simple Statements
5.2 Statement Scope
5.3 Conditional Statements
5.4 Iterative Statements
5.5 Jump Statements
5.6 Try Blocks and Exception Handling
Chapter Summary
Defined Terms
Chapter 6 Functions
6.1 Function Basics
6.2 Argument Passing
6.3 Return Types and the return Statement
6.4 Overloaded Functions
6.5 Features for Specialized Uses
6.6 Function Matching
6.7 Pointers to Functions
Chapter Summary
Defined Terms
Chapter 7 Classes
7.1 Defining Abstract Data Types
7.2 Access Control and Encapsulation
7.3 Additional Class Features
7.4 Class Scope
7.5 Constructors Revisited
7.6 Static Class Members
Chapter Summary
Defined Terms
Part II: The C++ Library
Chapter 8 The IO Library
8.1 The IO Classes
8.2 File Input and Output
8.3 string Streams
Chapter Summary
Defined Terms
Chapter 9 Sequential Containers
9.1 Overview of the Sequential Containers
9.2 Container Library Overview
9.3 Sequential Container Operations
9.4 How a vector Grows
9.5 Additional string Operations
9.6 Container Adaptors
Chapter Summary
Defined Terms
Chapter 10 Generic Algorithms
10.1 Overview
10.2 A First Look at the Algorithms
10.3 Customizing Operations
10.4 Revisiting Iterators
10.5 Structure of Generic Algorithms
10.6 Container-Specific Algorithms
Chapter Summary
Defined Terms
Chapter 11 Associative Containers
11.1 Using an Associative Container
11.2 Overview of the Associative Containers
11.3 Operations on Associative Containers
11.4 The Unordered Containers
Chapter Summary
Defined Terms
Chapter 12 Dynamic Memory
12.1 Dynamic Memory and Smart Pointers
12.2 Dynamic Arrays
12.3 Using the Library: A Text-Query Program
Chapter Summary
Defined Terms
Part III: Tools for Class Authors
Chapter 13 Copy Control
13.1 Copy, Assign, and Destroy
13.2 Copy Control and Resource Management
13.3 Swap
13.4 A Copy-Control Example
13.5 Classes That Manage Dynamic Memory
13.6 Moving Objects
Chapter Summary
Defined Terms
Chapter 14 Overloaded Operations and Conversions
14.1 Basic Concepts
14.2 Input and Output Operators
14.3 Arithmetic and Relational Operators
14.4 Assignment Operators
14.5 Subscript Operator
14.6 Increment and Decrement Operators
14.7 Member Access Operators
14.8 Function-Call Operator
14.9 Overloading, Conversions, and Operators
Chapter Summary
Defined Terms
Chapter 15 Object-Oriented Programming
15.1 OOP: An Overview
15.2 Defining Base and Derived Classes
15.3 Virtual Functions
15.4 Abstract Base Classes
15.5 Access Control and Inheritance
15.6 Class Scope under Inheritance
15.7 Constructors and Copy Control
15.8 Containers and Inheritance
15.9 Text Queries Revisited
Chapter Summary
Defined Terms
Chapter 16 Templates and Generic Programming
16.1 Defining a Template
16.2 Template Argument Deduction
16.3 Overloading and Templates
16.4 Variadic Templates
16.5 Template Specializations
Chapter Summary
Defined Terms
Part IV: Advanced Topics
Chapter 17 Specialized Library Facilities
17.1 The tuple Type
17.2 The bitset Type
17.3 Regular Expressions
17.4 Random Numbers
17.5 The IO Library Revisited
Chapter Summary
Defined Terms
Chapter 18 Tools for Large Programs
18.1 Exception Handling
18.2 Namespaces
18.3 Multiple and Virtual Inheritance
Chapter Summary
Defined Terms
Chapter 19 Specialized Tools and Techniques
19.1 Controlling Memory Allocation
19.2 Run-Time Type Identification
19.3 Enumerations
19.4 Pointer to Class Member
19.5 Nested Classes
19.6 Union: A Space-Saving Class
19.7 Local Classes
19.8 Inherently Nonportable Features
Chapter Summary
Defined Terms
Appendix A: The Library
A.1 Library Names and Headers
A.2 A Brief Tour of the Algorithms
A.2.1 Algorithms to Find an Object
A.2.2 Other Read-Only Algorithms
A.2.3 Binary Search Algorithms
A.2.4 Algorithms That Write Container Elements
A.2.5 Partitioning and Sorting Algorithms
A.2.6 General Reordering Operations
A.2.7 Permutation Algorithms
A.2.8 Set Algorithms for Sorted Sequences
A.2.9 Minimum and Maximum Values
A.2.10 Numeric Algorithms
A.3 Random Numbers
A.3.1 Random Number Distributions
A.3.2 Random Number Engines
Index
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z