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

Book Description

In 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 , generic programming, and C++, enabling programmers to achieve expressive, flexible, and highly reusable .

This book introduces the concept of generic components—reusable design 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
  • 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,, 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++ .

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

Table of Contents

Part I Techniques
Chapter 1 Policy-Based Class Design
Chapter 2 Techniques
Chapter 3 Typelists
Chapter 4 Small-Object Allocation

Part II Components
Chapter 5 Generalized Functors
Chapter 6 Implementing Singletons
Chapter 7 Smart Pointers
Chapter 8 Object Factories
Chapter 9 Abstract Factory
Chapter 10 Visitor
Chapter 11 Multimethods

Appendix A Minimalist Multithreading Library

Book Details

  • Title: Modern C++ Design: Generic Programming and Design Patterns Applied
  • Author:
  • Length: 352 pages
  • Edition: 1
  • Language: English
  • Publisher:
  • Publication Date: 2001-02-23
  • ISBN-10: 0201704315
  • ISBN-13: 9780201704310