|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-01 19:52:45
In reading some old messages originally skipped for lack of time, I came
across this:
At 03:16 PM 7/23/2002, Philippe A. Bouchard wrote:
>... policy-based smart pointers (what are they anyways?)?
David Held gave a polite response:
> Read Modern C++ Design, by Andrei Alexandrescu. ;)
Let me answer a little more bluntly so there is no chance of
misunderstanding:
Andrei Alexandrescu, Modern C++ Design, Addison-Wesley, 2001, expands the
idea of traits class into a powerful technique he calls "Policy-Based Class
Design." A particularly interesting example he gives is the Loki SmartPtr
class.
Anyone who discusses smart pointers without being familiar with the policy
based smart pointer described in Andrei's book runs several risks:
* They may not be taken very seriously by others.
* They may reinvent the wheel, only to discover that Andrei invented it
better.
* They may fail to reinvent the wheel, thus depriving themselves of a
possible better solution to their problem.
Greg Colvin's original shared_ptr design, as later extended by Greg and
Peter Dimov, with help from Darin Adler and other Boosters, has proved to
be far more versatile than anyone could have imagined when it was first
proposed ten years ago, particularly when teamed with the other Boost smart
pointers. But policy-based smart pointers may be a better choice for those
who feel they absolutely must have 100% control over every detail of
implementation.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk