How to handle changes in the structure of classes and be backward compatible with data / objects serialized with boost?

I have the task of adding members to a C ++ class that uses

boost::serialization::access

Objects are stored in text files and read.

However, I need to be backward compatible, and the new bool member needs to be serialized.

I need to allow the new code to read old files and write only the new format.

In particular, serialized files are missing a new data item. This throws an exception when reading.

How can I do this? / What suggestions / mechanisms allow this to be done?

I would suggest that there is a pattern or a known way to handle this, and I'm not sure what it could be.

(Of course, people writing the promotion code understood that the code / objects would change, and the old files should be processed with the new code / object)

+1
source share
1 answer

The serialization extension supports versions. See the following links: Link # 1 , Link # 2, and example .

+2
source

All Articles