Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-05-13 09:55:22

Henrik Jacobsson wrote:
>> cyclic objects can't be serialized. cyclic object pointers can be
>> serialized with no special effort.
> A simple, and probably naive, idea... Since pointers mean no problems
> and objects do, would it not be possible to have an option
> "serialize_object_as_pointer" and for containers
> "serialize_members_as_pointers" in the library, as a means to
> circumvent this? That way one would not have to change the
> implementation of all containers of cyclic objects into containers of
> pointers...

I don't think this would work for a couple of reasons - mainly that if you
save objects that arn't pointers, the loader would create pointers and you
wouldn't have the same thing that you started with.

> Alternatively, or additionally, within the cyclic object themselves,
> it would be nice if it was possible to serialize the pointer without
> serializing its contents, i.e. creating only an index in the archive,
> making it up to the user to make sure that the object is later
> serialized with that index to adress it.

That's more or less how the serialization of pointers works now - and that's
why it DOES work.

Robert Ramey

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at