|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-19 00:29:32
----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> There are two ways to redesign:
>
> (1) we add a template parameter "Base" to two policies and we build a
> linear hierarchy;
c.f. booost/operators.hpp
> (2) we assume that StoragePolicy always stores state so we store it as
> a member inside SmartPtr. Then, we assume the CheckingPolicy doesn't
> ever store any state and defines only static functions, so we don't
> store it anywhere nor derive from it. Finally, we assume that
> OwnershipPolicy may or may not store state so we derive (solely) from
> it.
Lots of assumptions (any of which which might turn out to be wrong).
I prefer (1). With that approach there's more flexibility to do things
like build combined policies which simplify interactions between aspects
of the smart pointer's behavior, or to write adaptive policies which add
just one aspect (e.g. MT locking) to another smart pointer.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk