More C++ Idioms
From Wikibooks, the open-content textbooks collection
Contents |
[edit] Preface
| C++ has indeed become too "expert friendly" --- Bjarne Stroustrup, The Problem with Programming, Technology Review, Nov 2006.
Stroustrup's saying is true because experts are intimately familiar with the idioms in the language. With the increase in the idioms a programmer understands, the language becomes friendlier to him or her. The objective of this open content book is to present modern C++ idioms to programmers who have moderate level of familiarity with C++, and help elevate their knowledge so that C++ feels much friendlier to them. It is designed to be an exhaustive catalog of reusable idioms that expert C++ programmers often use while programming or designing using C++. This is an effort to capture their techniques and vocabulary into a single work. This book describes the idioms in a regular format: Name-Intent-Motivation-Solution-References, which is succinct and helps speed learning. By their nature, idioms tend to have appeared in the C++ community and in published work many times. An effort has been made to refer to the original source(s) where possible; if you find a reference incomplete or incorrect, please feel free to suggest or make improvements. The world is invited to catalog reusable pieces of C++ knowledge (similar to the book on design patterns by GoF). The goal here is to first build an exhaustive catalog of modern C++ idioms and later evolve it into an idiom language, just like a pattern language. Finally, the contents of this book can be redistributed under the terms of the GNU Free Documentation License. Aimed toward: Anyone with an intermediate level of knowledge in C++ and supported language paradigms |
[edit] More Information
Authors | Praise | Guidelines for Authors | GNU Free Documentation License
[edit] Table of Contents
- Adapter Template
- Address Of
- Algebraic Hierarchy
- Attach by Initialization
- Barton-Nackman trick
- Base-from-Member
- Boost mutant
- Calling Virtuals During Initialization
- Dynamic Binding During Initialization
- Capability Query
- Checked delete
- Clear-and-minimize
- Coercion by Member Template
- Compile Time Control Structures
- Computational Constructor
- Concrete Data Type
- Const auto_ptr
- Construct On First Use
- Construction Tracker
- Copy-and-swap
- Copy-on-write
- Counted Body (intrusive reference counting)
- Reference Counting (intrusive)
- Curiously Recurring Template Pattern
- Detached Counted Body (non-intrusive reference counting)
- Empty Base Optimization
- Emulated Exception
- enable-if
- Envelope Letter
- Erase-Remove
- Examplar
- Execute-Around Pointer
- Export Guard Macro
- Expression-template
- Fake Vtable
- Fast Pimpl
- Final Class
- Forward Declare First
- Free Function Allocators
- Friendship and the Attorney-Client
- Function Object
- Generic Container Idioms
- Cheshire Cat
- Compilation Firewall
- Handle Body
- Pimpl
- Include Guard Macro
- Inline Guard Macro
- Inner Class
- Int-To-Type
- Interface Class
- Iterator Pair
- Making New Friends
- Metafunction
- Move Constructor
- Multi-statement Macro
- Multiple Member Initialization
- Named Constructor
- Named External Argument
- Named Loop
- Named Parameter
- Named Template Parameters
- Nifty Counter
- Schwarz Counter
- Non-copyable Mixin
- Non-member get
- Non-member Non-friend Function
- Non-throwing swap
- Non-Virtual Interface
- Public Overloaded Non-Virtuals Call Protected Non-Overloaded Virtuals
- nullptr
- Object Generator
- Object Template
- Overload Set Creation
- Parameterized Base Class
- Parameterized Inheritance
- Metafunction wrapper
- Policy Clone
- Policy-based Class Design
- Polymorphic Exception
- Recursive Type Composition
- Execute-Around Object
- Resource Acquisition Is Initialization
- Scoped Locking
- Resource Return
- Runtime Static Initialization Order Idioms
- Safe bool
- Scope Guard
- SFINAE
- Substitution Failure Is Not An Error
- Shortening Long Template Names
- Shrink-to-fit
- Small Object Optimization
- Smart Pointer
- Storage Class Tracker
- Tag Dispatching
- Temporary Base Class
- The result_of technique
- Thin Template
- Trailing Parens for Method Chaining for Named parameter
- Traits
- Type Erasure
- Templated Typedef
- Type Generator
- Type Safe Enum
- Type Selection
- Virtual Constructor
- Virtual Friend Function
| Wikibook Development Stages | ||||
|---|---|---|---|---|
| Sparse text |
Developing text |
Maturing text |
Developed text |
Comprehensive text: |

