Item Details

Modern C++ Design: Generic Programming and Design Patterns Applied

Andrei Alexandrescu
Format
Book
Published
Boston : Addison-Wesley, c2001.
Language
English
Series
The C++ in Depth Series
ISBN
0201704315
Contents
  • Part I Techniques 1
  • Chapter 1 Policy-Based Class Design 3
  • 1.1 Multiplicity of Software Design 3
  • 1.2 Failure of the Do-It-All Interface 4
  • 1.3 Multiple Inheritance to the Rescue? 5
  • 1.4 Benefit of Templates 6
  • 1.5 Policies and Policy Classes 7
  • 1.6 Enriched Policies 12
  • 1.7 Destructors of Policy Classes 12
  • 1.8 Optional Functionality Through Incomplete Instantiation 13
  • 1.9 Combining Policy Classes 14
  • 1.10 Customizing Structure with Policy Classes 16
  • 1.11 Compatible and Incompatible Policies 17
  • 1.12 Decomposing a Class into Policies 19
  • Chapter 2 Techniques 23
  • 2.1 Compile-Time Assertions 23
  • 2.2 Partial Template Specialization 26
  • 2.3 Local Classes 28
  • 2.4 Mapping Integral Constants to Types 29
  • 2.5 Type-to-Type Mapping 31
  • 2.6 Type Selection 33
  • 2.7 Detecting Convertibility and Inheritance at Compile Time 34
  • 2.8 A Wrapper Around type_info 37
  • 2.9 NullType and EmptyType 39
  • 2.10 Type Traits 40
  • Chapter 3 Typelists 49
  • 3.1 Need for Typelists 49
  • 3.2 Defining Typelists 51
  • 3.3 Linearizing Typelist Creation 52
  • 3.4 Calculating Length 53
  • 3.5 Intermezzo 54
  • 3.6 Indexed Access 55
  • 3.7 Searching Typelists 56
  • 3.8 Appending to Typelists 57
  • 3.9 Erasing a Type from a Typelist 58
  • 3.10 Erasing Duplicates 59
  • 3.11 Replacing an Element in a Typelist 60
  • 3.12 Partially Ordering Typelists 61
  • 3.13 Class Generation with Typelists 64
  • 3.15 Type list Quick Facts 75
  • Chapter 4 Small-Object Allocation 77
  • 4.1 Default Free Store Allocator 78
  • 4.2 Workings of a Memory Allocator 78
  • 4.3 A Small-Object Allocator 80
  • 4.4 Chunks 81
  • 4.5 Fixed-Size Allocator 84
  • 4.6 SmallObjAllocator Class 87
  • 4.7 A Hat Trick 89
  • 4.8 Simple, Complicated, Yet Simple in the End 92
  • 4.9 Administrivia 93
  • 4.11 Small-Object Allocator Quick Facts 94
  • Part II Components 97
  • Chapter 5 Generalized Functors 99
  • 5.1 Command Design Pattern 100
  • 5.2 Command in the Real World 102
  • 5.3 C++ Callable Entities 103
  • 5.4 Functor Class Template Skeleton 104
  • 5.5 Implementing the Forwarding Functor:: operator () 108
  • 5.6 Handling Functors 110
  • 5.7 Build One, Get One Free 112
  • 5.8 Argument and Return Type Conversions 114
  • 5.9 Handling Pointers to Member Functions 115
  • 5.10 Binding 119
  • 5.11 Chaining Requests 122
  • 5.12 Real-World Issues I: The Cost of Forwarding Functions 122
  • 5.13 Real-World Issues II: Heap Allocation 124
  • 5.14 Implementing Undo and Redo with Functor 125
  • 5.16 Functor Quick Facts 126
  • Chapter 6 Implementing Singletons 129
  • 6.1 Static Data + Static Functions != Singleton 130
  • 6.2 Basic C++ Idioms Supporting Singleton 131
  • 6.3 Enforcing the Singleton's Uniqueness 132
  • 6.4 Destroying the Singleton 133
  • 6.5 Dead Reference Problem 135
  • 6.6 Addressing the Dead Reference Problem (I): The Phoenix Singleton 137
  • 6.7 Addressing the Dead Reference Problem (II): Singletons with Longevity 139
  • 6.8 Implementing Singletons with Longevity 142
  • 6.9 Living in a Multithreaded World 145
  • 6.10 Putting It All Together 148
  • 6.11 Working with Singleton Holder 153
  • 6.13 Singleton Holder Class Template Quick Facts 155
  • Chapter 7 Smart Pointers 157
  • 7.1 Smart Pointers 101 157
  • 7.2 Deal 158
  • 7.3 Storage of Smart Pointers 160
  • 7.4 Smart Pointer Member Functions 161
  • 7.5 Ownership-Handling Strategies 163
  • 7.6 Address-of Operator 170
  • 7.7 Implicit Conversion to Raw Pointer Types 171
  • 7.8 Equality and Inequality 173
  • 7.9 Ordering Comparisons 178
  • 7.10 Checking and Error Reporting 181
  • 7.11 Smart Pointers to const and const Smart Pointers 182
  • 7.12 Arrays 183
  • 7.13 Smart Pointers and Multithreading 184
  • 7.14 Putting It Alla Together 187
  • 7.16 SmartPtr Quick Facts 194
  • Chapter 8 Object Factories 197
  • 8.1 Need for Object Factories 198
  • 8.2 Object Factories in C++: Classes and Objects 200
  • 8.3 Implementing an Object Factory 201
  • 8.4 Type Identifiers 206
  • 8.5 Generalization 207
  • 8.6 Minutiae 210
  • 8.7 Clone Factories 211
  • 8.8 Using Object Factories with Other Generic Components 215
  • 8.10 Factory Class Template Quick Facts 216
  • 8.11 CloneFactory Class Template Quick Facts 217
  • Chapter 9 Abstract Factory 219
  • 9.1 Architectural Role of Abstract Factory 219
  • 9.2 A Generic Abstract Factory Interface 223
  • 9.3 Implementing AbstractFactory 226
  • 9.4 A Prototype-Based Abstract Factory Implementation 228
  • 9.6 AbstractFactory and ConcreteFactory Quick Facts 233
  • Chapter 10 Visitor 235
  • 10.1 Visitor Basics 235
  • 10.2 Overloading and the Catch-All Function 242
  • 10.3 An Implementation Refinement: The Acyclic Visitor 243
  • 10.4 A Generic Implementation of Visitor 248
  • 10.5 Back to the "Cyclic" Visitor 255
  • 10.6 Hooking Variations 258
  • 10.8 Visitor Generic Component Quick Facts 261
  • Chapter 11 Multimethods 263
  • 11.1 What Are Multimethods? 264
  • 11.2 When Are Multimethods Needed? 264
  • 11.3 Double Switch-on-Type: Brute Force 265
  • 11.4 Brute-Force Approach Automated 268
  • 11.5 Symmetry with the Brute-Force Dispatcher 273
  • 11.6 Logarithmic Double Dispatcher 276
  • 11.7 FnDispatcher and Symmetry 282
  • 11.8 Double Dispatch to Functors 282
  • 11.9 Converting Arguments: static_cast or dynamic_cast? 285
  • 11.10 Constant-Time Multimethods: Raw Speed 290
  • 11.11 BasicDispatcher and BasicFastDispatcher as Policies 293
  • 11.12 Looking Forward 294
  • Appendix A Minimalist Multithreading Library 301
  • A.1 A Critique of Multithreading 302
  • A.2 Loki's Approach 303
  • A.3 Atomic Operations on Integral Types 303
  • A.4 Mutexes 305
  • A.5 Locking Semantics in Object-Oriented Programming 306
  • A.6 Optional volatile Modifier 308
  • A.7 Semaphores, Events, and Other Good Things 309.
Description
xxii, 323 p. ; 24 cm.
Notes
Includes bibliographical references (p. 311-312) and index.
Technical Details
  • Access in Virgo Classic

  • LEADER 07213pam a22003374a 4500
    001 u3709052
    003 SIRSI
    005 20010327110258.0
    008 000928s2001 mau b 001 0 eng
    010
      
      
    a| 00049596
    020
      
      
    a| 0201704315
    035
      
      
    a| (Sirsi) i0201704315
    035
      
      
    a| (OCoLC)45129236
    040
      
      
    a| DLC c| DLC d| NhCcYBP d| MvI
    042
      
      
    a| pcc
    050
    0
    0
    a| QA76.73.C153 b| A42 2001
    082
    0
    0
    a| 005.13/3 2| 21
    090
      
      
    a| SCIENG/QA76.73.C153 b| A42 2001
    100
    1
      
    a| Alexandrescu, Andrei.
    245
    1
    0
    a| Modern C++ design : b| generic programming and design patterns applied / c| Andrei Alexandrescu.
    260
      
      
    a| Boston : b| Addison-Wesley, c| c2001.
    300
      
      
    a| xxii, 323 p. ; c| 24 cm.
    440
      
    4
    a| The C++ in depth series
    504
      
      
    a| Includes bibliographical references (p. 311-312) and index.
    505
    0
    0
    g| Part I t| Techniques g| 1 -- g| Chapter 1 t| Policy-Based Class Design g| 3 -- g| 1.1 t| Multiplicity of Software Design g| 3 -- g| 1.2 t| Failure of the Do-It-All Interface g| 4 -- g| 1.3 t| Multiple Inheritance to the Rescue? g| 5 -- g| 1.4 t| Benefit of Templates g| 6 -- g| 1.5 t| Policies and Policy Classes g| 7 -- g| 1.6 t| Enriched Policies g| 12 -- g| 1.7 t| Destructors of Policy Classes g| 12 -- g| 1.8 t| Optional Functionality Through Incomplete Instantiation g| 13 -- g| 1.9 t| Combining Policy Classes g| 14 -- g| 1.10 t| Customizing Structure with Policy Classes g| 16 -- g| 1.11 t| Compatible and Incompatible Policies g| 17 -- g| 1.12 t| Decomposing a Class into Policies g| 19 -- g| Chapter 2 t| Techniques g| 23 -- g| 2.1 t| Compile-Time Assertions g| 23 -- g| 2.2 t| Partial Template Specialization g| 26 -- g| 2.3 t| Local Classes g| 28 -- g| 2.4 t| Mapping Integral Constants to Types g| 29 -- g| 2.5 t| Type-to-Type Mapping g| 31 -- g| 2.6 t| Type Selection g| 33 -- g| 2.7 t| Detecting Convertibility and Inheritance at Compile Time g| 34 -- g| 2.8 t| A Wrapper Around type_info g| 37 -- g| 2.9 t| NullType and EmptyType g| 39 -- g| 2.10 t| Type Traits g| 40 -- g| Chapter 3 t| Typelists g| 49 -- g| 3.1 t| Need for Typelists g| 49 -- g| 3.2 t| Defining Typelists g| 51 -- g| 3.3 t| Linearizing Typelist Creation g| 52 -- g| 3.4 t| Calculating Length g| 53 -- g| 3.5 t| Intermezzo g| 54 -- g| 3.6 t| Indexed Access g| 55 -- g| 3.7 t| Searching Typelists g| 56 -- g| 3.8 t| Appending to Typelists g| 57 -- g| 3.9 t| Erasing a Type from a Typelist g| 58 -- g| 3.10 t| Erasing Duplicates g| 59 -- g| 3.11 t| Replacing an Element in a Typelist g| 60 -- g| 3.12 t| Partially Ordering Typelists g| 61 -- g| 3.13 t| Class Generation with Typelists g| 64 -- g| 3.15 t| Type list Quick Facts g| 75 -- g| Chapter 4 t| Small-Object Allocation g| 77 -- g| 4.1 t| Default Free Store Allocator g| 78 -- g| 4.2 t| Workings of a Memory Allocator g| 78 -- g| 4.3 t| A Small-Object Allocator g| 80 -- g| 4.4 t| Chunks g| 81 -- g| 4.5 t| Fixed-Size Allocator g| 84 -- g| 4.6 t| SmallObjAllocator Class g| 87 -- g| 4.7 t| A Hat Trick g| 89 -- g| 4.8 t| Simple, Complicated, Yet Simple in the End g| 92 -- g| 4.9 t| Administrivia g| 93 -- g| 4.11 t| Small-Object Allocator Quick Facts g| 94 -- g| Part II t| Components g| 97 -- g| Chapter 5 t| Generalized Functors g| 99 -- g| 5.1 t| Command Design Pattern g| 100 -- g| 5.2 t| Command in the Real World g| 102 -- g| 5.3 t| C++ Callable Entities g| 103 -- g| 5.4 t| Functor Class Template Skeleton g| 104 -- g| 5.5 t| Implementing the Forwarding Functor:: operator () g| 108 -- g| 5.6 t| Handling Functors g| 110 -- g| 5.7 t| Build One, Get One Free g| 112 -- g| 5.8 t| Argument and Return Type Conversions g| 114 -- g| 5.9 t| Handling Pointers to Member Functions g| 115 -- g| 5.10 t| Binding g| 119 -- g| 5.11 t| Chaining Requests g| 122 -- g| 5.12 t| Real-World Issues I: The Cost of Forwarding Functions g| 122 -- g| 5.13 t| Real-World Issues II: Heap Allocation g| 124 -- g| 5.14 t| Implementing Undo and Redo with Functor g| 125 -- g| 5.16 t| Functor Quick Facts g| 126 -- g| Chapter 6 t| Implementing Singletons g| 129 -- g| 6.1 t| Static Data + Static Functions != Singleton g| 130 -- g| 6.2 t| Basic C++ Idioms Supporting Singleton g| 131 -- g| 6.3 t| Enforcing the Singleton's Uniqueness g| 132 -- g| 6.4 t| Destroying the Singleton g| 133 -- g| 6.5 t| Dead Reference Problem g| 135 -- g| 6.6 t| Addressing the Dead Reference Problem (I): The Phoenix Singleton g| 137 -- g| 6.7 t| Addressing the Dead Reference Problem (II): Singletons with Longevity g| 139 -- g| 6.8 t| Implementing Singletons with Longevity g| 142 -- g| 6.9 t| Living in a Multithreaded World g| 145 -- g| 6.10 t| Putting It All Together g| 148 -- g| 6.11 t| Working with Singleton Holder g| 153 -- g| 6.13 t| Singleton Holder Class Template Quick Facts g| 155 -- g| Chapter 7 t| Smart Pointers g| 157 -- g| 7.1 t| Smart Pointers 101 g| 157 -- g| 7.2 t| Deal g| 158 -- g| 7.3 t| Storage of Smart Pointers g| 160 -- g| 7.4 t| Smart Pointer Member Functions g| 161 -- g| 7.5 t| Ownership-Handling Strategies g| 163 -- g| 7.6 t| Address-of Operator g| 170 -- g| 7.7 t| Implicit Conversion to Raw Pointer Types g| 171 -- g| 7.8 t| Equality and Inequality g| 173 -- g| 7.9 t| Ordering Comparisons g| 178 -- g| 7.10 t| Checking and Error Reporting g| 181 -- g| 7.11 t| Smart Pointers to const and const Smart Pointers g| 182 -- g| 7.12 t| Arrays g| 183 -- g| 7.13 t| Smart Pointers and Multithreading g| 184 -- g| 7.14 t| Putting It Alla Together g| 187 -- g| 7.16 t| SmartPtr Quick Facts g| 194 -- g| Chapter 8 t| Object Factories g| 197 -- g| 8.1 t| Need for Object Factories g| 198 -- g| 8.2 t| Object Factories in C++: Classes and Objects g| 200 -- g| 8.3 t| Implementing an Object Factory g| 201 -- g| 8.4 t| Type Identifiers g| 206 -- g| 8.5 t| Generalization g| 207 -- g| 8.6 t| Minutiae g| 210 -- g| 8.7 t| Clone Factories g| 211 -- g| 8.8 t| Using Object Factories with Other Generic Components g| 215 -- g| 8.10 t| Factory Class Template Quick Facts g| 216 -- g| 8.11 t| CloneFactory Class Template Quick Facts g| 217 -- g| Chapter 9 t| Abstract Factory g| 219 -- g| 9.1 t| Architectural Role of Abstract Factory g| 219 -- g| 9.2 t| A Generic Abstract Factory Interface g| 223 -- g| 9.3 t| Implementing AbstractFactory g| 226 -- g| 9.4 t| A Prototype-Based Abstract Factory Implementation g| 228 -- g| 9.6 t| AbstractFactory and ConcreteFactory Quick Facts g| 233 -- g| Chapter 10 t| Visitor g| 235 -- g| 10.1 t| Visitor Basics g| 235 -- g| 10.2 t| Overloading and the Catch-All Function g| 242 -- g| 10.3 t| An Implementation Refinement: The Acyclic Visitor g| 243 -- g| 10.4 t| A Generic Implementation of Visitor g| 248 -- g| 10.5 t| Back to the "Cyclic" Visitor g| 255 -- g| 10.6 t| Hooking Variations g| 258 -- g| 10.8 t| Visitor Generic Component Quick Facts g| 261 -- g| Chapter 11 t| Multimethods g| 263 -- g| 11.1 t| What Are Multimethods? g| 264 -- g| 11.2 t| When Are Multimethods Needed? g| 264 -- g| 11.3 t| Double Switch-on-Type: Brute Force g| 265 -- g| 11.4 t| Brute-Force Approach Automated g| 268 -- g| 11.5 t| Symmetry with the Brute-Force Dispatcher g| 273 -- g| 11.6 t| Logarithmic Double Dispatcher g| 276 -- g| 11.7 t| FnDispatcher and Symmetry g| 282 -- g| 11.8 t| Double Dispatch to Functors g| 282 -- g| 11.9 t| Converting Arguments: static_cast or dynamic_cast? g| 285 -- g| 11.10 t| Constant-Time Multimethods: Raw Speed g| 290 -- g| 11.11 t| BasicDispatcher and BasicFastDispatcher as Policies g| 293 -- g| 11.12 t| Looking Forward g| 294 -- g| Appendix t| A Minimalist Multithreading Library g| 301 -- g| A.1 t| A Critique of Multithreading g| 302 -- g| A.2 t| Loki's Approach g| 303 -- g| A.3 t| Atomic Operations on Integral Types g| 303 -- g| A.4 t| Mutexes g| 305 -- g| A.5 t| Locking Semantics in Object-Oriented Programming g| 306 -- g| A.6 t| Optional volatile Modifier g| 308 -- g| A.7 t| Semaphores, Events, and Other Good Things g| 309.
    596
      
      
    a| 5
    650
      
    0
    a| C++ (Computer program language)
    650
      
    0
    a| Generic programming (Computer science)
    999
      
      
    a| QA76.73 .C153 A42 2001 w| LC i| X004527133 l| STACKS m| SCI-ENG t| BOOK

Availability

Google Preview

Library Location Map Availability Call Number
Brown Science and Engineering Stacks N/A Available