Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-05-04 21:58:23


Without seeing the code I can only speculate. But from your description I
suspect the following:

Eyal Susser wrote:
> Hi,
> I'm using the serialization library, but have encountered problems.
>
> I have an archiver that I use with a stringstream to serialize
> objects. I write some ints to the archive using "ar << my_int", and
> finally I archive a derived class wi ar << derived. So far, so good.

Is the derived class archived through a pointer? if so is that a pointer to
the base class?

>
> In a different process, I create an input archiver, read the integers,
> and then pass the archiver to a different method, where I create an
> instance of the class I serialized and use "ar >> instance". This
> throws an exception.

If it was save trough a pointer, it shouldn't be explicitly created - the
serialization library does that.

Rule: If saved through a pointer, it must be loaded to a pointer

Rule: loads must use the exact same data type as the corresponding save.

I don't know if this helps, but at least you know we care.

Robert Ramey


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