Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-11-18 00:06:27

"Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> wrote in message
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:000a01c4ccd5$f1906910$6501a8c0_at_pdimov2...
> > Robert Ramey wrote:
> > > Alternatively, you might want to consider expanding the shared_ptr
> > > interface with enough information to permit serialization to be
> > > implemented via the public interface.
> >
> > How, exactly? The current public interface is good enough for my
> > serialization/deserialization needs, but I'm willing to consider your
> > suggestions.
> Do you remember out discussion on the subject.
> I still believe We dont need any modification in shared_ptr to make it
> serializable (even more I believe it's evil od request one). I don't
> remember ever your answer on my last post.

evil to REQUEST a modification - wow. Don't even look at the hack I had to
do - I might get the death penalty!

I thought about a little more. If I rememeber correctly the essense of the
problem during de-serialization was:

template<class Archive, class T>
void serialize(Archive &ar, shared_ptr<T> & t){
    T * raw_ptr;
    ar >> raw_ptr;
    t = shared_ptr(raw_ptr); // problem is here - not matched with other
shared pointers that might point to raw_ptr
    // current shared_ptr implementation depends upon an internal pointer to
a shared count.

Attempts to resolve this all ended up re-implementing some aspect of the
serialization library. I didn't really consider modifying the library to
expose the relevant aspects IT'S implementation. That would entail much
more than changing a private to public or adding a friend. As far as I was
concerned - implementing the the library once was enough. The
implementation I made is straight forward and is compatible with all aspects
of the serialization library including exported pointers, pointers to
polymorphic base classes, non-default and private constructors - everything.

So maybe we can consider a practical compromise.

a) Grant me access to the internals of shared_ptr for now

b) When someone comes up with more satisfactory implementation of
serialization of boost::shared_ptr and its passes a mini-review - the
current one can be deprecated and the new one can be used.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at