Modern C++ Design 原版完整文件.docx
《Modern C++ Design 原版完整文件.docx》由会员分享,可在线阅读,更多相关《Modern C++ Design 原版完整文件.docx(285页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Table of ContentsModern C+ Design: Generic Programming and Design Patterns AppliedBy Andrei AlexandrescuPublisher : Addison Wesley Pub Date : February 01, 2001ISBN : 0-201-70431-5Pages : 352Modern C+ Design is an important book. Fundamentally, it demonstrates generic patterns or pattern templates as
2、 a powerful new way of creating extensible designs in C+-a new way to combine templates and patterns that you may never have dreamt was possible, but is. If your work involves C+ design and coding, you should read this book. Highly recommended.-Herb SutterWhats left to say about C+ that hasnt alread
3、y been said? Plenty, it turns out.-From the Foreword by John VlissidesIn Modern C+ Design, Andrei Alexandrescu opens new vistas for C+ programmers. Displaying extraordinary creativity and programming virtuosity, Alexandrescu offers a cutting-edge approach to design that unites design patterns, gener
4、ic programming, and C+, enabling programmers to achieve expressive, flexible, and highly reusable code.This book introduces the concept of generic components-reusable design templates that produce boilerplate code for compiler consumption-all within C+. Generic components enable an easier and more s
5、eamless transition from design to application code, generate code that better expresses the original design intention, and support the reuse of design structures with minimal recoding.The author describes the specific C+ techniques and features that are used in building generic components and goes o
6、n to implement industrial strength generic components for real-world applications. Recurring issues that C+ developers face in their day-to-day activity are discussed in depth and implemented in a generic way. These include: Policy-based design for flexibility Partial template specialization Typelis
7、ts-powerful type manipulation structures Patterns such as Visitor, Singleton, Command, and Factories Multi-method enginesFor each generic component, the book presents the fundamental problems and design options, and finally implements a generic solution.In addition, an accompanying Web site, makes t
8、he code implementations available for the generic components in the book and provides a free, downloadable C+ library, called Loki, created by the author. Loki provides out-of-the-box functionality for virtually any C+ project.Team-FlyTable of ContentxTable of ContentiCopyrightviForewordviiForewordi
9、xPrefacexAudiencexiLokixiOrganizationxiiAcknowledgmentsxiiiPart I: Techniques1Chapter 1. Policy-Based Class Design21.1 The Multiplicity of Software Design21.2 The Failure of the Do-It-All Interface31.3 Multiple Inheritance to the Rescue?41.4 The Benefit of Templates51.5 Policies and Policy Classes61
10、.6 Enriched Policies91.7 Destructors of Policy Classes101.8 Optional Functionality Through Incomplete Instantiation111.9 Combining Policy Classes121.10 Customizing Structure with Policy Classes131.11 Compatible and Incompatible Policies141.12 Decomposing a Class into Policies161.13 Summary17Chapter
11、2. Techniques192.1 Compile-Time Assertions192.2 Partial Template Specialization222.3 Local Classes232.4 Mapping Integral Constants to Types242.5 Type-to-Type Mapping262.6 Type Selection282.7 Detecting Convertibility and Inheritance at Compile Time292.8 A Wrapper Around type_info322.9 NullType and Em
12、ptyType342.10 Type Traits342.11 Summary40Chapter 3. Typelists423.1 The Need for Typelists423.2 Defining Typelists433.3 Linearizing Typelist Creation453.4 Calculating Length453.5 Intermezzo463.6 Indexed Access473.7 Searching Typelists483.8 Appending to Typelists493.9 Erasing a Type from a Typelist503
13、.10 Erasing Duplicates513.11 Replacing an Element in a Typelist523.12 Partially Ordering Typelists533.13 Class Generation with Typelists563.14 Summary653.15 Typelist Quick Facts66Chapter 4. Small-Object Allocation684.1 The Default Free Store Allocator684.2 The Workings of a Memory Allocator694.3 A S
14、mall-Object Allocator704.4 Chunks714.5 The Fixed-Size Allocator744.6 The SmallObjAllocator Class774.7 A Hat Trick794.8 Simple, Complicated, Yet Simple in the End814.9 Administrivia824.10 Summary834.11 Small-Object Allocator Quick Facts83Part II: Components85Chapter 5. Generalized Functors865.1 The C
15、ommand Design Pattern865.2 Command in the Real World895.3 C+ Callable Entities895.4 The Functor Class Template Skeleton915.5 Implementing the Forwarding Functor:operator()955.6 Handling Functors965.7 Build One, Get One Free985.8 Argument and Return Type Conversions995.9 Handling Pointers to Member F
16、unctions1015.10 Binding1045.11 Chaining Requests1065.12 Real-World Issues I: The Cost of Forwarding Functions1075.13 Real-World Issues II: Heap Allocation1085.14 Implementing Undo and Redo with Functor1105.15 Summary1105.16 Functor Quick Facts111Chapter 6. Implementing Singletons1136.1 Static Data +
17、 Static Functions != Singleton1136.2 The Basic C+ Idioms Supporting Singletons1146.3 Enforcing the Singletons Uniqueness1166.4 Destroying the Singleton1166.5 The Dead Reference Problem1186.6 Addressing the Dead Reference Problem (I): The Phoenix Singleton1206.7 Addressing the Dead Reference Problem
18、(II): Singletons with Longevity1226.8 Implementing Singletons with Longevity1256.9 Living in a Multithreaded World1286.10 Putting It All Together1306.11 Working with SingletonHolder1346.12 Summary1366.13 SingletonHolder Class Template Quick Facts136Chapter 7. Smart Pointers1387.1 Smart Pointers 1011
19、387.2 The Deal1397.3 Storage of Smart Pointers1407.4 Smart Pointer Member Functions1427.5 Ownership-Handling Strategies1437.6 The Address-of Operator1507.7 Implicit Conversion to Raw Pointer Types1517.8 Equality and Inequality1537.9 Ordering Comparisons1577.10 Checking and Error Reporting1597.11 Sma
20、rt Pointers to const and const Smart Pointers1617.12 Arrays1617.13 Smart Pointers and Multithreading1627.14 Putting It All Together1657.15 Summary1717.16 SmartPtr Quick Facts171Chapter 8. Object Factories1738.1 The Need for Object Factories1748.2 Object Factories in C+: Classes and Objects1758.3 Imp
21、lementing an Object Factory1768.4 Type Identifiers1808.5 Generalization1818.6 Minutiae1848.7 Clone Factories1858.8 Using Object Factories with Other Generic Components1888.9 Summary1898.10 Factory Class Template Quick Facts1898.11 CloneFactory Class Template Quick Facts190Chapter 9. Abstract Factory
22、1919.1 The Architectural Role of Abstract Factory1919.2 A Generic Abstract Factory Interface1939.3 Implementing AbstractFactory1969.4 A Prototype-Based Abstract Factory Implementation1999.5 Summary2029.6 AbstractFactory and ConcreteFactory Quick Facts203Chapter 10. Visitor20510.1 Visitor Basics20510
23、.2 Overloading and the Catch-All Function21010.3 An Implementation Refinement: The Acyclic Visitor21110.4 A Generic Implementation of Visitor21510.5 Back to the Cyclic Visitor22110.6 Hooking Variations22310.7 Summary22610.8 Visitor Generic Components Quick Facts226Chapter 11. Multimethods22811.1 Wha
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Modern C+ Design 原版完整文件 原版 完整 文件
限制150内