Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-04 15:25:51


Leon Mergen wrote:

>> So eventually the serialization resolves to a string of calls to
>> primitive types - all of which are supported by the archive class.
>
> Ok, sounds logical. What about objects from the stdlib, such as
> std::string ? I assume this function does not have a serialize()
> function, but in some prototypes I created I noticed that this worked
> perfectly.

I gave you the short version - the long version can be found in the manual
which describes how to make a type serializable in a non-intrusive way.

> Yes, I saw that in an example on the documentation. Looks like a great
> feature!

Indispensible in my opinion - otherwise there would be no way t read old
archives if a class definition changed.

> Ok, but then, out of curiosity, how does it know when to stop reading

Reading stops when no more data is required. . That is, data is only read
when required, and it should be required if and only i \t was saved. Saved
data and loaded must be kept exactly the same length. So each save function
must exactly match it load counter part in length. This is usually easily
addressed by using the & operator for most serialized classes.

> Yes, and I assume this will be a very hard task making it portable.

I'm not sure how hard it would be to do it for a specific application. But
it would require a detailed understanding of the library

> Ok, guess I'll look further away from serializations for a solution...

God Luck

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