- Item 1: 视C++为一个语言联邦
- Item 2: 尽量使用 const、enum、inline等替换 #define
- Item 3: 尽量使用 const
- Item 4: 确保对象在使用前被初始化
- Item 5: 了解 C++ 默认添加和调用的函数
- Item 6:禁用那些不需要的缺省方法
- Item 7: 在多态基类中将析构函数声明为虚函数
- Item 8:析构函数不要抛出异常
- Item 9: 绝不要在构造或析构期间调用虚函数
- Item 10:赋值运算符要返回自身的引用
- Item 11:赋值运算符的自赋值问题
- Item 12:完整地拷贝对象
- Item 13:使用对象(智能指针)来管理资源
- Item 14:资源管理类要特别注意拷贝行为
- Item 16: 使用相同形式的 new 和 delete
- Item 17:在单独的语句中将new的对象放入智能指针
- Item 18:让接口容易被正确使用,不易被误用
- Item 20:传递常量引用比传值更好
- Item 21:需要返回对象时,不要返回引用
- Item 22:数据成员应声明为私有
- Item 23:非成员非友元函数好于成员函数
- Item 24: 当类型转换应该用于所有参数时,声明为非成员函数
- Item 25:考虑实现一个不抛异常的swap
- Item 26:尽可能推迟变量的定义
- Item 28:不要返回对象内部的句柄
- Item 29:追求异常安全的代码
- Item 30:理解 inline 函数的里里外外
- Item 31:最小化文件之间的编译依赖
- Item 32:确保 public 继承是 "is a" 的关系
- Item 33:避免隐藏继承来的名称
- Item 34:区分接口继承和实现继承
- Item 35:考虑虚函数的其他替代设计
- Item 36:不要重写继承来的非虚函数
- Item 37:不要重写父类函数的默认参数
- Item 38:通过组合表示"拥有"或"以...实现"的关系
- Item 39:明智地使用 private 继承
- Item 40:明智地使用多继承
- Item 41:隐式接口与编译期多态
- Item 42:typename 的两种用法
- Item 43:访问模板基类中的名称
- Item 44:将参数无关代码重构到模板外去
- Item 45:使用成员函数模板来接受所有兼容的类型
- Item 46:需要类型转换时,应当在类模板中定义非成员函数
- Item 47:使用 Traits 类提供类型信息
- Item 48:了解模板元编程
- Item 49:new handler的行为
- Item 50:为什么需要自定义 new 和 delete?
- Item 51:写new和delete时请遵循惯例
- Item 52:写了placement new就要写placement delete