Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-05-11 01:26:18


This should work - How is your case different that test_cycle.cpp ?

The pointer conflict means that something has been serializaed as first as a
pointer then as an object. Normally this should be easily avoidable. This
is flagged as an error because the de-serialization would be a problem.
First the deserialization of a pointer creates an object - next the object
itself is re-loaded - but now we have two objects when we started with one.

Robert Ramey

Henrik Jacobsson wrote:
> Hi!
>
> I want to serialize objects that link to each other through pointers,
> like a linked list, but in this case a more complex graph with
> several different classes and proxies (a graph which can contain
> loops and and null-pointers).
>
> But I get the "pointer conflict" exception since the serialization
> discovers that an object have been serialized once before through its
> pointer. The contents should be serialized/deserialized only once,
> and then the pointers should just be kept consistent.
>
> An alternative is of course to replace all the pointers with indeces
> which are memory-independent. But that's a messy affair.
>
> In the copy constructor I solved something similar through a
> map<Type*,Type*> which mapped from the old pointers to the newly
> allocated ones, so that they could be properly replaced. Is something
> like this hidden somewhere in the lib?
>
> Any suggestions?
>
> Best regards,
> Henrik Jacobsson


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net