Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-07-14 21:47:45


> I think the question really boils down to whether we want to support this
> as an idiom...
>
> shared_ptr<widget> sp(new widget(...));

Yes, that was exactly why I insisted on the deletion semantics.

<snip>

> and from this it's a short step to...
>
> template<typename integer>
> struct shared_ptr_hoist
> {
> mutable integer * pn;
> static const integer one;
> };
>
> template<typename T, typename integer=long>
> class shared_ptr : private shared_ptr_hoist<integer>
> {
> ...
> private:
> T * px;
> };
>
>
> This seems a nice design because all the count stuff can be factored out
> into the hoist, allowing for further new/delete optimisation of the count
> allocations...

But would somebody please explain the point of this? Why do you want these
semantics?

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications


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