
----- Mensaje original ----- De: Robert Ramey <ramey@rrsd.com> Fecha: Miércoles, Diciembre 1, 2004 10:15 pm Asunto: [boost] Re: Re: [multi_index] announce: serialization support [snip]
If you guarentee that the container itself is always serialized before your indices, then de-serialization of the indices would automatically be reduced to providing the original (tracked) pointer. In such a case, I would think the whole isse would never appear and that the implementation would be very straight forward.
I think this is not correct (but I'd like to be proven wrong, that'd mean I could simplify my code.) Consider this: struct foo { std::list<std::string> cont; std::string* pos; // pos points to an element of cont private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int) { ar&cont; // before pos, as you suggest ar&pos; } }; My thesis is that loading a foo will get it wrong --pos won't be pointing to an element of cont, but rather to some random address in stack memory. I'll check it out on my compiler tomorrow, but I was already through this when designing multi_index serialization. See my point now? Am I missing something? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo