Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-17 22:27:11


Terje Slettebø <tslettebo_at_[hidden]> writes:

>>From: "David Abrahams" <dave_at_[hidden]>
>>
>> Please don't take this to mean I'm against a
>> policy-based smart pointer; quite the opposite. I've
>> said all along it would be great to have one in boost.
>> I've even wished I had an appropriate occasionally.
>>
>> I just don't want to trivialize what I perceive to be
>> valid concerns, either. Understanding the costs of
>> complexity should be as important to the designer of
>> policy-based classes as to everyone else, if not more
>> so.
>
> I understand the concern. For one thing, we don't have template typedefs,
> yet, although me may get a similar effect (if not the same type) with e.g.:
>
> template<class T>
> struct shared_ptr : smart_ptr<T, policies...> {};
>
> etc.
>
> However, I also understand the concern regarding understanding the policies
> available, their responsibilities and interaction. Therefore, convenience
> templates like the above could make it easier to use them, while still
> allowing new convenience templates/template typedefs to be made, or new
> policy implementations added.
>
> Having such convenience templates is a bit like having a small configuration
> DSL on top of the policy-based smart pointer, to use the terminology in C&E.

Sure, and I expected we'd do that. Not to beat this horse to death,
but I think even that doesn't insulate users from the parameters
completely. They'll see it in the documentation, and wonder what's
going on under the covers with all that complexity, and it will be a
distraction.

One way out might be not to tell them that shared_ptr is built on the
policy-based one.

I think Peter also values the fact that boost::shared_ptr has few
dependencies on other boost code, a problem I don't see such an easy
way out of.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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