Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2005-01-26 00:32:35

----- Mensaje original -----
De: Robert Ramey <ramey_at_[hidden]>
Fecha: Miércoles, Enero 26, 2005 1:12 am
Asunto: [boost] Re: Re: [Serialization] of pointers into a vector

> > ----- Mensaje original -----
> > Of course, an extension to Boost.Serialization would
> > be better --something along a facility to instruct
> > the serialization lib to change the tracking address
> > of an object when this is moved around.
> >
> I don't think it will be all that hard once its apparent what the
> problemis. (Of course that's what I always think - that's my problem)
> my current thinking is to implement something like
> template<class Archive, class T>
> common_iarchive<Archive>::move(T & dest, T & source)
> which would do the assignment and update the tracking information.
> Then use
> it in the de-serializaton of all the collections.

This particular interface, if I'm not wrong, is of no use for
the collections case, since the assignment is done internally
by the container. At least, you need a similar facility that
only does the tracking thing:

template<class Archive, class T>
common_iarchive<Archive>::move_track(T * dest, T * source) // no

While we are at it, it could be good to have something
along this line for a different but related situation:
sometimes it can be necessary to serialize pointers to
objects which are *not* serialized themselves (i.e. they
are reconstructed by some other means.) This can be
achieved with something like:

template<class Archive, class T>
common_iarchive<Archive>::set_track(T * p)

which allows the object pointed by p to be tracked
(that is, pointers to it can be serialized) without
attempting to load/save the object itself.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

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