Modern C++ Design

Generic Programming and Design Patterns Applied

Specificaties
E-book, blz. | Engels
Pearson Education | e druk, 2001
ISBN13: 9780133387612
Rubricering
Juridisch :
Pearson Education e druk, 2001 9780133387612
Verwachte levertijd ongeveer 9 werkdagen

Samenvatting

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, generic 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 seamless 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 on 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 Typelists–powerful type manipulation structures Patterns such as Visitor, Singleton, Command, and Factories Multi-method engines

For each generic component, the book presents the fundamental problems and design options, and finally implements a generic solution.

 

In addition, an accompanying Web site, http://www.awl.com/cseng/titles/0-201-70431-5, makes the 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.

 

Get a value-added service! Try out all the examples from this book at www.codesaw.com. CodeSaw is a free online learning tool that allows you to experiment with live code from your book right in your browser.

Specificaties

ISBN13:9780133387612
Taal:Engels
Bindwijze:e-book

Inhoudsopgave

<br> <br> Foreword by Scott Meyers. <br> <br> <br> Foreword by John Vlissides. <br> <br> <br> Preface. <br> <br> <br> Acknowledgments. <br> <p> I. TECHNIQUES. </p> <div style="margin-left: 0.2in;"> 1. Policy-Based Class Design. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Multiplicity of Software Design. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Failure of the Do-It-All Interface. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Multiple Inheritance to the Rescue? </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Templates Bring Hope. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Policies and Policy Classes. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Enriched Policies. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Destructors of Policy Classes. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Optional Functionality Through Incomplete Instantiation. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Combining Policy Classes. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Customizing Structure with Policy Classes. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Compatible and Noncompatible Policies. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Decomposing a Class in Policies. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <div style="margin-left: 0.2in;"> 2. Techniques. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> Compile-Time Assertions. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Partial Template Specialization. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Local Classes 28 2.4 Mapping Integral Constants to Types. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Type-to-Type Mapping. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Type Selection. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Detecting Convertibility and Inheritance at Compile Time. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Wrapper Around type_info. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> NullType and EmptyType. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Type Traits. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <div style="margin-left: 0.2in;"> 3. Typelists. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Need for Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Defining Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Linearizing Typelist Creation. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Calculating Length. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Intermezzo. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Indexed Access. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Searching Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Appending to Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Erasing a Type from a Typelist. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Erasing Duplicates. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Replacing an Element in a Typelist. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Partially Ordering Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Class Generation with Typelists. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Typelist Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 4. Small-Object Allocation. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Default Free Store Allocator. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Workings of a Memory Allocator. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Small-Object Allocator. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Chunks. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Fixed-Size Allocator. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The SmallObjAllocator Class. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Hat Trick. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Simple, Complicated, Yet Simple in the End. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Administrivia. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Small-Object Allocator Quick Facts. </div> <p></p> <p> II. COMPONENTS. </p> <div style="margin-left: 0.2in;"> 5. Generalized Functors. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Command Design Pattern. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Command in the Real World. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> C11 Callable Entities. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Functor Class Template Skeleton. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implementing the Forwarding Functor::operator(). </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Handling Functors. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Build One, Get One Free. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Argument and Return Type Conversions. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Handling Pointers to Member Functions. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Binding. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Chaining Requests. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Real-World Issues I: The Cost of Forwarding Functions. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Real-World Issues II: Heap Allocation. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implementing Undo and Redo with Functor. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Functor Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 6. Implementing Singletons. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> Static Data + Static Functions != Singleton. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Basic C11 Idioms Supporting Singleton. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Enforcing the Singleton's Uniqueness. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Destroying the Singleton. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Dead Reference Problem. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Addressing the Dead Reference Problem (I):. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Addressing the Dead Reference Problem (II):. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implementing Singletons with Longevity. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Living in a Multithreaded World. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Putting It All Together. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Working With SingletonHolder. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> SingletonHolder Class Template Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 7. Smart Pointers. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> Smart Pointers 101. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Deal. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Smart Pointers' Storage. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Smart Pointer Member Functions. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Ownership-Handling Strategies. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Address-of Operator. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implicit Conversion to Raw Pointer Type. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Equality and Inequality. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Ordering Comparisons. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Checking and Error Reporting. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Smart Pointers to const and const Smart Pointers. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Arrays. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Smart Pointers and Multithreading. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Putting It All Together. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> SmartPtr Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 8. Object Factories. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Need for Object Factories. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Object Factories in C11: Classes and Objects. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implementing an Object Factory. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Type Identifiers. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Generalization. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Minutiae. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Clone Factories. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Using Object Factories with Other Generic Components. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Factory Class Template Quick Facts. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> CloneFactory Class Template Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 9. Abstract Factory. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> The Architectural Role of Abstract Factory. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Generic Abstract Factory Interface. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Implementing AbstractFactory. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Prototype-Based Abstract Factory Implementation. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> AbstractFactory and ConcreteFactory Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 10. Visitor. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> Visitor Basics. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Overloading: The Catch-All Function. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> An Implementation Refinement: The Acyclic Visitor. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> A Generic Implementation of Visitor. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Back to the “Cyclic” Visitor. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Hooking Variations. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Visitor Generic Component Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> 11. Multimethods. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> What Are Multimethods? </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> When Are Multimethods Needed? </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Double Switch-on-Type: Brute Force. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Brute-Force Approach Automated. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Symmetry with the Brute-Force Dispatcher. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> The Logarithmic Double Dispatcher. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> FnDispatcher and Symmetry. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Double Dispatch to Functors. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Converting Arguments: static_cast or dynamic_cast? </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Constant-Time Multimethods: Raw Speed. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> BasicDispatcher and BasicFastDispatcher as Policies. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Looking Forward. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Double Dispatcher Quick Facts. </div> <p></p> <div style="margin-left: 0.2in;"> Appendix A. Minimalist Multithreading Library. </div> <br> <p> </p> <div style="margin-left: 0.4in;"> A Critique of Multithreading. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Loki's Approach. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Atomic Operations on Integral Types. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Mutexes. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Locking Semantics in Object-Oriented Programming. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Optional volatile Modifier. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Semaphores, Events, and Other Good Things. </div> <p></p> <p> </p> <div style="margin-left: 0.4in;"> Summary. </div> <p></p> <div style="margin-left: 0.2in;"> Bibliography. </div> <br> <div style="margin-left: 0.2in;"> Index. 0201704315T04062001 </div> <br>

Net verschenen

Rubrieken

Populaire producten

    Personen

      Trefwoorden

        Modern C++ Design