[serialization] using boost::serialization::collection_size_type and backwards compatibility

An observant colleague has noticed that Boost.MultiIndex serialization uses std::size_type instead of the adviced boost::serialization::collection_size_type: https://svn.boost.org/trac/boost/ticket/3365 My question is: if I just change std::size_type with boost::serialization::collection_size_type in Boost.MultiIndex serialization code, will backwards compatibility be preserved, i.e. will users be able to load archives saved with the old std::size_type variant? If not, what's the suggested way to handle this issue? Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

On Sep 2, 2009, at 8:15 AM, joaquin@tid.es wrote:
An observant colleague has noticed that Boost.MultiIndex serialization uses std::size_type instead of the adviced boost::serialization::collection_size_type:
https://svn.boost.org/trac/boost/ticket/3365
My question is: if I just change std::size_type with boost::serialization::collection_size_type in Boost.MultiIndex serialization code, will backwards compatibility be preserved, i.e. will users be able to load archives saved with the old std::size_type variant? If not, what's the suggested way to handle this issue?
The suggested way is to bump the version number of your class and check the archive version when deserializing Matthias

Matthias Troyer escribió:
On Sep 2, 2009, at 8:15 AM, joaquin@tid.es wrote:
An observant colleague has noticed that Boost.MultiIndex serialization uses std::size_type instead of the adviced boost::serialization::collection_size_type:
https://svn.boost.org/trac/boost/ticket/3365
My question is: if I just change std::size_type with boost::serialization::collection_size_type in Boost.MultiIndex serialization code, will backwards compatibility be preserved, i.e. will users be able to load archives saved with the old std::size_type variant? If not, what's the suggested way to handle this issue?
The suggested way is to bump the version number of your class and check the archive version when deserializing
In my particular case I'd have to bump the version number for a class *template*. Is there a documented way to do so, given that BOOST_CLASS_VERSION does work only for class instances? Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 joaquin@tid.es wrote:
Matthias Troyer escribió:
On Sep 2, 2009, at 8:15 AM, joaquin@tid.es wrote:
An observant colleague has noticed that Boost.MultiIndex serialization uses std::size_type instead of the adviced boost::serialization::collection_size_type:
https://svn.boost.org/trac/boost/ticket/3365
My question is: if I just change std::size_type with boost::serialization::collection_size_type in Boost.MultiIndex serialization code, will backwards compatibility be preserved, i.e. will users be able to load archives saved with the old std::size_type variant? If not, what's the suggested way to handle this issue?
The suggested way is to bump the version number of your class and check the archive version when deserializing
In my particular case I'd have to bump the version number for a class *template*. Is there a documented way to do so, given that BOOST_CLASS_VERSION does work only for class instances?
namespace boost { namespace serialization { template <typename T> struct version<YourTemplate<T> > { typedef boost::mpl::integral_c_tag tag; typedef boost::mpl::int_<'your version integer here'> type; BOOST_STATIC_CONSTANT(unsigned int, value = type::value); } } } Works for me. Tedious, I agree, but... /Brian Riis -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqfitYACgkQk1tAOprY6QEq+ACg6EYEZ03Vh8KskIq7W23zZgsD zMoAoOL9/GbhqngnaNxR0q+WHqFcQhF3 =9Lq1 -----END PGP SIGNATURE-----
participants (3)
-
Brian Ravnsgaard Riis
-
joaquin@tid.es
-
Matthias Troyer