您好,欢迎光临本网站![请登录][注册会员]  
文件名称: more cppidioms
  所属分类: C++
  开发工具:
  文件大小: 2mb
  下载次数: 0
  上传时间: 2019-03-23
  提 供 者: bei***
 详细说明:more cppidioms c++ 经典写法。Contents 0.1 Preface 0.2 Authors 0.3 Praise of the book 0.4 Table of Contents 1 Address of 112279 2 Algebraic Hierarchy 3 Attach by Initialization 15 4 Attorney-Client 5 Barton-Nackman trick 21 6 Base-from-Member 25 7 Boost mutant 29 8 Calling virtuals During Initialization 31 9 Capability Query 35 10 Checked delete 37 11 Clear-and-minimize 41 12 Coercion by Member Template 43 13 Computational Constructor 47 14 Concrete Data Type 51 15 Const auto ptr 53 1 6 Construct On first Use 55 1 7 Construction Tracker 57 18 Copy-and-swap 59 19 Copy-on-write 63 20 Counted Body/Reference Counting(intrusive 67 III Contents 21 Curiously Recurring Template Pattern 71 22 Empty Base Optimization 23 enable-if 77 24 Erase-Remove 81 25 Execute-Around pointer 83 26 Exploding Return Type 87 27 Expression Template 9 27.1 Intent 93 27.2 Also Known as 93 27.3 Motivation 93 27.4 Solulion and sample code 93 27.5K 27.6 Rclated id 3 27.7 Rele 93 27.8 Intent 93 27.9 Also Known as 93 27.10 Motivatic 93 27.11 Solution and Sample code 93 27.12 Known uses 93 27.13 Related idioms 93 27.14 References 94 28 Final Class 95 29 Free function allocators 97 30 Attorney-Client 99 31 Generic Container idioms l03 32 Include guard macro 107 33 Inline guard macro 109 34 Inner Class 111 35 Int-To-Type 115 36 Interface Class 37 Iterator pair 123 38 Making New friends 127 39 Metafunction 129 Contents 40 Move Constructor 133 41 Multi-statement macro 141 42 Member detector 143 43 Named Constructor 151 44 Named Loop 153 45 Named parameter 155 46 Nifty Counter 157 47 Non-copyable mixin 161 48 Non-throwing swap 165 49 Non- Virtual Interface 169 50 nullity 173 51 Object Generator 177 51.1 Intent 179 51. 2 Also Known as 51.3 Motivati l79 51.4 Solution and Sample code 51.6 Related Idioms 51.7 Rcfcrcnccs ,179 51.8 Intent 51.9 Also Known as 179 51.10Mot 51.11 Solulion alld Sample Code 51.12 Known Uses 51.13 Related idioms 179 51.11 References 179 52 Parameterized base class 181 53 Policy Clone 183 54 Polymorphic Exception 187 55 Polymorphic Value Types 191 56 Recursive Type Composition 193 57 Requiring or Prohibiting Heap-based objects 195 58 Resource Acquisition Is Initialization 197 Contents 59 Resource return 201 60 Return Type resolver 203 61 Runtime static initialization order idioms 205 62 Safe bool 207 63 Scope guard 213 64 SINAE 215 65 Shrink-to-fit 219 66 Smart pointer 221 66.1 Intent 66.2 Also Known as 221 66.3 Motivat 224 66.4 Solution and Sample code 224 66.5 Known Uses 66.6 Related idioms 224 66.7 References 224 66.8 Reference 224 67 Temporary Base Class 225 68 Temporary Proxy 233 69 Thin Template 237 69.1 Reference 238 70 Type Erasure 239 70.1 Complctc Implementation 240 71 Type Generator 243 72 Type Safe Enum 247 72.1 References 250 73 Type Selection 251 74 Virtual Constructor 253 75 Virtual friend function 257 76 Contributors 259 List of Figures 265 77 Licenses 77.1 GNU GENERAL PUBLIC LICENSE ⅥI Authors 77.2 GNU Free Documentation License 270 77.3 GNU Lesser General Public License 271 0.1 Preface CII has indeed become too'expcrt fricndly"Bjarne Stroustrup The Prvviern wic Progreweriing, Technology Review, Nu 2000. Strouslrup's ying is true because experts are intimately familia: with the idioms in the language. WilI the increase in Lie idioms a progra uer understands, the u language becomes friendlier to him or her. The objective of tais book is to presert n: odern C++ idioms to programmers who have moder leve Df familiarity with C++, ard help fee.s much friendlier to them. It is designed to be an exhaustive catalog reusable idioms that expert C++ programmers often use while programming or designing nsing C-+. This is an effort to capure their tech: niques and cabulary into a sing e work. ' This bcak deseribes the idioms in a regular format: Nar2e-intent-Motivation-5olution-References, which is succinct and helps speec learring. By their nature, id oms tend to have appeared in the c+- community and in published work many times. An effort hns been made to refer to the original source(s) where posslble: if you find a reference incomplete incorrect, please fecl free to suggcst or make improvemente. The world is invited to catalog reusable pieces Df C++ knowledge (similar to the book on design patterns by CoF). The goal here is to first build an exhaustive catalog An open- content book on Wikibooks.org of Modern C++ idiomS and later evolve it into an iciun language, just like a pattern language. Finally, the contents of this book can be redistributed under ore CI Idioma the Lerus of the GNU Free DucurenLalion Liceuse-Aimed Luward: Anyone with an intermediate level of knowledge in C++ and supported language 0.2 Authors Sumant Tainbe! talk - The initiator and lead contributor since July 2007. See Inly con tributions Many other C lI aficionados who continuously improve the writeup, cxamples, and rcf- erences where necessary 1http://www.technologyreview.com/infotech/17831 2https://en.wikibooks.org/wiki/more920c72b92b%20idiomsY2fgnufdl httpa://en.wikibooks.org/wiki/category%3a 4https://en.wikibooks.org/wiki/usery3asutambe 6http://en.wikibooksorg/wiki/special:Contributions/sutambe 7https://en.wikibooks.org/wiki/category13a 1 Contents 0. 3 Praise of the book .Great and valuable work! -Bjarne Stroustrup(February, 2009) 0. 4 Table of contents Note: synonyms for cach idiom arc listed in parentheses 1, Address of 4. Attorncy-ClicntIe p(2v 2. Algebraic Hierarch 3. Attach by Initialization!I 5. Barton-Nackman trick13 6. Base-from-Member 7. Boost 15 8. Calling Virtuals During Initialization 6 bility que 10. Checked delete 11. Clear-and-min 12. Coercion by Member Template 13. Computational Constructo 11. Concrete Data Type 5. Construct on first Us 16. Construction Tracker2 Copy-and-swap 18. Copy-Onl-wrile26 19. Intrusive reference counting (Counted Bodw)27 ibooks. org/wiki/Category %3A 9 Chapter 0.4.2 on page 6 10 Chapter 1.0.7 on page S 11 Chapter 2.0.7 on pagc 13 12 Chapter 29.0 n page 98 13 Chapter 4.0.6 e19 14 Chapter 5.0.7 on page 23 15 Chapter 6.0.7 on pagc 27 16 Chapter 7.0.7 on page 30 17 Chapter 8.0.6 18 Chapter 9.0.7 on page 36 19 Chapter 10.0 39 20 Chapter 11.0.8 on pagc 42 21 Chapter 12.0. 8 on page 45 22 Chapter 13.0. 8 on page 50 23 Chapter 15.0. 8 on page 54 24 Chapter 16.0.7 on page 56 5 Chapter 17.0.7 on pagc 58 26 Chapter 18.0.7 on page 61 27 Chapter 19.0.7 on page 65 Tablc of content Covariant Return Types"s TODO 21. Curiously Recurring Template Pattern(CRTP) 22. Empty Base Optimization(EBO) 23. enable-ifs1 24.E 25.E -Around pointer 33 26. Exploding Return Typed TODO 27. Export Guard Macro TODO 28.E ll-leinplale 29.akeⅤ table37TODO 30. Fast Pimple TOdo 31. Final classis 32. Free Function Allocators 40 33. Function Object TODO 31. Generic Container Idioms 2 35. IIierarchv Generation TODO 36. Include guard macro 14 37. Inline Guard Macro15 38. Inner Class 46 39. Int-To-TyI 40. Interface Class 41. Iterator Pair49 42. Making New Friends50 13. Metafunction 44. Move Constructor https://en.wikibooks.org/wiki/more%20c%2b%2b720idiomS72fcovariant%2oreturn%20Types 29 Chapter 20.0.8 on page 70 30 Chapter 21.0.7 on page 72 apter 22.0. 7 on page 75 32 Chapter 23.0.8 on page 79 33 Chapter 24.0.7 on page 82 34 Chapter 25.0. 7 on page 86 35httpa://en.wikibooks.org/wiki/more720c%2b%2b720idioms72fexport%20guard%2omacro 36 Chaptcr 26.0.7 on page 87 37 Chapter 27.0.7 on page 92 38 Chapter 27.7 on page 93 39 Chapter 27 14 on page 94 40 Chaptcr 28.0.8 on page 9 11https://en.wikibooksorg/wiki/more720c%2b%2b720idioms72ffunction7200bject 42 Chapter 30.0.6 43https://en.wikibooks.org/wiki/more720c72b%2b%20idioms72fhierarchy%20generatioN 44 Chapter 31.0.6 on page 106 45 Chaptcr 32.0.7 on page 108 46 Chapter 33.0.6 on page 110 47 Chapter 34.0. 7 on page 113 48 Chapter 35 0.7 on page 117 49 Chapter 36.0.7 on page 121 50 Chapter 37.0.7 on page 125 51 Chapter 38.0.6 on page 128 52 Chapter 39.0.7 on page 131 3 Contents 45. Multi-statement macro53 16. Member Detector54 47. Named Constructor 48. Named External Argumentbb TODO 50. Named parame等 49. Named Loop(labeled loop 51. Named Template Parameters3 TODO 52. Nifty Counter(Schwarz Counter 53. NOll-copyable Mixin 54. Non-member Non-friend Function TODO 55. Non-throwing swap 56. Non-Virtual Interface(NVI, Public Overloaded Nonl- Virtuals Call Protected Non Overloaded Virtuals)64 57. nullptr 58. Object Generator 59. Object Template? TODO 60. Parameterized Base Class(Parameterized Inheritance) 62. Policy Clone (Metafunction wrapper/ all, Cheshire Cat)69 61. Pimpl (Handle Body, Compilation Fire 63. Policy-based Design TODO 64. Polymorphic Exception72 65. Polymorphic Value Types3 TODO 66. Recursive Type Composition TODO 67. Requiring or Prohibiting Heap-based Objects 68. Resource Acquisition Is Initialization(RAIl, Execute-Around Object, Scoped Lock 76 g 53 Chapter 40.0.7 on page 139 54 Chapter 41.0.7 on page 142 55 Chapter 12.0.7 on page 119 56https://en.wikibooks.org/wiki/more720c%2b%2b%20idioms72fnamed720external720argumEnt 57 Chapter 43.0.7 on page 152 58 Chapter 44.0.7 on page 154 59https://en.wikibooks.org/wiki/more720c02b%2b%20idioms72fnamed720template720paramEters 60 Chapter 45.0. 7 on pagc 156 61 Chapter 46.0. oll 159 62https://en.wikibooksorg/wiki/more%20c42b%2b7,20idioms72fnon-member%20non-friend20function 63 Chapter 47.(0.7 on page 163 64 Chapter 48.0. 8 on pagc 168 65 Chapter 19.0. 8 on page 172 66 Chapter.0.8 oll page 176 67 Chapter 51.0.7 on page 178 68 Chapter 51.14 on page 179 69 Chapter 52.0.7 on pagc 182 70 Chapter 52.0.7 on page 182 71https://en.wikibooks 72 Chapter 53.0.7 on page 185 73 Chapter 54.0. 7 on page 190 74 Chapter 55.0.7 on pagc 191 75 Chapter 56.0.7 on page 193 76 Chapter 57.0.7 on page 196 4
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: morecppidioms
 输入关键字,在本站1000多万海量源码库中尽情搜索: