|
Boost Users : |
Subject: Re: [Boost-users] [Serialization] Writing an old version of a class
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-07-15 13:37:45
Richard L. Aurbach wrote:
> 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.
This is exactly the way it's handled by the serialization library. The
only difference is that the version # is included by default rather
than the programmer having to explicitly do it.
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