Boost logo

Boost Users :

Subject: [Boost-users] [repost][serialization] version handling in {save|load}_construct_data
From: JOAQUIN M. LOPEZ MUÑOZ (joaquin_at_[hidden])
Date: 2010-01-09 13:19:44


Hello, allow me to repost this message from a couple of
weeks ago:

I've taken a look at how the version number is dealt with
in Boost.Serialization collection serialization code:

* The relevant code at saving time is:

    if(3 < ar.get_library_version()){
        const unsigned int item_version = version<
            BOOST_DEDUCED_TYPENAME Container::value_type
>::value;
        ar << BOOST_SERIALIZATION_NVP(item_version);
    }

* At loading time, the equivalent code is:

    unsigned int item_version;
    ar >> BOOST_SERIALIZATION_NVP(count);
    if(3 < ar.get_library_version())
        ar >> BOOST_SERIALIZATION_NVP(item_version);
    else
        item_version = 0;
Can someone (aka Robert :-) ) shed some light on this bit?
Why the version number has to be given such manual processing
when this is not needed if, for instance, serializating
values via the simple ar&value?
I'm trying to do the equivalent thing in Boost.MultiIndex.

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo



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