Re:[boost] Re: Re:A question on serialization library

Virendra Verma wrote:
Library woundn't care but the user would. For example, how would user delete or modify the object (pointed by pointer in the class) once loaded since user has no way of knowing how the object was allocated? My understanding is that the library creates and owns the object (using some kind of class factory) when loading from input stream unless user keeps a common allocator and somehow binds it to library's serializer.
If a class has a pointer to an object, how does class know that the pointer was created by library or the class itself before serialization?
It doesn't. Why would it need to?
Robert Ramey
The guiding principle behind saving/loading pointers is that the loaded set of C++ structures is exactly equivalent to the original ones that were saved. So issues regarding pointer ownership don't change. That is, whatever ownership policy that was used when the pointer was saved will be the same one that can be used for the set of C++ structures recovered. The only problem would be where the there are pointers that are not included in the set of serialized data. As long as the serialized set is complete and self-contained there should be no problem. That is, there should be no pointers pointing into the serialized data that are themselves not serialized. Robert Ramey
participants (1)
-
Robert Ramey