From c0d7b1953fdece864014812c650b05c1362b2716 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 13 Sep 2004 03:40:00 +0000 Subject: [PATCH] Fixed Andrei's Policy quote [SVN r25026] --- generic_programming.html | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/generic_programming.html b/generic_programming.html index b9fb603..cc9a2a1 100644 --- a/generic_programming.html +++ b/generic_programming.html @@ -213,9 +213,9 @@ struct iterator_traits {

Tag Dispatching

-

A technique that often goes hand in hand with traits classes is tag - dispatching, which is a way of using function overloading to dispatch - based on properties of a type. A good example of this is the +

Tag dispatching is a way of using function overloading to + dispatch based on properties of a type, and is often used hand in + hand with traits classes. A good example of this synergy is the implementation of the std::advance() function in the C++ Standard Library, which increments an iterator @@ -307,7 +307,7 @@ namespace std {

Type Generators

Note: The type generator concept has largely been - superseded by the more-refined notion of a metafunction. See C++ Template Metaprogramming for an in-depth discussion of metafunctions.

@@ -415,20 +415,20 @@ void tweak_all_widgets2(int arg)

Policy classes have been explored in detail by Andrei Alexandrescu in - this paper. He writes:

+ "http://www.informit.com/articles/article.asp?p=167842">this chapter + of his book, Modern C++ Design. He writes:

-

Policy classes are implementations of punctual design choices. They - are inherited from, or contained within, other classes. They provide - different strategies under the same syntactic interface. A class using - policies is templated having one template parameter for each policy it - uses. This allows the user to select the policies needed.

+

In brief, policy-based class design fosters assembling a class with + complex behavior out of many little classes (called policies), each of + which takes care of only one behavioral or structural aspect. As the + name suggests, a policy establishes an interface pertaining to a + specific issue. You can implement policies in various ways as long as + you respect the policy interface.

-

The power of policy classes comes from their ability to combine - freely. By combining several policy classes in a template class with - multiple parameters, one achieves combinatorial behaviors with a linear - amount of code.

+

Because you can mix and match policies, you can achieve a + combinatorial set of behaviors by using a small core of elementary + components.

Andrei's description of policy classes suggests that their power is @@ -460,15 +460,15 @@ void tweak_all_widgets2(int arg) express or implied warranty, and with no claim as to its suitability for any purpose. + --> + --> + --> + -->