serializationboostversionversioningboost-serialization

How does Boost Serialization Versioning work?


Can someone explain to me how the versioning in Boost Serialization works. The archive version is always 10 and the class version 0. I thought that the version is automatically incremented when the archive is different then the last version. Do I have to define the version number by myself if I changed something?

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="10">
    <EventSet class_id="0" tracking_level="0" version="0">
        <Size>1</Size>
        <Event>
        ...
        </Event>
    </EventSet>
</boost_serialization>

Solution

  • It is not described in Boost documentation but the line boost_serialization signature="serialization::archive" version="10" corresponds to the version of Boost.Archive library, it sometimes changes when new version of Boost becomes available.

    As documentation explains, the line EventSet class_id="0" tracking_level="0" version="0" corresponds to the class version. You can change it in your code with a macro 'BOOST_CLASS_VERSION(EventSet, 1)'.