Debbie Lafferty, Andrei Alexandrescu
Modern C++ Design
Generic Programming and Design Patterns Applied
Debbie Lafferty, Andrei Alexandrescu
Modern C++ Design
Generic Programming and Design Patterns Applied
- Broschiertes Buch
- Merkliste
- Auf die Merkliste
- Bewerten Bewerten
- Teilen
- Produkt teilen
- Produkterinnerung
- Produkterinnerung
Demonstrates 'generic patterns' or 'pattern templates' as a way of creating extensible designs in C++. This book introduces the concept of generic components-reusable design templates that produce boilerplate code for compiler consumption, within C++.
Andere Kunden interessierten sich auch für
- Rainer GrimmC++ Core Guidelines Explained: Best Practices for Modern C++28,99 €
- Siddhartha RaoC++ in One Hour a Day, Sams Teach Yourself35,99 €
- John HubbardSchaum's Outline of Programming with C++36,99 €
- Stephen KochanProgramming in C42,99 €
- Klaus IglbergerC++ Software Design66,99 €
- Anthony WilliamsC++ Concurrency in Action63,99 €
- J. DavidsonBeautiful C++39,99 €
-
-
-
Demonstrates 'generic patterns' or 'pattern templates' as a way of creating extensible designs in C++. This book introduces the concept of generic components-reusable design templates that produce boilerplate code for compiler consumption, within C++.
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Hinweis: Dieser Artikel kann nur an eine deutsche Lieferadresse ausgeliefert werden.
Produktdetails
- Produktdetails
- C++ In-Depth Series
- Verlag: Pearson Education
- Seitenzahl: 360
- Erscheinungstermin: 13. Februar 2001
- Englisch
- Abmessung: 236mm x 190mm x 22mm
- Gewicht: 612g
- ISBN-13: 9780201704310
- ISBN-10: 0201704315
- Artikelnr.: 13785583
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
- C++ In-Depth Series
- Verlag: Pearson Education
- Seitenzahl: 360
- Erscheinungstermin: 13. Februar 2001
- Englisch
- Abmessung: 236mm x 190mm x 22mm
- Gewicht: 612g
- ISBN-13: 9780201704310
- ISBN-10: 0201704315
- Artikelnr.: 13785583
- Herstellerkennzeichnung
- Libri GmbH
- Europaallee 1
- 36244 Bad Hersfeld
- 06621 890
Andrei Alexandrescu is the author of the award-winning book Modern C++ Design (Addison-Wesley, 2001) and is a columnist for C/C++ Users Journal.
Foreword by Scott Meyers.
Foreword by John Vlissides.
Preface.
Acknowledgments.
I. TECHNIQUES.
1. Policy-Based Class Design.
The Multiplicity of Software Design.
The Failure of the Do-It-All Interface.
Multiple Inheritance to the Rescue?
Templates Bring Hope.
Policies and Policy Classes.
Enriched Policies.
Destructors of Policy Classes.
Optional Functionality Through Incomplete Instantiation.
Combining Policy Classes.
Customizing Structure with Policy Classes.
Compatible and Noncompatible Policies.
Decomposing a Class in Policies.
Summary.
2. Techniques.
Compile-Time Assertions.
Partial Template Specialization.
Local Classes 28 2.4 Mapping Integral Constants to Types.
Type-to-Type Mapping.
Type Selection.
Detecting Convertibility and Inheritance at Compile Time.
A Wrapper Around type_info.
NullType and EmptyType.
Type Traits.
Summary.
3. Typelists.
The Need for Typelists.
Defining Typelists.
Linearizing Typelist Creation.
Calculating Length.
Intermezzo.
Indexed Access.
Searching Typelists.
Appending to Typelists.
Erasing a Type from a Typelist.
Erasing Duplicates.
Replacing an Element in a Typelist.
Partially Ordering Typelists.
Class Generation with Typelists.
Summary.
Typelist Quick Facts.
4. Small-Object Allocation.
The Default Free Store Allocator.
The Workings of a Memory Allocator.
A Small-Object Allocator.
Chunks.
The Fixed-Size Allocator.
The SmallObjAllocator Class.
A Hat Trick.
Simple, Complicated, Yet Simple in the End.
Administrivia.
Summary.
Small-Object Allocator Quick Facts.
II. COMPONENTS.
5. Generalized Functors.
The Command Design Pattern.
Command in the Real World.
C11 Callable Entities.
The Functor Class Template Skeleton.
Implementing the Forwarding Functor::operator().
Handling Functors.
Build One, Get One Free.
Argument and Return Type Conversions.
Handling Pointers to Member Functions.
Binding.
Chaining Requests.
Real-World Issues I: The Cost of Forwarding Functions.
Real-World Issues II: Heap Allocation.
Implementing Undo and Redo with Functor.
Summary.
Functor Quick Facts.
6. Implementing Singletons.
Static Data + Static Functions != Singleton.
The Basic C11 Idioms Supporting Singleton.
Enforcing the Singleton's Uniqueness.
Destroying the Singleton.
The Dead Reference Problem.
Addressing the Dead Reference Problem (I):.
Addressing the Dead Reference Problem (II):.
Implementing Singletons with Longevity.
Living in a Multithreaded World.
Putting It All Together.
Working With SingletonHolder.
Summary.
SingletonHolder Class Template Quick Facts.
7. Smart Pointers.
Smart Pointers 101.
The Deal.
Smart Pointers' Storage.
Smart Pointer Member Functions.
Ownership-Handling Strategies.
The Address-of Operator.
Implicit Conversion to Raw Pointer Type.
Equality and Inequality.
Ordering Comparisons.
Checking and Error Reporting.
Smart Pointers to const and const Smart Pointers.
Arrays.
Smart Pointers and Multithreading.
Putting It All Together.
Summary.
SmartPtr Quick Facts.
8. Object Factories.
The Need for Object Factories.
Object Factories in C11: Classes and Objects.
Implementing an Object Factory.
Type Identifiers.
Generalization.
Minutiae.
Clone Factories.
Using Object Factories with Other Generic Components.
Summary.
Factory Class Template Quick Facts.
CloneFactory Class Template Quick Facts.
9. Abstract Factory.
The Architectural Role of Abstract Factory.
A Generic Abstract Factory Interface.
Implementing AbstractFactory.
A Prototype-Based Abstract Factory Implementation.
Summary.
AbstractFactory and ConcreteFactory Quick Facts.
10. Visitor.
Visitor Basics.
Overloading: The Catch-All Function.
An Implementation Refinement: The Acyclic Visitor.
A Generic Implementation of Visitor.
Back to the Cyclic Visitor.
Hooking Variations.
Summary.
Visitor Generic Component Quick Facts.
11. Multimethods.
What Are Multimethods?
When Are Multimethods Needed?
Double Switch-on-Type: Brute Force.
The Brute-Force Approach Automated.
Symmetry with the Brute-Force Dispatcher.
The Logarithmic Double Dispatcher.
FnDispatcher and Symmetry.
Double Dispatch to Functors.
Converting Arguments: static_cast or dynamic_cast?
Constant-Time Multimethods: Raw Speed.
BasicDispatcher and BasicFastDispatcher as Policies.
Looking Forward.
Summary.
Double Dispatcher Quick Facts.
Appendix A. Minimalist Multithreading Library.
A Critique of Multithreading.
Loki's Approach.
Atomic Operations on Integral Types.
Mutexes.
Locking Semantics in Object-Oriented Programming.
Optional volatile Modifier.
Semaphores, Events, and Other Good Things.
Summary.
Bibliography.
Index. 0201704315T04062001
Foreword by John Vlissides.
Preface.
Acknowledgments.
I. TECHNIQUES.
1. Policy-Based Class Design.
The Multiplicity of Software Design.
The Failure of the Do-It-All Interface.
Multiple Inheritance to the Rescue?
Templates Bring Hope.
Policies and Policy Classes.
Enriched Policies.
Destructors of Policy Classes.
Optional Functionality Through Incomplete Instantiation.
Combining Policy Classes.
Customizing Structure with Policy Classes.
Compatible and Noncompatible Policies.
Decomposing a Class in Policies.
Summary.
2. Techniques.
Compile-Time Assertions.
Partial Template Specialization.
Local Classes 28 2.4 Mapping Integral Constants to Types.
Type-to-Type Mapping.
Type Selection.
Detecting Convertibility and Inheritance at Compile Time.
A Wrapper Around type_info.
NullType and EmptyType.
Type Traits.
Summary.
3. Typelists.
The Need for Typelists.
Defining Typelists.
Linearizing Typelist Creation.
Calculating Length.
Intermezzo.
Indexed Access.
Searching Typelists.
Appending to Typelists.
Erasing a Type from a Typelist.
Erasing Duplicates.
Replacing an Element in a Typelist.
Partially Ordering Typelists.
Class Generation with Typelists.
Summary.
Typelist Quick Facts.
4. Small-Object Allocation.
The Default Free Store Allocator.
The Workings of a Memory Allocator.
A Small-Object Allocator.
Chunks.
The Fixed-Size Allocator.
The SmallObjAllocator Class.
A Hat Trick.
Simple, Complicated, Yet Simple in the End.
Administrivia.
Summary.
Small-Object Allocator Quick Facts.
II. COMPONENTS.
5. Generalized Functors.
The Command Design Pattern.
Command in the Real World.
C11 Callable Entities.
The Functor Class Template Skeleton.
Implementing the Forwarding Functor::operator().
Handling Functors.
Build One, Get One Free.
Argument and Return Type Conversions.
Handling Pointers to Member Functions.
Binding.
Chaining Requests.
Real-World Issues I: The Cost of Forwarding Functions.
Real-World Issues II: Heap Allocation.
Implementing Undo and Redo with Functor.
Summary.
Functor Quick Facts.
6. Implementing Singletons.
Static Data + Static Functions != Singleton.
The Basic C11 Idioms Supporting Singleton.
Enforcing the Singleton's Uniqueness.
Destroying the Singleton.
The Dead Reference Problem.
Addressing the Dead Reference Problem (I):.
Addressing the Dead Reference Problem (II):.
Implementing Singletons with Longevity.
Living in a Multithreaded World.
Putting It All Together.
Working With SingletonHolder.
Summary.
SingletonHolder Class Template Quick Facts.
7. Smart Pointers.
Smart Pointers 101.
The Deal.
Smart Pointers' Storage.
Smart Pointer Member Functions.
Ownership-Handling Strategies.
The Address-of Operator.
Implicit Conversion to Raw Pointer Type.
Equality and Inequality.
Ordering Comparisons.
Checking and Error Reporting.
Smart Pointers to const and const Smart Pointers.
Arrays.
Smart Pointers and Multithreading.
Putting It All Together.
Summary.
SmartPtr Quick Facts.
8. Object Factories.
The Need for Object Factories.
Object Factories in C11: Classes and Objects.
Implementing an Object Factory.
Type Identifiers.
Generalization.
Minutiae.
Clone Factories.
Using Object Factories with Other Generic Components.
Summary.
Factory Class Template Quick Facts.
CloneFactory Class Template Quick Facts.
9. Abstract Factory.
The Architectural Role of Abstract Factory.
A Generic Abstract Factory Interface.
Implementing AbstractFactory.
A Prototype-Based Abstract Factory Implementation.
Summary.
AbstractFactory and ConcreteFactory Quick Facts.
10. Visitor.
Visitor Basics.
Overloading: The Catch-All Function.
An Implementation Refinement: The Acyclic Visitor.
A Generic Implementation of Visitor.
Back to the Cyclic Visitor.
Hooking Variations.
Summary.
Visitor Generic Component Quick Facts.
11. Multimethods.
What Are Multimethods?
When Are Multimethods Needed?
Double Switch-on-Type: Brute Force.
The Brute-Force Approach Automated.
Symmetry with the Brute-Force Dispatcher.
The Logarithmic Double Dispatcher.
FnDispatcher and Symmetry.
Double Dispatch to Functors.
Converting Arguments: static_cast or dynamic_cast?
Constant-Time Multimethods: Raw Speed.
BasicDispatcher and BasicFastDispatcher as Policies.
Looking Forward.
Summary.
Double Dispatcher Quick Facts.
Appendix A. Minimalist Multithreading Library.
A Critique of Multithreading.
Loki's Approach.
Atomic Operations on Integral Types.
Mutexes.
Locking Semantics in Object-Oriented Programming.
Optional volatile Modifier.
Semaphores, Events, and Other Good Things.
Summary.
Bibliography.
Index. 0201704315T04062001
Foreword by Scott Meyers.
Foreword by John Vlissides.
Preface.
Acknowledgments.
I. TECHNIQUES.
1. Policy-Based Class Design.
The Multiplicity of Software Design.
The Failure of the Do-It-All Interface.
Multiple Inheritance to the Rescue?
Templates Bring Hope.
Policies and Policy Classes.
Enriched Policies.
Destructors of Policy Classes.
Optional Functionality Through Incomplete Instantiation.
Combining Policy Classes.
Customizing Structure with Policy Classes.
Compatible and Noncompatible Policies.
Decomposing a Class in Policies.
Summary.
2. Techniques.
Compile-Time Assertions.
Partial Template Specialization.
Local Classes 28 2.4 Mapping Integral Constants to Types.
Type-to-Type Mapping.
Type Selection.
Detecting Convertibility and Inheritance at Compile Time.
A Wrapper Around type_info.
NullType and EmptyType.
Type Traits.
Summary.
3. Typelists.
The Need for Typelists.
Defining Typelists.
Linearizing Typelist Creation.
Calculating Length.
Intermezzo.
Indexed Access.
Searching Typelists.
Appending to Typelists.
Erasing a Type from a Typelist.
Erasing Duplicates.
Replacing an Element in a Typelist.
Partially Ordering Typelists.
Class Generation with Typelists.
Summary.
Typelist Quick Facts.
4. Small-Object Allocation.
The Default Free Store Allocator.
The Workings of a Memory Allocator.
A Small-Object Allocator.
Chunks.
The Fixed-Size Allocator.
The SmallObjAllocator Class.
A Hat Trick.
Simple, Complicated, Yet Simple in the End.
Administrivia.
Summary.
Small-Object Allocator Quick Facts.
II. COMPONENTS.
5. Generalized Functors.
The Command Design Pattern.
Command in the Real World.
C11 Callable Entities.
The Functor Class Template Skeleton.
Implementing the Forwarding Functor::operator().
Handling Functors.
Build One, Get One Free.
Argument and Return Type Conversions.
Handling Pointers to Member Functions.
Binding.
Chaining Requests.
Real-World Issues I: The Cost of Forwarding Functions.
Real-World Issues II: Heap Allocation.
Implementing Undo and Redo with Functor.
Summary.
Functor Quick Facts.
6. Implementing Singletons.
Static Data + Static Functions != Singleton.
The Basic C11 Idioms Supporting Singleton.
Enforcing the Singleton's Uniqueness.
Destroying the Singleton.
The Dead Reference Problem.
Addressing the Dead Reference Problem (I):.
Addressing the Dead Reference Problem (II):.
Implementing Singletons with Longevity.
Living in a Multithreaded World.
Putting It All Together.
Working With SingletonHolder.
Summary.
SingletonHolder Class Template Quick Facts.
7. Smart Pointers.
Smart Pointers 101.
The Deal.
Smart Pointers' Storage.
Smart Pointer Member Functions.
Ownership-Handling Strategies.
The Address-of Operator.
Implicit Conversion to Raw Pointer Type.
Equality and Inequality.
Ordering Comparisons.
Checking and Error Reporting.
Smart Pointers to const and const Smart Pointers.
Arrays.
Smart Pointers and Multithreading.
Putting It All Together.
Summary.
SmartPtr Quick Facts.
8. Object Factories.
The Need for Object Factories.
Object Factories in C11: Classes and Objects.
Implementing an Object Factory.
Type Identifiers.
Generalization.
Minutiae.
Clone Factories.
Using Object Factories with Other Generic Components.
Summary.
Factory Class Template Quick Facts.
CloneFactory Class Template Quick Facts.
9. Abstract Factory.
The Architectural Role of Abstract Factory.
A Generic Abstract Factory Interface.
Implementing AbstractFactory.
A Prototype-Based Abstract Factory Implementation.
Summary.
AbstractFactory and ConcreteFactory Quick Facts.
10. Visitor.
Visitor Basics.
Overloading: The Catch-All Function.
An Implementation Refinement: The Acyclic Visitor.
A Generic Implementation of Visitor.
Back to the Cyclic Visitor.
Hooking Variations.
Summary.
Visitor Generic Component Quick Facts.
11. Multimethods.
What Are Multimethods?
When Are Multimethods Needed?
Double Switch-on-Type: Brute Force.
The Brute-Force Approach Automated.
Symmetry with the Brute-Force Dispatcher.
The Logarithmic Double Dispatcher.
FnDispatcher and Symmetry.
Double Dispatch to Functors.
Converting Arguments: static_cast or dynamic_cast?
Constant-Time Multimethods: Raw Speed.
BasicDispatcher and BasicFastDispatcher as Policies.
Looking Forward.
Summary.
Double Dispatcher Quick Facts.
Appendix A. Minimalist Multithreading Library.
A Critique of Multithreading.
Loki's Approach.
Atomic Operations on Integral Types.
Mutexes.
Locking Semantics in Object-Oriented Programming.
Optional volatile Modifier.
Semaphores, Events, and Other Good Things.
Summary.
Bibliography.
Index. 0201704315T04062001
Foreword by John Vlissides.
Preface.
Acknowledgments.
I. TECHNIQUES.
1. Policy-Based Class Design.
The Multiplicity of Software Design.
The Failure of the Do-It-All Interface.
Multiple Inheritance to the Rescue?
Templates Bring Hope.
Policies and Policy Classes.
Enriched Policies.
Destructors of Policy Classes.
Optional Functionality Through Incomplete Instantiation.
Combining Policy Classes.
Customizing Structure with Policy Classes.
Compatible and Noncompatible Policies.
Decomposing a Class in Policies.
Summary.
2. Techniques.
Compile-Time Assertions.
Partial Template Specialization.
Local Classes 28 2.4 Mapping Integral Constants to Types.
Type-to-Type Mapping.
Type Selection.
Detecting Convertibility and Inheritance at Compile Time.
A Wrapper Around type_info.
NullType and EmptyType.
Type Traits.
Summary.
3. Typelists.
The Need for Typelists.
Defining Typelists.
Linearizing Typelist Creation.
Calculating Length.
Intermezzo.
Indexed Access.
Searching Typelists.
Appending to Typelists.
Erasing a Type from a Typelist.
Erasing Duplicates.
Replacing an Element in a Typelist.
Partially Ordering Typelists.
Class Generation with Typelists.
Summary.
Typelist Quick Facts.
4. Small-Object Allocation.
The Default Free Store Allocator.
The Workings of a Memory Allocator.
A Small-Object Allocator.
Chunks.
The Fixed-Size Allocator.
The SmallObjAllocator Class.
A Hat Trick.
Simple, Complicated, Yet Simple in the End.
Administrivia.
Summary.
Small-Object Allocator Quick Facts.
II. COMPONENTS.
5. Generalized Functors.
The Command Design Pattern.
Command in the Real World.
C11 Callable Entities.
The Functor Class Template Skeleton.
Implementing the Forwarding Functor::operator().
Handling Functors.
Build One, Get One Free.
Argument and Return Type Conversions.
Handling Pointers to Member Functions.
Binding.
Chaining Requests.
Real-World Issues I: The Cost of Forwarding Functions.
Real-World Issues II: Heap Allocation.
Implementing Undo and Redo with Functor.
Summary.
Functor Quick Facts.
6. Implementing Singletons.
Static Data + Static Functions != Singleton.
The Basic C11 Idioms Supporting Singleton.
Enforcing the Singleton's Uniqueness.
Destroying the Singleton.
The Dead Reference Problem.
Addressing the Dead Reference Problem (I):.
Addressing the Dead Reference Problem (II):.
Implementing Singletons with Longevity.
Living in a Multithreaded World.
Putting It All Together.
Working With SingletonHolder.
Summary.
SingletonHolder Class Template Quick Facts.
7. Smart Pointers.
Smart Pointers 101.
The Deal.
Smart Pointers' Storage.
Smart Pointer Member Functions.
Ownership-Handling Strategies.
The Address-of Operator.
Implicit Conversion to Raw Pointer Type.
Equality and Inequality.
Ordering Comparisons.
Checking and Error Reporting.
Smart Pointers to const and const Smart Pointers.
Arrays.
Smart Pointers and Multithreading.
Putting It All Together.
Summary.
SmartPtr Quick Facts.
8. Object Factories.
The Need for Object Factories.
Object Factories in C11: Classes and Objects.
Implementing an Object Factory.
Type Identifiers.
Generalization.
Minutiae.
Clone Factories.
Using Object Factories with Other Generic Components.
Summary.
Factory Class Template Quick Facts.
CloneFactory Class Template Quick Facts.
9. Abstract Factory.
The Architectural Role of Abstract Factory.
A Generic Abstract Factory Interface.
Implementing AbstractFactory.
A Prototype-Based Abstract Factory Implementation.
Summary.
AbstractFactory and ConcreteFactory Quick Facts.
10. Visitor.
Visitor Basics.
Overloading: The Catch-All Function.
An Implementation Refinement: The Acyclic Visitor.
A Generic Implementation of Visitor.
Back to the Cyclic Visitor.
Hooking Variations.
Summary.
Visitor Generic Component Quick Facts.
11. Multimethods.
What Are Multimethods?
When Are Multimethods Needed?
Double Switch-on-Type: Brute Force.
The Brute-Force Approach Automated.
Symmetry with the Brute-Force Dispatcher.
The Logarithmic Double Dispatcher.
FnDispatcher and Symmetry.
Double Dispatch to Functors.
Converting Arguments: static_cast or dynamic_cast?
Constant-Time Multimethods: Raw Speed.
BasicDispatcher and BasicFastDispatcher as Policies.
Looking Forward.
Summary.
Double Dispatcher Quick Facts.
Appendix A. Minimalist Multithreading Library.
A Critique of Multithreading.
Loki's Approach.
Atomic Operations on Integral Types.
Mutexes.
Locking Semantics in Object-Oriented Programming.
Optional volatile Modifier.
Semaphores, Events, and Other Good Things.
Summary.
Bibliography.
Index. 0201704315T04062001