Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-08-16 14:42:54


> > > The idea is just that weak_ptr goes to null when the last shared_ptr
> > > goes away, so they stay in the map until overwritten or erased.
>
> That's what I have been doing so far with containers of live_ptrs.
>
> What I want is to extend and formalize this - I am getting tired of coding
> up things like
> if( *iter == 0 ) iter++
> for all of the various containers that I have set up.
>
> I basically want to hide the deletion of null pointers from the container.
>
> You can always do this by creating a single sweep-and-delete method,
> called whenever you aren't prepared to handle null pointers,
> but I am hoping that there is some way that the deletion can be totally
> hidden, totally transparent.

Well, as we have been discussing, you can either wrap up all the
containers, or write just one wrapper for any iterator. I'll add
the latter to my to-do list for weak_ptr.


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