满汉全席之外(译序/侯捷) ........................................................................................ v
前言Preface ................................................................................................................... xi
结构与组织 ............................................................................................................... xiii
关于源代码 ............................................................................................................... xiii
致谢 .......................................................................................................................... xiv
更多读物 ................................................................................................................... xiv
排版约定 .................................................................................................................... xv
第1 章 C++编程基础 Basic C++ Programming ........................................................... 1
1.1 如何撰写C++程序 ............................................................................................ 1
1.2 对象的定义与初始化 ......................................................................................... 7
1.3 撰写表达式 ....................................................................................................... 10
1.4 条件语句和循环语句 ....................................................................................... 15
1.5 如何运用Array 和Vector ................................................................................ 22
1.6 指针带来弹性 ................................................................................................... 26
1.7 文件的读写 ....................................................................................................... 30
第2 章 面向过程的编程风格 Procedural Programming ........................................ 35
2.1 如何编写函数 ................................................................................................... 35
2.2 调用函数 ........................................................................................................... 41
2.3 提供默认参数值 ............................................................................................... 50
2.4 使用局部静态对象 ........................................................................................... 53
2.5 声明inline 函数 ................................................................................................ 55
2.6 提供重载函数 ................................................................................................... 56
2.7 定义并使用模板函数 ....................................................................................... 58
2.8 函数指针带来更大的弹性 ............................................................................... 60
2.9 设定头文件 ....................................................................................................... 63
第3 章 泛型编程风格 Generic Programming ........................................................ 67
3.1 指针的算术运算 ............................................................................................... 68
3.2 了解Iterator(泛型指针) .............................................................................. 73
3.3 所有容器的共通操作 ....................................................................................... 76
3.4 使用顺序性容器 ............................................................................................... 77
3.5 使用泛型算法 ................................................................................................... 81
3.6 如何设计一个泛型算法 ................................................................................... 83
3.7 使用Map .......................................................................................................... 90
3.8 使用Set ............................................................................................................. 91
3.9 如何使用Iterator Inserter ................................................................................. 93
3.10 使用iostream Iterator ....................................................................................... 95
第4 章 基于对象的编程风格 Object-Based Programming ...................................... 99
4.1 如何实现一个Class ....................................................................................... 100
4.2 什么是构造函数和析构函数 ......................................................................... 104
4.3 何谓mutable(可变)和const(不变) .................................................. 109
4.4 什么是this 指针 ........................................................................................... 113
4.5 静态类成员 ..................................................................................................... 115
4.6 打造一个Iterator Class .................................................................................. 118
4.7 合作关系必须建立在友谊的基础上 ............................................................. 123
4.8 实现一个copy assignment operator ............................................................... 125
4.9 实现一个function object ................................................................................ 126
4.10 重载iostream 运算符 ..................................................................................... 128
4.11 指针,指向Class Member Function .............................................................. 130
第5 章 面向对象编程风格 Object-Oriented Programming ..................................... 135
5.1 面向对象编程概念 ......................................................................................... 135
5.2 漫游:面向对象编程思维 ............................................................................. 138
5.3 不带继承的多态 ............................................................................................. 142
5.4 定义一个抽象基类 ......................................................................................... 145
5.5 定义一个派生类 ............................................................................................. 148
5.6 运用继承体系 ................................................................................................. 155
5.7 基类应该多么抽象 ......................................................................................... 157
5.8 初始化、析构、复制 ..................................................................................... 158
5.9 在派生类中定义一个虚函数 ......................................................................... 160
5.10 运行时的类型鉴定机制 ................................................................................. 164
第6 章 以template 进行编程 Programming with Templates .................................... 167
6.1 被参数化的类型 ............................................................................................. 169
6.2 Class Template 的定义 ................................................................................... 171
6.3 Template 类型参数的处理 ............................................................................. 172
6.4 实现一个Class Template ............................................................................... 174
6.5 一个以Function Template 完成的Output 运算符 ........................................ 180
6.6 常量表达式与默认参数值 ............................................................................. 181
6.7 以Template 参数作为一种设计策略 ............................................................ 185
6.8 Member Template Function ............................................................................ 187
第7 章 异常处理 Exception Handling .................................................................. 191
7.1 抛出异常 ......................................................................................................... 191
7.2 捕获异常 ......................................................................................................... 193
7.3 提炼异常 ......................................................................................................... 194
7.4 局部资源管理 ................................................................................................. 198
7.5 标准异常 ......................................................................................................... 200
附录A 习题解答 Exercises Solutions ............................................................................ 205
附录B 泛型算法参考手册 Generic Algorithms Handbook .................................. 255
附录C 中英术语对照 侯捷 ..................................................................................... 271
英文术语的采用原则 .............................................................................................. 271
中英术语对照(按字母顺序排列) ...................................................................... 272
索引 Index ................................................................................................................. 277
· · · · · · (
收起)