How to update object with Boost Serialization?

165 Views Asked by At

Say we had a class with std::map<string, string> in it. Say we had an instance of it with data like [Jon : Smith; Sara : O'Connel]. We serialized it and puted into archive. Now we created another instance of it with such map contents [Jon : AnotherSmith; Brian : Gor]. We serialized it and puted into archive. Now we have 2 archives!) I wonder how we could deserialize tham 2 into one object instance, how we could set data from which archive overrites which say we want to get: [ Sara : O'Connel; Jon : AnotherSmith; Brian : Gor]?

1

There are 1 best solutions below

0
On

Write a class that holds the map and serialize that instead. in your serialize function (or load/save), you can then copy the map serialization code from boost and customize it to implement your overwriting requirements.