Effective C++
C++ Basic
C++ Union
Using const,enum,inline instead of #define
Using const whenever possible
Make sure init before use
Constructor,Destructor, Assignment op
Silent functions in class
Explicitly delete silent functions
Virtual destructors in polymorphic
Non–throw destructors
No virtual call in construction and destruction
Operator= return *this
Operator= handle self-assignment
Deep copy when copy
Resource Management
Using resource-managing class
Copying resource-managing class
Access raw in resource-managing class
Same form in new and delete
Standalone statement when smart pointers
Design
Make interface to easy use
Design class as type
Pass by const reference instead of value
Dont return reference
Make data member private
Non-member instead of member function
Non-member function when type conversion
Non-throw swap
Implementation
Postpone variable definitions
Consider casting
Avoid return handles of object internals
Strive for exception safe
Inlining
Compilation dependency
Inheritance and OOP
Public inheritance means is-a
Avoid hiding base class through overwrite
Interface extend and implementation extend
Alternative virtual
Never redefine non-virtual from base class
Never redefine default parameters
Composition means has-a or implement-of
Private inheritance means implement-of
Multiple inheritance
Template & Generic Programming
Implicit interface and compile-time polymoriphism
Using typename
Templatized base class
Template Parameter
Member function template
Non-member function to cast
Traits class
Meta programming
New & Delete
Miscellany
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。