By Andrei Alexandrescu

In Modern C++ Design , Andrei Alexandrescu opens new vistas for C++ programmers. exhibiting remarkable creativity and programming virtuosity, Alexandrescu deals a state-of-the-art method of layout that unites layout styles, customary programming, and C++, permitting programmers to accomplish expressive, versatile, and hugely reusable code.

 

This ebook introduces the concept that of familiar components—reusable layout templates that produce boilerplate code for compiler consumption—all inside of C++. typical elements allow a better and extra seamless transition from layout to program code, generate code that larger expresses the unique layout goal, and aid the reuse of layout constructions with minimum recoding.

 

The writer describes the explicit C++ innovations and contours which are utilized in development time-honored elements and is going directly to enforce business energy regular elements for real-world functions. ordinary matters that C++ builders face of their day by day job are mentioned intensive and carried out in a known means. those include:

  • Policy-based layout for flexibility
  • Partial template specialization
  • Typelists—powerful sort manipulation structures
  • Patterns comparable to customer, Singleton, Command, and Factories
  • Multi-method engines

For each one universal part, the ebook provides the elemental difficulties and layout thoughts, and eventually implements a prevalent resolution.

 

In addition, an accompanying website, http://www.awl.com/cseng/titles/0-201-70431-5, makes the code implementations on hand for the typical elements within the publication and offers a loose, downloadable C++ library, known as Loki, created by means of the writer. Loki offers out-of-the-box performance for almost any C++ venture.

 

Get a value-added carrier! attempt all of the examples from this publication at www.codesaw.com. CodeSaw is a loose on-line studying software on the way to scan with dwell code out of your booklet correct on your browser.

Show description

Read or Download Modern C++ Design: Generic Programming and Design Patterns Applied PDF

Similar Programming books

Embedded C

For those who are approximately to put in writing their first embedded software - or were suffering to profit approximately this crucial zone - this e-book will retailer weeks of attempt.

Cocoa Design Patterns

“Next time a few child exhibits up at my door requesting a code assessment, this can be the ebook that i'm going to throw at him. ”   –Aaron Hillegass, founding father of giant Nerd Ranch, Inc. , and writer of Cocoa Programming for Mac OS X   Unlocking the secrets and techniques of Cocoa and Its Object-Oriented Frameworks   Mac and iPhone builders are usually beaten by way of the breadth and class of the Cocoa frameworks.

C++ Primer (5th Edition)

Bestselling Programming educational and Reference thoroughly Rewritten for the hot C++11 general   absolutely up to date and recast for the newly published C++11 commonplace, this authoritative and finished advent to C++ might help you to benefit the language quickly, and to take advantage of it in glossy, powerful methods.

Operating System Concepts

Maintain velocity with the fast-developing international of working platforms Open-source working structures, digital machines, and clustered computing are one of the best fields of working structures and networking which are quickly altering. With titanic revisions and organizational adjustments, Silberschatz, Galvin, and Gagne’s working approach suggestions, 8th version is still as present and proper as ever, aiding you grasp the basic options of working platforms whereas getting ready your self for today’s rising advancements.

Extra info for Modern C++ Design: Generic Programming and Design Patterns Applied

Show sample text content

It is time now for the following step—the step from concrete to summary. Then, enriched with new insights, we are going to return to concrete. eight. five Generalization Let's enumerate the weather all in favour of our dialogue of item factories. this offers us the highbrow exercise routine invaluable for placing jointly a common item manufacturing unit. • Concrete product. A manufacturing unit can provide a few product within the kind of an item. • summary product. items inherit a base style (in our instance, Shape). A product is an item whose style belongs to a hierarchy. the bottom form of the hierarchy is the summary product. The manufacturing unit behaves polymorphically within the experience that it returns a pointer to the summary product, with no conveying wisdom of the concrete product kind. 181 • Product kind identifier. this can be the article that identifies the kind of the concrete product. As mentioned, you want to have a sort identifier to create a product a result of static C++ sort process. • Product writer. The functionality or functor is really expert for growing precisely one kind of item. We modeled the product writer utilizing a pointer to operate. The known manufacturing facility will orchestrate those components to supply a well-defined interface, in addition to defaults for the main used instances. it appears all the notions simply enumerated will rework right into a template parameter of a manufacturing facility template type. there is just one exception: The concrete product does not must be identified to the manufacturing unit. Had this been the case, we would have diverse manufacturing unit forms for every concrete product we are including, and we're attempting to hold manufacturing facility insulated from the concrete varieties. we'd like simply assorted manufacturing unit forms for various summary items. This being acknowledged, let's write down what we have now grabbed to date: template < classification AbstractProduct, typename IdentifierType, typename ProductCreator > category manufacturing unit { public: bool Register(const IdentifierType& identity, ProductCreator author) { go back associations_. insert( AssocMap::value_type(id, creator)). moment; } bool Unregister(const IdentifierType& identification) { go back associations_. erase(id) == 1; } AbstractProduct* CreateObject(const IdentifierType& identification) { typename AssocMap::const_iterator i = associations_. find(id); if (i ! = associations_. end()) { go back (i->second)(); } deal with errors } deepest: typedef std::map AssocMap; AssocMap associations_; }; the one factor passed over is mistakes dealing with. If we did not discover a author registered with the manufacturing facility, may still we throw an exception? go back a null pointer? Terminate this system? Dynamically load a few library, sign in it at the fly, and retry the operation? the particular selection relies greatly at the concrete state of affairs; any of those activities is smart at times. Our ordinary manufacturing unit may still permit the consumer customise it to do any of those activities and may supply a cheap default habit. hence, the mistake dealing with code could be pulled out of the 182 CreateObject member functionality right into a separate FactoryError coverage (see bankruptcy 1).

Rated 4.31 of 5 – based on 38 votes