More C++ Idioms

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] Preface

More C++ Idioms 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

RSS Logo

More C++ Idioms RSS 2.0




[edit] Table of Contents

Note: synonyms for each idiom are listed in parentheses.

  1. Adapter Template
  2. Address Of
  3. Algebraic Hierarchy 75% developed  as of 12 June 2008
  4. Attach by Initialization
  5. Barton-Nackman trick
  6. Base-from-Member 75% developed  as of 6 August 2007
  7. Boost mutant
  8. Calling Virtuals During Initialization 75% developed  as of 6 August 2007
  9. Capability Query 75% developed  as of 6 January 2008
  10. Checked delete 75% developed  as of 15 August 2007
  11. Clear-and-minimize 75% developed  as of 10 August 2007
  12. Coercion by Member Template 100% developed  as of 14 August 2007
  13. Compile Time Control Structures
  14. Computational Constructor
  15. Concrete Data Type 75% developed  as of 17 March 2008
  16. Const auto_ptr 75% developed  as of 15 August 2007
  17. Construct On First Use 75% developed  as of 6 August 2007
  18. Construction Tracker 75% developed  as of 6 August 2007
  19. Copy-and-swap 75% developed  as of 10 August 2007
  20. Copy-on-write
  21. Counted Body (intrusive reference counting) 75% developed  as of 16 November 2007
  22. Curiously Recurring Template Pattern 75% developed  as of 6 August 2007
  23. Detached Counted Body (non-intrusive reference counting) 75% developed  as of 16 November 2007
  24. Empty Base Optimization
  25. Emulated Exception
  26. enable-if 00% developed  as of 21 October 2007
  27. Envelope Letter 75% developed  as of 1 February 2008
  28. Erase-Remove 75% developed  as of 17 November 2007
  29. Examplar
  30. Execute-Around Pointer 75% developed  as of 6 August 2007
  31. Export Guard Macro
  32. Expression-template 75% developed  as of 6 August 2007
  33. Fake Vtable
  34. Fast Pimpl 00% developed  as of 6 August 2007
  35. Final Class
  36. Forward Declare First
  37. Free Function Allocators
  38. Friendship and the Attorney-Client
  39. Function Object
  40. Generic Container Idioms 75% developed  as of 22 November 2007
  41. Pimpl (Handle Body, Compilation Firewall, Cheshire Cat) 75% developed  as of 16 November 2007
  42. Include Guard Macro 75% developed  as of 3 November 2007
  43. Inline Guard Macro 75% developed  as of 3 November 2007
  44. Inner Class 75% developed  as of 31 August 2007
  45. Int-To-Type 75% developed  as of 21 September 2008
  46. Interface Class 75% developed  as of 6 January 2008
  47. Iterator Pair 100% developed  as of 28 October 2007
  48. Making New Friends 75% developed  as of 5 January 2008
  49. Metafunction 75% developed  as of 15 September 2008
  50. Move Constructor 100% developed  as of 13 August 2007
  51. Multi-statement Macro 75% developed  as of 16 February 2008
  52. Multiple Member Initialization
  53. Named Constructor 75% developed  as of 28 September 2008
  54. Named External Argument
  55. Named Loop
  56. Named Parameter 00% developed  as of 6 August 2007
  57. Named Template Parameters
  58. Nifty Counter (Schwarz Counter) 75% developed  as of 6 August 2007
  59. Non-copyable Mixin 75% developed  as of 6 August 2007
  60. Non-member get
  61. Non-member Non-friend Function 00% developed  as of 10 March 2008
  62. Non-throwing swap 75% developed  as of 9 January 2008
  63. Non-Virtual Interface (Public Overloaded Non-Virtuals Call Protected Non-Overloaded Virtuals) 75% developed  as of 12 June 2008
  64. nullptr 75% developed  as of 3 November 2007
  65. Object Generator 75% developed  as of 14 September 2008
  66. Object Template
  67. Overload Set Creation
  68. Parameterized Base Class (Parameterized Inheritance) 75% developed  as of 6 August 2007
  69. Metafunction wrapper 100% developed  as of 16 August 2007
  70. Policy Clone (Metafunction wrapper) 100% developed  as of 14 August 2007
  71. Policy-based Class Design
  72. Polymorphic Exception 75% developed  as of 28 September 2008
  73. Recursive Type Composition
  74. Resource Acquisition Is Initialization (RAII, Execute-Around Object, Scoped Locking) 100% developed  as of 6 November 2007
  75. Resource Return 75% developed  as of 3 November 2007
  76. Runtime Static Initialization Order Idioms 75% developed  as of 6 August 2007
  77. Safe bool 75% developed  as of 6 August 2007
  78. Scope Guard 100% developed  as of 14 August 2007
  79. Substitution Failure Is Not An Error (SFINAE) 00% developed  as of 6 August 2007
  80. Shortening Long Template Names
  81. Shrink-to-fit 75% developed  as of 10 August 2007
  82. Small Object Optimization
  83. Smart Pointer 75% developed  as of 17 November 2007
  84. Storage Class Tracker
  85. Tag Dispatching 00% developed  as of 21 October 2007
  86. Temporary Base Class
  87. The result_of technique
  88. Thin Template 75% developed  as of 6 August 2007
  89. Trailing Parens for Method Chaining for Named parameter
  90. Traits 00% developed  as of 21 October 2007
  91. Type Erasure
  92. Type Generator (Templated Typedef) 75% developed  as of 14 September 2008
  93. Type Safe Enum
  94. Type Selection
  95. Virtual Constructor 75% developed  as of 17 March 2008
  96. Virtual Friend Function 00% developed  as of 6 August 2007
  97. Return Type Resolver


Wikibook Development Stages
Sparse text 00%.svg Developing text 25%.svg Maturing text 50%.svg Developed text 75%.svg Comprehensive text: 100%.svg
Infobox/More C++ Idioms
In other languages