Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-10-08 13:17:56


Philippe A. Bouchard wrote:

[...]

The following is simple overview. It is hardly a detailed proposal:

> I was thinking that maybe every smart pointer types could be created
> with your design [smart_ptr]:
> - a normal smart pointer using standard operator new (as shared_ptr
> is);
> - a policy that removes reference counts and uses pure garbage
> collection;
> - a policy that mixes garbage collection with reference counts;
> - a policy that adds an "indicator *", therefore incrementing the
> size of smart_ptr by sizeof(void *);
> - a policy that compresses the actual shared_ptr into the actual
> shifted_ptr (but requiring an object factory).
>
> So:
> - it could defaults to "standard operator new / rc / no gc / no
> indicator * / no compression" (as shared_ptr is right now);
> - if you want to accelerate the project again then "standard operator
> new / no rc / gc / no indicator * / no compression" (standard raw
> pointer);
> - if you want your destructor to be called on time and accelerate the
> project you could use "object factory / rc / no gc / indicator * /
> compression" (as shifted_ptr is right now).
>
> Notes:
> - the last combination wouldn't be that much slower than the latter;
> - other possible combinations wouldn't be optimized for a specific
> ressource usage;
> - it sounds easy to mention its architecture, but implicit casts
> would still be difficult to implement.

[...]

Question:
Would it be possible for the new smart_ptr design to start playing around
with different architectures (smart_ptr members, pointees, etc.)? Logically
speaking, it would require partial specializations...?

It would be great to specialize the new smart_ptr<T, ...> and rename some
derivatives to shared_ptr, shifted_ptr, gc_ptr (garbage collected raw ptrs
w/o reference count), etc.

Dave is that compatible with the new smart_ptr design?

Philippe


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