More Effective C++ Cheat Sheet
Book by Scott Meyers – Cheat Sheet by Christopher Gilbert
Basics Amortize the cost of expected computations
Distinguish between pointers and references Understand the origin of temporary objects
Prefer C++-style casts Facilitate the return value optimization
Never treat arrays polymorphically Overload to avoid implicit type conversions
Avoid gratuitous default constructors Consider using op= instead of stand-alone op
Operators Consider alternative libraries
Understand the costs of virtual functions,
Be wary or user-defined conversion functions multiple inheritance, virtual base classes, and
RTTI
Distinguish between prefix and postfix forms of
Techniques
increment and decrement operators
Virtualizing constructors and non-member
Never overload &&, ||, or ,.
functions
Understand the different meanings of new and
Limiting the number of objects of a class
delete
Exceptions Requiring or prohibiting heap-based objects
Use destructors to prevent resource leaks Smart pointers
Prevent resource leaks in constructors Reference counting
Prevent exceptions from leaving destructors Proxy classes
Understand how throwing an exception differs
Making functions virtual with respect to more
from passing a parameter or calling a virtual
than one object
functions
Catch exceptions by reference Miscellany
Use exception specifications judiciously Program in the future tense
Understand the costs of exception handling Make non-leaf classes abstract
Understand how to combine C++ and C in the
Efficiency
same program
Remember the 80-20 rule Familiarize yourself with the language standard
Consider using lazy evaluation