Date: 2002-04-19 10:52:10
Andrei Alexandrescu wrote:
> To me, a policy-based pointer is clearly the way to go.
I can agree with this although only with the following restriction:
It has to be complemented by a smart pointer template with just one
template parameter, namely the type: This would be the type used in
interfaces. It should be configurable to use different policies for
different type but there is only one set of policies for a specific
Merely advising people to add appropriate typedefs is not sufficient
because there would have to be general agreement on the names of the
typedefs and their configuration.
Of course, this issue is quite orthogonal to policy-based smart
pointers but my impression of the recent discussion on smart pointers
was that the intended change is replacing 'boost::shared_ptr' by a
policy-based smart pointer. This alone, without the addition of a
specific name to be used in interfaces is what is actually evil about
policy-based smart pointers (I haven't said so explicitly in my initial
message but I thought I was quite clear about this).
> I am sure there are better designs than Loki::SmartPtr. What I can
> tell is that I have had salient results with policy-based smart
> pointers, many other people reported the same, and nobody
> complained... before yesterday.
I have been using 'boost::shared_ptr<T>' which serves well as an
interface. I wouldn't consider using a policy-based smart pointer to
define interfaces in projects: people would choose different policies
-- <mailto:dietmar_kuehl_at_[hidden]> <http://www.dietmar-kuehl.de/> Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk