Date: 2001-05-26 10:04:09
--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: <williamkempf_at_h...>
> > > OK. Do you agree that it is a real problem? How would you solve
> > (I mean
> > > the problem with serializing a shared_ptr.)
> > Using the same techniques I'd use if raw pointers were being used
> > instead.
> Raw pointers can't be serialized in the general case. You don't
> the pointer owns the object.
Every persistence library I've used serializes raw pointers (at least
such pointers to serializesable objects).
> > Seriously, the example given is a very non-trivial example
> > and knowing if an object has been previously serialized is not
> > to be enough info to persist the containing object any way.
> It's enough info for me:
> int last_id = 0;
> std::map<shared_ptr_id, int> m;
This right above is the extra "database" I referred to. Knowing if
an object had been previously serialized was not enough, you had to
track more in the object identity in order to be able to recreate the
web on reading.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk