译序
中英简繁术语对照
目录
序言
致谢
导读
1.让自己习惯C++
Accustoming Yourself to C++
条款01:视C++ 为一个语言联邦
View C++ as a federation of languages
条款02:尽量以const, enum, inline替换#define
Prefer consts,enums, and inlines to #defines
条款03:尽可能使用const
Use const whenever possible
条款04:确定对象被使用前已先被初始化
Make sure that objects are initialized before they''''re used
2.构造/析构/赋值运算
Constructors, Destructors, and Assignment Operators
条款05:了解C++ 默默编写并调用哪些函数
Know what functions C++ silently writes and calls
条款06:若不想使用编译器自动生成的函数,就该明确拒绝
Explicitly disallow the use of compiler-generated functions you do not want
条款07:为多态基类声明virtual析构函数
Declare destructors virtual in polymorphic base classes
条款08:别让异常逃离析构函数
Prevent exceptions from leaving destructors
条款09:绝不在构造和析构过程中调用virtual函数
Never call virtual functions during construction or destruction
条款10:令operator=返回一个reference to *this
Have assignment operators return a reference to *this
条款11:在operator=中处理“自我赋值”
Handle assignment to self in operator
条款12:复制对象时勿忘其每一个成分
Copy all parts of an object
3.资源管理
Resource Management
条款13:以对象管理资源
Use objects to manage resources
条款14:在资源管理类中小心copying行为
Think carefully about copying behavior in resource-managing classes
条款15:在资源管理类中提供对原始资源的访问
Provide access to raw resources in resource-managing classes
条款16:成对使用new和delete时要采取相同形式
Use the same form in corresponding uses of new and delete
条款17:以独立语句将newed对象置入智能指针
Store newed objects in smart pointers in standalone statements
4.设计与声明
Designs and Declarations
条款18:让接口容易被正确使用,不易被误用
Make interfaces easy to use correctly and hard to use incorrectly