Boost logo

Boost Users :

Subject: [Boost-users] [serialization][Fwd: Re: Saving and reloading a container to/from disk]
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-03-31 15:21:57


I've forwarded this from comp.lang.c++. The OP has tried the demo.cpp
example (I think), and is getting results different from those the demo
says are expected. This is related to versioning... but I'm confused as
to what should be the result.

Jeff

-------- Original Message --------
Subject: Re: Saving and reloading a container to/from disk
Date: Wed, 31 Mar 2010 13:59:16 +0200
From: jacob navia <jacob_at_[hidden]>
Reply-To: jacob_at_[hidden]
Organization: lccwin
Newsgroups: comp.lang.c++
References: <4bb2e6b3$0$15818$ba4acef3_at_[hidden]>
<81gc4oFua5U6_at_[hidden]>

Ian Collins a écrit :
> On 03/31/10 07:07 PM, jacob navia wrote:
>> Hi
>>
>> What would be the best way to save and reload later a container
>> to/from disk in C++?
>
> It depends, there isn't really a best way. Do you want portability?
>
> http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html
>
> Is a good place to start.
>

Thanks.

I downloaded the boost libraries, and compiled them in my machine.
Unziped the source code is 269MB. Compilation took 14 minutes.

Machine Mac-pro OS X with 8 CPUs and 12GB RAM.

Then, I compiled the example of the serialization.
The class being saved/restored looks like this:

original schedule
6:24 bob
0x0x100200440 34?135'52.56" 134?22'78.3" 24th Street and 10th Avenue
0x0x1002004d0 35?137'23.456" 133?35'54.12" State street and Cathedral
Vista Lane
0x0x100200530 35?136'15.456" 133?32'15.3" White House

when restored, the restored stuff looks like this:
6:24
0x0x100200e30 34?135'52.56" 134?22'78.3" 24th Street and 10th Avenue
0x0x100200f40 35?137'23.456" 133?35'54.12" State street and Cathedral
Vista Lane
0x0x1002012c0 35?136'15.456" 133?32'15.3" White House

As you can see the name "bob" is missing.

The same bug appears with all other saved/restored class instances.
I am not fluent in C++ to figure out this, sorry.

But maybe this is a bug in the example, I can't determine what
is the reason.

jacob


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