Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-10-21 19:33:35


At 05:52 PM 10/18/01 +0000, williamkempf_at_[hidden] wrote:
>--- In boost_at_y..., "Fernando Cacciola" <fcacciola_at_g...> wrote:
>>
>> ----- Original Message -----
>> From: David Abrahams <david.abrahams_at_r...>
>> To: <boost_at_y...>
>> Sent: Thursday, October 18, 2001 12:24 PM
>> Subject: Re: [boost] shared_ptr bug?
>>
>>
>> > Can we do better with a single-pointer-chained-count design?
>> >
>> > +-ptr-+ +-count-+ +-target-+
>> > | | | | | | |
>> > | *=======>| 1 | *======>| |
>> > | | | | | | |
>> > +-----+ +---+---+ +--------+
>> >
>> I'm not aware of this design. Could you point me to any online
>reference
>> that I can look at?
>
>If I understand the picture, what's proposed is going from this:
>
>template<typename T> class shared_ptr {
> // removed for clarity
> T* px;
> long* pn;
>};
>
>to this:
>
>template<typename T> class shared_ptr {
> // removed for clarity
> struct count { T* px; long n; }
> count* pc;
>};
>
>This may well simplify the implementation, but it would add a level
>of indirection when dereferencing the "pointer".

That was the rationale for rejecting the indirect approach.

--Beman


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