From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-26 10:37:14


Gennadiy Rozental wrote:
>> By PBSP, do you mean policy-based smart pointers in general, or a
>> Loki-derived smart pointer in particular?
>
> You may say in general or Loki-derived - depend on point of view. I
> have many objections to Loki solution (and some of it's derivatives).
> But what I have in mind is similar. Do you have any other alternative
> model?

If you ask me for my personal opinion: I have little use for the Conversion
and the Checking policies. However I do need an easier way of specifying a
deleter (ala Howard's unique_ptr) and a ConstPropagation policy (with the
default being No for shallow copy and Yes for deep copy).

In addition, I'm not happy with the integration of shared/weak/intrusive_ptr
in the current model. To be really flexible, a policy-based incarnation of a
reference counted pointer needs to leave its aspects configurable, covering
the whole spectrum from a simple counted_ptr to full-featured shared_ptr
(with or without weak_ptr support in both cases) and possibly covering the
unsafe/basic/strong thread safety axis as well. This might imply a policy
controlling whether conversions from smart_ptr<T> to smart_ptr<U> are
allowed (because disallowing these allows alternative implementations or
omitting one pointer from the control block.)

My needs may not be typical, of course.