Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-03-30 05:58:23

Larry Evans wrote:
> On 03/29/2006 05:05 PM, Peter Dimov wrote:
>> make_shared_ptr<T>( a, b, c ) (or however we end up calling it)
>> still has the advantage of being able to fold the two allocations
>> into one.
> I assume the two allocations are for the detached refcount and the
> referent. Wouldn't placing them in the same block of memory with
> a single call to new (and I assume this is what you mean by
> "fold the two allocations into one") mean that shared_ptr would have
> to change it's two deletes (1 for refcount and 1 for referent) into
> one?

Yes, the referent will be destroyed in place via explicit destructor call,
not via delete.

> IOW, make_shared_ptr would not make the current shared_ptr but
> another type of smart pointer. Or am I missing something?

The current shared_ptr can handle that.

Boost list run by bdawes at, gregod at, cpdaniel at, john at