4.1 ITEM M5:谨慎定义类型转换函数.....................................................................................21
4.2 I
TEM M6:自增(INCREMENT)、自减(DECREMENT)操作符前缀形式与后缀形式的区别
27
4.3 I
TEM M7:不要重载“&&”,“||”, 或“,”.............................................................................29
4.4 I
TEM M8:理解各种不同含义的 NEW 和 DELETE .............................................................32
5. 异常 ..............................................................................................................................................37
5.1 I
TEM M9:使用析构函数防止资源泄漏 ............................................................................38
5.2 I
TEM M10:在构造函数中防止资源泄漏 ..........................................................................42
5.3 I
TEM M11:禁止异常信息(EXCEPTIONS)传递到析构函数外 .....................................51
5.4 I
TEM M12:理解“抛出一个异常”与“传递一个参数”或“调用一个虚函数”间的
差异
54
5.5 I
TEM M13:通过引用(REFERENCE)捕获异常 ...............................................................60
5.6 I
TEM M14:审慎使用异常规格(EXCEPTION SPECIFICATIONS)..........................................64
5.7 I
TEM M15:了解异常处理的系统开销 ..............................................................................69
6. 效率 ..............................................................................................................................................71
6.1 I
TEM M16:牢记 80-20 准则(80-20 RULE) ..............................................................72
6.2 I
TEM M17:考虑使用 LAZY EVALUATION(懒惰计算法) ..............................................74
6.3 I
TEM M18:分期摊还期望的计算.......................................................................................81
6.4 I
TEM M19:理解临时对象的来源.......................................................................................85
6.5 I
TEM M20:协助完成返回值优化.......................................................................................87
6.6 I
TEM M21:通过重载避免隐式类型转换 ..........................................................................91
6.7 I
TEM M22:考虑用运算符的赋值形式(OP=)取代其单独形式(OP)......................93
6.8 I
TEM M23:考虑变更程序库...............................................................................................96
6.9 I
TEM M24:理解虚拟函数、多继承、虚基类和 RTTI 所需的代价..............................98
7. 技巧(TECHNIQUES,又称 IDIOMS 或 PATTERN).....................................................106
7.1 I
TEM M25:将构造函数和非成员函数虚拟化................................................................107
7.2 I
TEM M26:限制某个类所能产生的对象数量................................................................ 111
7.3 I
TEM M27:要求或禁止在堆中产生对象 ........................................................................125
7.4 I
TEM M28:灵巧(SMART)指针......................................................................................134
7.5 I
TEM M29:引用计数..........................................................................................................149
7.6 I
TEM M30:代理类..............................................................................................................177
7.7 I
TEM M31:让函数根据一个以上的对象来决定怎么虚拟...........................................190
8. 杂项 ............................................................................................................................................212
8.1 I
TEM M32:在未来时态下开发程序.................................................................................212
8.2 I
TEM M33:将非尾端类设计为抽象类 ............................................................................216
8.3 I
TEM M34:如何在同一程序中混合使用 C++和 C........................................................226
8.4 I
TEM M35:让自己习惯使用标准 C++语言....................................................................231
9. 附录 ............................................................................................................................................237
9.1 推荐读物
..........................................................................................................................237
9.2 一个
AUTO_PTR 的实现实例 ..........................................................................................241
9.3 在
C++ 中计算物件个数(OBJECTS COUNTING IN C++)译者:陈崴...................244
9.4 为智能指标实作
OPERATOR->*(IMPLEMENTING OPERATOR->* FOR SMART POINTERS)
译者:陈崴
....................................................................................................................................254