Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-02-03 16:32:07


At 02:57 PM 2/3/2003, David Abrahams wrote:

>Beman Dawes <bdawes_at_[hidden]> writes:
>
>> At 09:46 PM 2/2/2003, Howard Hinnant wrote:
>>
>> To me, a major benefit of a policy based design is to
>> be able to accommodate a wide range of features,
>> including those which find only limited use.
>>
>> If a policy based smart pointer can't accommodate a
>> wide range of features, I start to wonder if the design
>> itself is inflexible and flawed. That's why I worry a
>> lot about whether a given PBSP design can handle
>> apparently marginal uses.
>
>There's no reason we have to be restricted to a single idiom AFAICT.
>The GenVoca-style design we're using for the new iterator_adaptors is
>great for adding new interface in the most-derived class. A blend of
>techniques is often more effective than trying to cram everything into
>a single approach. If you want a smart_ptr with implicit conversion,
>one way might be:
>
> template <class T>
> struct legacy_ptr
> : smart_ptr<blah, blah, blah...>
> {
>
> legacy_ptr(T* p) : smart_ptr<blah...>(p) {}
> T* operator()() const { return this->get(); }
> };

Yes, that's a good point for add-on features that can be implemented on top
of smart_ptr.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk