|
Boost : |
From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2004-04-27 12:53:50
> > > The main problem I had was that certain member variable weren't
> > > accessible. The STL collections don't have that issue so
> there was no
> > > problem.
>
> > Sorry if this is silly question, but why would you need an
> access to
> > the counter? IMO we should be able to save/load shared_ptr without
> > need to save it.
>
> I checked the code (which was written some time ago) and the
> answer to that question isn't obvious to me. I do remember
> starting with the idea that it wouldn't be necessary to look
> beyond shared_ptr but I had to just keep adding on to make
> things work. The implementation of shared_ptr is A LOT more
> involved that one would guess.
>
> My implementation of shared_ptr implementation may not be the
> only or best one. It is pretty straight forward however in
> that it follows the chain of composition - which includes
> shared_count.
>
> Sorry I can't give a better answer.
>
> Robert Ramey
There is another counter to direct counter using (I just think out loud -
it may be that you ok): what if I do not save all of the shared_ptr to the
same object? What will happened once they will get restored? Wouldn't it
cause memory leak?
I do realize that any other solution would be more complicated, but I think
we should go for it.
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk