More Books
Effective C++ 55 Specific Ways to Improve Your Programs and Designs
Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs
Table of Contents
Copyright
Praise for Effective C++, Third Edition
Addison-Wesley Professional Computing Series
Preface
Acknowledgments
Introduction
Terminology
Chapter 1. Accustoming Yourself to C++
Item 1: View C++ as a federation of languages
Item 2: Prefer consts, enums, and inlines to #defines
Item 3: Use const whenever possible
Item 4: Make sure that objects are initialized before they're used
Chapter 2. Constructors, Destructors, and Assignment Operators
Item 5: Know what functions C++ silently writes and calls
Item 6: Explicitly disallow the use of compiler-generated functions you do not want
Item 7: Declare destructors virtual in polymorphic base classes
Item 8: Prevent exceptions from leaving destructors
Item 9: Never call virtual functions during construction or destruction
Item 10: Have assignment operators return a reference to *this
Item 11: Handle assignment to self in operator=
Item 12: Copy all parts of an object
Chapter 3. Resource Management
Item 13: Use objects to manage resources.
Item 14: Think carefully about copying behavior in resource-managing classes.
Item 15: Provide access to raw resources in resource-managing classes.
Item 16: Use the same form in corresponding uses of new and delete.
Item 17: Store newed objects in smart pointers in standalone statements.
Chapter 4. Designs and Declarations
Item 18: Make interfaces easy to use correctly and hard to use incorrectly
Item 19: Treat class design as type design
Item 20: Prefer pass-by-reference-to-const to pass-by-value
Item 21: Don't try to return a reference when you must return an object
Item 22: Declare data members private
Item 23: Prefer non-member non-friend functions to member functions
Item 24: Declare non-member functions when type conversions should apply to all parameters
Item 25: Consider support for a non-throwing swap
Chapter 5. Implementations
Item 26: Postpone variable definitions as long as possible.
Item 27: Minimize casting.
Item 28: Avoid returning "handles" to object internals.
Item29: Strive for exception-safe code.
Item 30: Understand the ins and outs of inlining.
Item31: Minimize compilation dependencies between files.
Chapter 6. Inheritance and Object-Oriented Design
Item 32: Make sure public inheritance models "is-a."
Item 33: Avoid hiding inherited names
Item 34: Differentiate between inheritance of interface and inheritance of implementation
Item 35: Consider alternatives to virtual functions
Item 36: Never redefine an inherited non-virtual function
Item 37: Never redefine a function's inherited default parameter value
Item 38: Model "has-a" or "is-implemented-in-terms-of" through composition
Item 39: Use private inheritance judiciously
Item 40: Use multiple inheritance judiciously
Chapter 7. Templates and Generic Programming
Item 41: Understand implicit interfaces and compile-time polymorphism
Item 42: Understand the two meanings of typename
Item 43: Know how to access names in templatized base classes
Item 44: Factor parameter-independent code out of templates
Item 45: Use member function templates to accept "all compatible types."
Item 46: Define non-member functions inside templates when type conversions are desired
Item 47: Use traits classes for information about types
Item 48: Be aware of template metaprogramming
Chapter 8. Customizing new and delete
Item 49: Understand the behavior of the new-handler
Item 50: Understand when it makes sense to replace new and delete
Item 51: Adhere to convention when writing new and delete
Item 52: Write placement delete if you write placement new
Chapter 9. Miscellany
Item 53: Pay attention to compiler warnings.
Item 54: Familiarize yourself with the standard library, including TR1
Item.55: Familiarize yourself with Boost.
Appendix A. Beyond Effective C++
Appendix B. Item Mappings Between Second and Third Editions
Index
index_SYMBOL
index_A
index_B
index_C
index_D
index_E
index_F
index_G
index_H
index_I
index_J
index_K
index_L
index_M
index_N
index_O
index_P
index_R
index_S
index_T
index_U
index_V
index_W
index_X
index_Z
Index
[
SYMBOL
] [
A
] [
B
] [
C
] [
D
] [
E
] [
F
] [
G
] [
H
] [
I
] [
J
] [
K
] [
L
] [
M
] [
N
] [
O
] [
P
] [
R
] [
S
] [
T
] [
U
] [
V
] [
W
] [
X
] [
Z
]
early binding
easy to use correctly and hard to use incorrectly
2nd
EBO [See
empty base optimization
]
Effective C++, compared to More Effective C++ and Effective STL
Effective STL
2nd
3rd
compared to Effective C++
contents of
2nd
efficiency
assignment vs. construction and destruction
2nd
default parameter binding
dynamic_cast
Handle classes
incorrect code and
2nd
init. with vs. without args
Interface classes
macros vs. inline functions
member init. vs. assignment
minimizing compilation dependencies
operator new/operator delete and
pass-by-reference and
pass-by-value and
2nd
passing built-in types and
runtime vs. compile-time tests
template metaprogramming and
template vs. function parameters
unused objects
virtual functions
Eiffel
embedding [See
composition
]
empty base optimization (EBO)
2nd
encapsulation
2nd
casts and
design patterns and
handles and
measuring
protected members and
RAII classes and
enum hack
2nd
3rd
errata list, for this book
errors
detected during linking
2nd
runtime
evaluation order, of parameters
example classes/templates
A
ABEntry
AccessLevels
Address
Airplane
2nd
3rd
Airport
AtomicClock
AWOV
B
2nd
3rd
Base
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
BelowBottom
bidirectional_iterator_tag
Bird
2nd
3rd
Bitmap
BorrowableItem
Bottom
BuyTransaction
2nd
C
Circle
CompanyA
CompanyB
CompanyZ
CostEstimate
CPerson
CTextBlock
2nd
3rd
Customer
2nd
D
2nd
3rd
DatabaseID
Date
2nd
3rd
Day
DBConn
2nd
DBConnection
deque
deque::iterator
Derived
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
Directory
ElectronicGadget
Ellipse
Empty
2nd
3rd
EvilBadGuy
2nd
EyeCandyCharacter
Factorial
Factorial<0>
File
2nd
FileSystem
FlyingBird
Font
2nd
3rd
forward_iterator_tag
GameCharacter
2nd
3rd
4th
5th
GameLevel
GamePlayer
2nd
GraphNode
GUIObject
HealthCalcFunc
HealthCalculator
HoldsAnInt
2nd
HomeForSale
2nd
3rd
input_iterator_tag
input_iterator_tag<Iter*>
InputFile
2nd
Investment
2nd
IOFile
2nd
IPerson
2nd
iterator_traits
2nd
[See also
std::iterator_traits
]
list
list::iterator
Lock
2nd
3rd
LoggingMsgSender
2nd
3rd
4th
5th
Middle
ModelA
2nd
3rd
ModelB
2nd
3rd
ModelC
2nd
3rd
Month
2nd
MP3Player
MsgInfo
MsgSender
MsgSender<CompanyZ>
NamedObject
2nd
NewHandlerHolder
NewHandlerSupport
output_iterator_tag
OutputFile
2nd
Penguin
2nd
3rd
4th
Person
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
PersonInfo
2nd
PhoneNumber
2nd
PMImpl
Point
2nd
3rd
PrettyMenu
2nd
3rd
PriorityCustomer
random_access_iterator_tag
Rational
2nd
3rd
4th
5th
6th
7th
8th
9th
RealPerson
Rectangle
2nd
3rd
4th
5th
6th
7th
8th
RectData
SellTransaction
Set
2nd
Shape
2nd
3rd
4th
5th
6th
7th
SmartPtr
2nd
3rd
SpecialString
SpecialWindow
2nd
3rd
4th
SpeedDataCollection
Square
SquareMatrix
2nd
3rd
4th
SquareMatrixBase
2nd
StandardNewDeleteForms
Student
2nd
3rd
TextBlock
2nd
3rd
TimeKeeper
2nd
Timer
Top
Transaction
2nd
3rd
Uncopyable
WaterClock
WebBrowser
2nd
3rd
4th
Widget
2nd
3rd
4th
5th
6th
7th
8th
9th
10th
11th
12th
13th
14th
15th
16th
17th
18th
19th
20th
21st
22nd
23rd
Widget::WidgetTimer
WidgetImpl
2nd
Window
2nd
3rd
4th
5th
WindowWithScrollBars
WristWatch
X
Y
Year
example functions/templates
ABEntry::ABEntry
2nd
3rd
AccessLevels::getReadOnly
AccessLevels::getReadWrite
AccessLevels::setReadOnly
AccessLevels::setWriteOnly
advance
2nd
3rd
4th
5th
6th
Airplane::defaultFly
Airplane::fly
2nd
3rd
4th
askUserForDatabaseID
AWOV::AWOV
B::mf
Base::operator delete
Base::operator new
Bird::fly
BorrowableItem::checkOut
boundingBox
BuyTransaction::BuyTransaction
BuyTransaction::createLogString
calcHealth
callWithMax
changeFontSize
Circle::draw
clearAppointments
2nd
clearBrowser
CPerson::birthDate
CPerson::CPerson
CPerson::name
CPerson::valueDelimClose
CPerson::valueDelimOpen
createInvestment
2nd
3rd
4th
5th
6th
CTextBlock::length
2nd
CTextBlock::operator[i]
Customer::Customer
Customer::operator=
D::mf
Date::Date
2nd
Day::Day
daysHeld
DBConn::close
DBConn::~DBConn
2nd
3rd
4th
defaultHealthCalc
2nd
Derived::Derived
2nd
Derived::mf1
Derived::mf4
Directory::Directory
2nd
doAdvance
2nd
3rd
doMultiply
doProcessing
2nd
3rd
doSomething
2nd
3rd
4th
5th
doSomeWork
eat
2nd
ElectronicGadget::checkOut
Empty::Empty
2nd
Empty::operator=
Empty::~Empty
encryptPassword
2nd
3rd
4th
error
EvilBadGuy::EvilBadGuy
f
2nd
3rd
4th
FlyingBird::fly
Font::Font
Font::get
Font::operator FontHandle
Font::~Font
GameCharacter::doHealthValue
GameCharacter::GameCharacter
2nd
3rd
GameCharacter::healthValue
2nd
3rd
4th
5th
GameLevel::health
getFont
hasAcceptableQuality
HealthCalcFunc::calc
HealthCalculator::operator(_)
lock
Lock::Lock
2nd
Lock::~Lock
logCall
LoggingMsgSender::sendClear
2nd
LogginMsgSender::sendClear
2nd
3rd
loseHealthQuickly
loseHealthSlowly
main
2nd
3rd
4th
makeBigger
makePerson
max
ModelA::fly
2nd
ModelB::fly
2nd
ModelC::fly
2nd
Month::Dec
Month::Feb
Month::Jan
Month::Month
2nd
MsgSender::sendClear
MsgSender::sendSecret
MsgSender<CompanyZ>::sendSecret
NewHandlerHolder::NewHandlerHolder
NewHandlerHolder::~NewHandlerHolder
NewHandlerSupport::operator new
NewHandlerSupport::set_new_handler
numDigits
operator delete
operator new
2nd
operator*
2nd
3rd
4th
5th
6th
7th
8th
9th
operator==
outOfMem
Penguin::fly
Person::age
Person::create
2nd
Person::name
Person::Person
PersonInfo::theName
PersonInfo::valueDelimClose
PersonInfo::valueDelimOpen
PrettyMenu::changeBackground
2nd
3rd
4th
print
print2nd
2nd
3rd
4th
printNameAndDisplay
2nd
priority
PriorityCustomer::operator=
2nd
PriorityCustomer::PriorityCustomer
2nd
processWidget
RealPerson::RealPerson
RealPerson::~RealPerson
Rectangle::doDraw
Rectangle::draw
2nd
Rectangle::lowerRight
2nd
Rectangle::upperLeft
2nd
releaseFont
Set::insert
Set::member
Set::remove
Set::size
Shape::doDraw
Shape::draw
2nd
3rd
4th
5th
Shape::error
2nd
Shape::objectID
2nd
SmartPtr::get
SmartPtr::SmartPtr
someFunc
2nd
SpecialWindow::blink
SpecialWindow::onResize
SquareMatrix::invert
SquareMatrix::setDataPtr
SquareMatrix::SquareMatrix
2nd
3rd
StandardNewDeleteForms::operator delete
2nd
3rd
StandardNewDeleteForms::operator new
2nd
3rd
std::swap
std::swap<Widget>
2nd
study
2nd
swap
2nd
tempDir
TextBlock::operator[i]
2nd
3rd
4th
5th
6th
tfs
Timer::onTick
Transaction::init
Transaction::Transaction
2nd
3rd
Uncopyable::operator=
Uncopyable::Uncopyable
unlock
validateStudent
2nd
Widget::onTick
2nd
Widget::operator new
Widget::operator+=
Widget::operator=
2nd
3rd
4th
5th
6th
7th
8th
Widget::set_new_handler
Widget::swap
Window::blink
Window::onResize
workWithIterator
2nd
Year::Year
exception specifications
exception-safe code
2nd
copy-and-swap and
legacy code and
pimpl idiom and
side effects and
exception-safety guarantees
2nd
Exceptional C++
2nd
Exceptional C++ Style
2nd
exceptions
delete and
destructors and
2nd
member swap and
standard hierarchy for
swallowing
unused objects and
explicit calls to base class functions
explicit constructors
2nd
3rd
generalized copy construction and
explicit inline request
explicit specification, of class names
explicit type conversions vs. implicit
2nd
expression templates
expressions, implicit interfaces and