isu007 / CppIdioms

A curated list of Modern C++ idioms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CppIdioms

A curated list of Modern C++ idioms.

License

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 CppIdioms 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.

Table of Contents

  1. Variadic Argument Macro
  2. Multi Statement Macro
  3. Name Macro
  4. INTSIZEOF
  5. offset_of
  6. Flexible Array
  7. Virtual Friend Function
  8. Making New Friend
  9. addressof
  10. Policy Base Design
  11. Require or Prohibiting Heap Object
  12. SFINAE (Substitution Failure Is Not An Error)
  13. enable_if
  14. Type Selection
  15. Identity
  16. Return Type Resolver
  17. reference_wrapper
  18. Two Phase Constructor
  19. Calling Virtuals during Initialization
  20. Dynamic Creation
  21. RTTI (Run-Time Type Identification)
  22. Capability Query
  23. Coercion by Member Template
  24. Covariant Return Type
  25. Attach by Initialization
  26. Clear and Minimize
  27. Placement New
  28. Generic Container idioms
  29. Meta Function
  30. Policy Clone
  31. Safe bool
  32. Thin Template
  33. RVO (Return Value Optimization), NRVO (Named RVO)
  34. Checked Delete
  35. Temporary Proxy
  36. Traits
  37. int to Type
  38. Pimpl
  39. Empty Class
  40. Tag Dispatching
  41. Type List
  42. Exception Safety
  43. Trivial

License

This software is provided under the MIT License, more information can be found in the license file.

How To Contribute

Contributions are always welcome, either reporting issues/bugs or forking the repository and then issuing pull requests when you have completed some additional coding that you feel will be beneficial to the main project. If you are interested in contributing in a more dedicated capacity, then please contact me.

Contact

You can contact me via Facebook at http://www.facebook.com/utilForever. I am always happy to answer questions or help with any issues you might have, and please be sure to share any additional work or your creations with me, I love seeing what other people are making.

About

A curated list of Modern C++ idioms

License:MIT License


Languages

Language:C++ 100.0%