Boost logo

Boost :

Subject: Re: [boost] Rationale for shared_ptr/array including both ptr to control and ptr to data in class
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-09-23 09:08:22


On Fri, Sep 23, 2011 at 2:03 PM, Sebastian Redl
<sebastian.redl_at_[hidden]> wrote:
>> I was wondering why shared_ptr/array include both a ptr to the control
>> block and a ptr to the data (ptr) in the class itself. I assume it's
>> for performance reasons, but I didn't find anything about that in the
>> docs.
>>
> It's for aliasing. You can have a shared_ptr that points to a subobject of
> the object controlled by the control block.

Ah, of course. Does that apply to shared_array too?

Olaf


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