More C++ Idioms

Table of Contents

Note: synonyms for each idiom are listed in parentheses.

  1. Adapter Template TODO
  2. Address Of                              Readed,没啥用
  3. Algebraic Hierarchy    Readed,没啥用
  4. Attach by Initialization Readed,没啥用
  5. Attorney-Clie  nt 有点用
  6. Barton-Nackman trick
  7. Base-from-Member
  8. Boost muta  nt 有点意思,实现了一个reverse
  9. Calling Virtuals During Initialization 有点意思,用template做的,但是和virtual函数没关系吧,并且必须要求static定义
  10. Capability Query
  11. Checked delete
  12. Clear-and-minimize
  13. Coercion by Member Template
  14. Computational Constructor
  15. Concrete Data Type
  16. Const auto_ptr
  17. Construct On First Use
  18. Construction Tracker
  19. Copy-and-swap
  20. Copy-on-write
  21. Intrusive reference counting (Counted Body)
  22. Covariant Return Types TODO
  23. Curiously Recurring Template Pattern (CRTP)
  24. Non-intrusive reference counting (Detached Counted Body) TODO
  25. Empty Base Optimization (EBO)
  26. enable-if
  27. Envelope Letter TODO
  28. Erase-Remove
  29. Execute-Around Pointer
  30. Exploding Return Type TODO
  31. Export Guard Macro TODO
  32. Expression-template
  33. Fake Vtable TODO
  34. Fast Pimpl TODO
  35. Final Class
  36. Free Function Allocators
  37. Function Object TODO
  38. Generic Container Idioms
  39. Hierarchy Generation TODO
  40. Include Guard Macro
  41. Inline Guard Macro
  42. Inner Class
  43. Int-To-Type
  44. Interface Class
  45. Iterator Pair
  46. Making New Friends
  47. Metafunction
  48. Move Constructor
  49. Multi-statement Macro
  50. Member Detector
  51. Named Constructor
  52. Named External Argument TODO
  53. Named Loop (labeled loop)
  54. Named Parameter
  55. Named Template Parameters TODO
  56. Nifty Counter (Schwarz Counter)
  57. Non-copyable Mixin
  58. Non-member Non-friend Function TODO
  59. Non-throwing swap
  60. Non-Virtual Interface (NVI, Public Overloaded Non-Virtuals Call Protected Non-Overloaded Virtuals)
  61. nullptr
  62. Object Generator
  63. Object Template TODO
  64. Parameterized Base Class (Parameterized Inheritance)
  65. Pimpl (Handle Body, Compilation Firewall, Cheshire Cat)
  66. Policy Clone (Metafunction wrapper)
  67. Policy-based Design TODO
  68. Polymorphic Exception
  69. Polymorphic Value Types TODO
  70. Recursive Type Composition TODO
  71. Requiring or Prohibiting Heap-based Objects
  72. Resource Acquisition Is Initialization (RAII, Execute-Around Object, Scoped Locking)
  73. Resource Return
  74. Return Type Resolver
  75. Runtime Static Initialization Order Idioms
  76. Safe bool
  77. Scope Guard
  78. Substitution Failure Is Not An Error (SFINAE)
  79. Shortening Long Template Names TODO
  80. Shrink-to-fit
  81. Small Object Optimization TODO
  82. Smart Pointer
  83. Storage Class Tracker TODO
  84. Tag Dispatching TODO
  85. Temporary Base Class
  86. Temporary Proxy
  87. The result_of technique TODO
  88. Thin Template
  89. Traits TODO
  90. Type Erasure TODO
  91. Type Generator (Templated Typedef)
  92. Type Safe Enum
  93. Type Selection
  94. Virtual Constructor
  95. Virtual Friend Function
时间: 2024-08-09 06:35:30

More C++ Idioms的相关文章

关于Fruits的那些Idioms

关于Fruits的那些Idioms 1. Banana(香蕉).      Go bananas 发疯:发狂大家一定被梅西的进球震住了吧,你就变非常激动甚至疯狂了,就是I go bananas. 口语中经常使用,例如,All the fans went bananas when Messi scored a goal. 当梅西进球的时候所有的球迷都为之疯狂了. 发疯,发狂同样也可以用go nuts 或者go crazy来表达.2. Grape(葡萄).sour grapes  嫉妒,酸葡萄心理.

[OOD-More C++ Idioms] 写时拷贝 (Copy on Write)

目的 达到延迟拷贝(lazy copy)的优化目的.和延迟初始化(lazy initialization)相似, 选择在恰当的时机更加有效. 别名 COW (copy-on-write) Lazy copy 动机 拷贝对象有时会带来性能损失(performance penalty).如果对象经常拷来拷去,但以很少修改,copy-on-write就能明显地提升性能.为了实现copy-on-write, 需要使用一个智能指针将真正的对象值封装起来,每次修改时都要检查一下对象的引用计数.如果对象被多次

[OOD-More C++ Idioms] 内部类 (Inner Class)

内部类 (Inner Class) 目的 不用通过多重继承就可以实现多套接口,同时可以自然地向上转换(Up-casting). 在单个抽象下提供相同接口的多个实现. 别名 动机 两个独立类库通过不同的接口提供的虚函数签名可能冲突,如果这时需要同时实现这两个函数就会出现问题.示例如下: class Base1 /// 来自月球 { public: virtual int open (int) = 0; /* virtual */ ~Base1() {} // 不允许多态的析构函数 }; class

Usage and Idioms——Theories

为什么要引用理论机制(Theory) 当今软件开发中,测试驱动开发(TDD - Test-driven development)越发流行.为什么 TDD 会如此流行呢?因为它确实拥有很多优点,它允许开发人员通过简单的例子来指定和表明他们代码的行为意图. TDD 的优点: 使得开发人员对即将编写的软件任务具有更清晰的认识,使得他们在思考如何编写代码之前先仔细思考如何设计软件. 对测试开发人员所实现的代码提供了快速和自动化的支持. 提供了一系列可以重用的回归测试用例(regression test

Usage and Idioms——Matchers and assertthat

assertThat 一种插入机制,语法如下: assertThat([value], [matcher statement]); 例如: assertThat(x, is(3)); assertThat(x, is(not(4))); assertThat(responseString, either(containsString("color")).or(containsString("colour"))); assertThat(myList, hasItem

English idioms

a hot potato : speak of an issue(mostly current) which many people are talking about and which is usually siaputed. add insult to injury : to further a loss with mockery or indignity; to worsen an unfavorable situation. at the drop of a hat : without

开源介绍:Google Guava、Google Guice、Joda-Time

一.Guava 是一个 Google 的基于java1.6的类库集合的扩展项目,包括 collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, 等等. 这些高质量的 API 可以使你的JAVa代码更加优雅,更加简洁,让你工作更加轻松愉悦.下面我们就开启优雅Java编程学习之旅! 项目相关信息: 官方首页:http://code.googl

[转载]那些C++牛人的博客

现整理收集C++世界里那些“牛人”的个人博客.凡三类:一是令人高山仰止的大牛,对C++语言本身产生过深远的影响的人:二是C++运用炉火纯青的高手,有原创性的技术干货:三是中文世界里的C++牛人. C++大牛的博客 Bjarne Stroustrup的博客: Bjarne Stroustrup’s Homepage Bjarne Stroustrup,不认识的可以去面壁了,没有他,就没有我们现在的饭碗.Bjarne Stroustrup是丹麦人,目前任教于TAMU.他的Homepage和他的书籍T

智能指针tr1::shared_ptr、boost::shared_ptr使用

对于tr1::shared_ptr在安装vs同时会自带安装,但是版本较低的不存在.而boost作为tr1的实现品,包含 "Algorithms Broken Compiler Workarounds Concurrent Programming Containers Correctness and Testing Data Structures Domain Specific Function Objects and Higher-order Programming Generic Progra