Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55415 - trunk/boost/serialization
From: troyer_at_[hidden]
Date: 2009-08-04 19:00:11


Author: troyer
Date: 2009-08-04 19:00:10 EDT (Tue, 04 Aug 2009)
New Revision: 55415
URL: http://svn.boost.org/trac/boost/changeset/55415

Log:
Fixed ticket 2271
Text files modified:
   trunk/boost/serialization/vector.hpp | 17 ++++++++++++-----
   trunk/boost/serialization/vector_135.hpp | 8 +++-----
   2 files changed, 15 insertions(+), 10 deletions(-)

Modified: trunk/boost/serialization/vector.hpp
==============================================================================
--- trunk/boost/serialization/vector.hpp (original)
+++ trunk/boost/serialization/vector.hpp 2009-08-04 19:00:10 EDT (Tue, 04 Aug 2009)
@@ -21,6 +21,7 @@
 
 #include <boost/config.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/type_traits/is_arithmetic.hpp>
 
 #include <boost/serialization/collections_save_imp.hpp>
 #include <boost/serialization/collections_load_imp.hpp>
@@ -30,8 +31,8 @@
 #include <boost/mpl/bool.hpp>
 
 // default is being compatible with version 1.34.1 files, not 1.35 files
-#ifndef BOOST_SERIALIZATION_VECTOR_VERSION
-#define BOOST_SERIALIZATION_VECTOR_VERSION 4
+#ifndef BOOST_SERIALIZATION_VECTOR_VERSIONED
+#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V==4 || V==5)
 #endif
 
 namespace boost {
@@ -82,8 +83,6 @@
 ){
     const collection_size_type count(t.size());
     ar << BOOST_SERIALIZATION_NVP(count);
- const unsigned int item_version = version<U>::value;
- ar << BOOST_SERIALIZATION_NVP(item_version);
     if (!t.empty())
         ar << make_array(detail::get_data(t),t.size());
 }
@@ -99,8 +98,9 @@
     ar >> BOOST_SERIALIZATION_NVP(count);
     t.resize(count);
     unsigned int item_version=0;
- if(BOOST_SERIALIZATION_VECTOR_VERSION < ar.get_library_version())
+ if(BOOST_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) {
         ar >> BOOST_SERIALIZATION_NVP(item_version);
+ }
     if (!t.empty())
         ar >> make_array(detail::get_data(t),t.size());
   }
@@ -126,6 +126,13 @@
     std::vector<U, Allocator> &t,
     const unsigned int file_version
 ){
+#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP
+ if (ar.get_library_version()==5)
+ {
+ load(ar,t,file_version, boost::is_arithmetic<U>());
+ return;
+ }
+#endif
     typedef BOOST_DEDUCED_TYPENAME
     boost::serialization::use_array_optimization<Archive>::template apply<
         BOOST_DEDUCED_TYPENAME remove_const<U>::type

Modified: trunk/boost/serialization/vector_135.hpp
==============================================================================
--- trunk/boost/serialization/vector_135.hpp (original)
+++ trunk/boost/serialization/vector_135.hpp 2009-08-04 19:00:10 EDT (Tue, 04 Aug 2009)
@@ -13,14 +13,12 @@
 #ifndef BOOST_SERIALIZATION_VECTOR_135_HPP
 #define BOOST_SERIALIZATION_VECTOR_135_HPP
 
-
-
-#ifdef BOOST_SERIALIZATION_VECTOR_VERSION
+#ifdef BOOST_SERIALIZATION_VECTOR_VERSIONED
 #if BOOST_SERIALIZATION_VECTOR_VERSION != 4
-#error Boost.Serialization cannot be compatible with both 1.34.1. and 1.35 files. Please include boost/serialization/vector_135.hpp before vector.hpp to be compatible with 1.35 files
+#error Boost.Serialization cannot be compatible with both 1.35 and 1.36-1.40 files
 #endif
 #else
-#define BOOST_SERIALIZATION_VECTOR_VERSION 4
+#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V==4)
 #endif
 
 #include <boost/serialization/vector.hpp>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk