Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Writing an old version of a class
From: Richard L. Aurbach (rick_at_[hidden])
Date: 2011-07-15 12:28:30


Don,

I can't speak to what support is present in boost serialization, but I have a lot of code that needs to deal with multiple versions of classes or data structures. I've found that the best way to deal with that is to store a version number as a data member and then handle the schema evolution internally in the class. In general, it is the responsibility of a class to handle older versions "appropriately" whatever that means to you in your context. If the version number is the FIRST data member of the class (in an I/O or serialization context), then you can easily write code to handle multiple versions during I/O and/or serialization.

Just my $0.02.

Cheers,

Rick Aurbach
Aurbach & Associates, Inc.

On Jul 15, 2011, at 11:00 AM, boost-users-request_at_[hidden] wrote:

> From: Don <dm413-boost_at_[hidden]>
> Date: July 15, 2011 7:27:07 AM CDT
> To: "boost-users_at_[hidden]" <boost-users_at_[hidden]>
> Subject: [Boost-users] [Serialization] Writing an old version of a class
> Reply-To: "boost-users_at_[hidden]" <boost-users_at_[hidden]>
>
>
> I apologize if this is a duplicate posting. I sent this 2 days ago, and it appears in the archives, but I never received it back from the list and there have been no replies, so I am posting it again.
>
> Using boost serialization, I would like to be able to write an old version of a class, so that I can save data in an "old" format to allow other users with an old version of my program to read the file.
>
> I see from the archives that this has come up before, and Robert Ramey indicated it was doable and on the todo list, but I don't see it in the release notes or documentation. Did anything every come of this?
>
> Or, has anyone else done this? Any suggestions on how to accomplish this?
>
> Thanks,
>
> Don



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