Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55994 - trunk/boost
From: joaquin_at_[hidden]
Date: 2009-09-03 08:12:00


Author: joaquin
Date: 2009-09-03 08:11:59 EDT (Thu, 03 Sep 2009)
New Revision: 55994
URL: http://svn.boost.org/trac/boost/changeset/55994

Log:
fixed #3365
Text files modified:
   trunk/boost/multi_index_container.hpp | 39 +++++++++++++++++++++++++++++++++++++++
   1 files changed, 39 insertions(+), 0 deletions(-)

Modified: trunk/boost/multi_index_container.hpp
==============================================================================
--- trunk/boost/multi_index_container.hpp (original)
+++ trunk/boost/multi_index_container.hpp 2009-09-03 08:11:59 EDT (Thu, 03 Sep 2009)
@@ -44,8 +44,10 @@
 
 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
 #include <boost/multi_index/detail/archive_constructed.hpp>
+#include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/nvp.hpp>
 #include <boost/serialization/split_member.hpp>
+#include <boost/serialization/version.hpp>
 #include <boost/throw_exception.hpp>
 #endif
 
@@ -630,8 +632,15 @@
   template<class Archive>
   void save(Archive& ar,const unsigned int version)const
   {
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ const serialization::collection_size_type s(size_());
+ ar<<serialization::make_nvp("count",s);
+#else
     const std::size_t s=size_();
     ar<<serialization::make_nvp("count",s);
+#endif
+
     index_saver_type sm(bfm_allocator::member,s);
 
     for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){
@@ -650,8 +659,21 @@
 
     clear_();
 
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ serialization::collection_size_type s;
+ if(version<1){
+ std::size_t sz;
+ ar>>serialization::make_nvp("count",sz);
+ s=sz;
+ }
+ else{
+ ar>>serialization::make_nvp("count",s);
+ }
+#else
     std::size_t s;
     ar>>serialization::make_nvp("count",s);
+#endif
+
     index_loader_type lm(bfm_allocator::member,s);
 
     for(std::size_t n=0;n<s;++n){
@@ -1076,6 +1098,23 @@
 
 } /* namespace multi_index */
 
+#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)&&\
+ !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+/* Serialization class version bump as we now serialize the size
+ * through boost::serialization::collection_size_type.
+ */
+
+namespace serialization {
+template<typename Value,typename IndexSpecifierList,typename Allocator>
+struct version<
+ boost::multi_index_container<Value,IndexSpecifierList,Allocator>
+>
+{
+ BOOST_STATIC_CONSTANT(unsigned int,value=1);
+};
+} /* namespace serialization */
+#endif
+
 /* Associated global functions are promoted to namespace boost, except
  * comparison operators and swap, which are meant to be Koenig looked-up.
  */


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