Boost logo

Boost :

From: rogeeff (rogeeff_at_[hidden])
Date: 2002-01-12 20:34:03


--- In boost_at_y..., "Andrei Alexandrescu" <andrewalex_at_h...> wrote:
> The proof is in the pudding, but I'll try to reply in short below.
>
> > 1. Why the separate Storage and Ownership policies?
>
> They are orthogonal for the most part. For example, there is no
link between
> the fact that you allocate a pointer with new and the fact that you
> reference count it. Same pointer allocated with new you also may
want to
> reference link (maintain a linked list between all pointers to the
same
> object) or simply treat it as an auto_ptr. As far as the ownership
policy is
> concerned, the managed resource can be allocated anyhow and can
actually not
> be a pointer at all.
>

That is not exactly true, cause Clone part belong to Ownership
Policy, while it may require some knowledge belonging to
StoragePolicy. For example, how whould you implement DeepCopy smart
pointer over arrays?
To cut the knot the framework should be enhanced somehow. For example:
If OwnershipPolicy::Clone returns false (you will need to make
current result a second argument), meaning that it fails to perform a
clone, than the framework would use StoragePolicy::DeepCopy to
perform as least deep copy. I am not sure how generic it is and how
would I like such a solution but we need something like this.

[...]

> Andrei

Gennadiy.


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