std::ext STL (was: Re: design doc on alternative pointer support)

Phil Bouchard philippe@fornux.com
Thu Aug 14 16:23:00 GMT 2008


"Phil Bouchard" <philippe@fornux.com> wrote in message 
news:g8140i$6lg$1@ger.gmane.org...

[...]

> list:
> n1 <-> n2 <-> n3 <-> n4
>
> stack:
> n1 -> n2 -> n3 -> n4
>
> Now clear() iterates from n1 to n4 in both cases and deletes associates
> nodes.  But if we use smart pointers then if we'll get the entire 
> container
> deleted by deleting n1.  In the case of the list then it will be different
> because n2, n3 and n4 will not be deallocated just by deleting n1 (in case
> of shifted_ptr yes but not shared_ptr).  So I'm still careful here and I
> would like opening this subject before anything else.

I forgot to say in the case of the list, if you set n1.next to 0 then you 
will not be able iterating on to n2, etc.


-Phil





More information about the Libstdc++ mailing list