Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62546 - in trunk/boost: archive archive/impl serialization
From: ramey_at_[hidden]
Date: 2010-06-07 23:26:13


Author: ramey
Date: 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
New Revision: 62546
URL: http://svn.boost.org/trac/boost/changeset/62546

Log:
fix #2 for version_type
Text files modified:
   trunk/boost/archive/archive_exception.hpp | 5
   trunk/boost/archive/basic_archive.hpp | 182 ++++++++++++++++++++++++++-------------
   trunk/boost/archive/basic_binary_iprimitive.hpp | 4
   trunk/boost/archive/basic_binary_oprimitive.hpp | 4
   trunk/boost/archive/basic_text_iarchive.hpp | 18 +++
   trunk/boost/archive/basic_text_iprimitive.hpp | 2
   trunk/boost/archive/basic_text_oarchive.hpp | 30 +-----
   trunk/boost/archive/basic_text_oprimitive.hpp | 20 +---
   trunk/boost/archive/impl/basic_binary_iarchive.ipp | 3
   trunk/boost/archive/impl/basic_text_iarchive.ipp | 8 -
   trunk/boost/archive/impl/basic_text_iprimitive.ipp | 2
   trunk/boost/archive/impl/basic_text_oprimitive.ipp | 2
   trunk/boost/archive/impl/basic_xml_grammar.hpp | 9 +
   trunk/boost/archive/impl/basic_xml_iarchive.ipp | 10 +-
   trunk/boost/archive/polymorphic_iarchive.hpp | 12 +-
   trunk/boost/archive/xml_iarchive.hpp | 9 -
   trunk/boost/archive/xml_oarchive.hpp | 6 +
   trunk/boost/archive/xml_wiarchive.hpp | 1
   trunk/boost/archive/xml_woarchive.hpp | 5 +
   trunk/boost/serialization/collection_size_type.hpp | 37 +++++++
   trunk/boost/serialization/collections_load_imp.hpp | 2
   trunk/boost/serialization/item_version_type.hpp | 20 +--
   22 files changed, 234 insertions(+), 157 deletions(-)

Modified: trunk/boost/archive/archive_exception.hpp
==============================================================================
--- trunk/boost/archive/archive_exception.hpp (original)
+++ trunk/boost/archive/archive_exception.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -61,7 +61,7 @@
         incompatible_native_format, // attempt to read native binary format
                             // on incompatible platform
         array_size_too_short,// array being loaded doesn't fit in array allocated
- stream_error, // i/o error on stream
+ input_stream_error, // error on input stream
         invalid_class_name, // class name greater than the maximum permitted.
                             // most likely a corrupted archive or an attempt
                             // to insert virus via buffer overrun method.
@@ -70,8 +70,9 @@
         unsupported_class_version, // type saved with a version # greater than the
                             // one used by the program. This indicates that the proggram
                             // needs to be rebuilt.
- multiple_code_instantiation // code for implementing serialization for some
+ multiple_code_instantiation, // code for implementing serialization for some
                             // type has been instantiated in more than one module.
+ output_stream_error // error on input stream
     } exception_code;
 protected:
     std::string m_msg;

Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -26,40 +26,6 @@
 #include <boost/archive/detail/auto_link_archive.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
-#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
-namespace boost { \
-namespace archive { \
-BOOST_STRONG_TYPEDEF(T, D) \
-} /* archive */ \
-template<> \
-class integer_traits<boost::archive::D> : \
- public integer_traits<boost::T> \
-{}; \
-} /* boost */ \
-/**/
-
-/* NOTE : Warning : Warning : Warning : Warning : Warning
- * Don't ever changes this. If you do, they previously created
- * binary archives won't be readable !!!
- */
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least16_t, library_version_type)
-
-/* NOTE : Warning : Warning : Warning : Warning : Warning
- * If any of these are changed to different sized types,
- * binary_iarchive won't be able to read older archives
- * unless you rev the library version and include conditional
- * code based on the library version. There is nothing
- * inherently wrong in doing this - but you have to be super
- * careful because it's easy to get wrong and start breaking
- * old archives !!!
- */
-//BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least8_t, version_type)
-//BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_optional_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_reference_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_id_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_reference_type)
-
 namespace boost {
 namespace archive {
 
@@ -68,28 +34,65 @@
 #pragma warning( disable : 4244 4267 )
 #endif
 
-struct version_type
- : boost::totally_ordered1< version_type
- , boost::totally_ordered2< version_type, uint_least8_t
- > >
-{
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * Don't ever changes this. If you do, they previously created
+ * binary archives won't be readable !!!
+ */
+class library_version_type {
+private:
+ typedef uint_least16_t base_type;
+ base_type t;
+public:
+ library_version_type(): t(0) {};
+ explicit library_version_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ library_version_type(const library_version_type & t_) :
+ t(t_.t)
+ {}
+ library_version_type & operator=(const library_version_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const unsigned int () const {
+ return t;
+ }
+ // used for text output
+ operator uint_least16_t & (){
+ return t;
+ }
+ bool operator==(const library_version_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const library_version_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+BOOST_ARCHIVE_DECL(library_version_type)
+BOOST_ARCHIVE_VERSION();
+
+class version_type {
+private:
     typedef uint_least8_t base_type;
     base_type t;
- version_type(){};
- version_type(const version_type & t_) : t(t_.t){}
+ version_type(): t(0) {};
+public:
     explicit version_type(const unsigned int & t_) : t(t_){
         assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
+ version_type(const version_type & t_) :
+ t(t_.t)
+ {}
     version_type & operator=(const version_type & rhs){
         t = rhs.t;
         return *this;
     }
- operator const base_type () const {
+ // used for text output
+ operator const unsigned int () const {
         return t;
     }
- operator base_type & (){
- return t;
- }
     bool operator==(const version_type & rhs) const {
         return t == rhs.t;
     }
@@ -98,31 +101,34 @@
     }
 };
 
-struct class_id_type
- : boost::totally_ordered1< class_id_type
- , boost::totally_ordered2< class_id_type, int_least16_t
- > >
-{
+class class_id_type {
+private:
     typedef int_least16_t base_type;
     base_type t;
- class_id_type(){};
- class_id_type(const class_id_type & t_) : t(t_.t){}
- explicit class_id_type(const std::size_t & t_) : t(t_){
- //assert(t_ <= boost::integer_traits<base_type>::const_max);
+public:
+ class_id_type() : t(0) {};
+ explicit class_id_type(const int t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ explicit class_id_type(const std::size_t t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
- explicit class_id_type(const int & t_) : t(t_){}
+ class_id_type(const class_id_type & t_) :
+ t(t_.t)
+ {}
     class_id_type & operator=(const class_id_type & rhs){
         t = rhs.t;
         return *this;
     }
 
- // used for standard i/o
- operator const base_type () const {
+ // used for text output
+ operator const int () const {
         return t;
     }
- operator base_type & (){
+ // used for text input
+ operator int_least16_t &() {
         return t;
- }
+ }
     bool operator==(const class_id_type & rhs) const {
         return t == rhs.t;
     }
@@ -133,6 +139,38 @@
 
 #define NULL_POINTER_TAG boost::archive::class_id_type(-1)
 
+class object_id_type {
+private:
+ typedef uint_least32_t base_type;
+ base_type t;
+public:
+ object_id_type(): t(0) {};
+ explicit object_id_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ object_id_type(const object_id_type & t_) :
+ t(t_.t)
+ {}
+ object_id_type & operator=(const object_id_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const unsigned int () const {
+ return t;
+ }
+ // used for text input
+ operator uint_least32_t & () {
+ return t;
+ }
+ bool operator==(const object_id_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const object_id_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
 #if defined(_MSC_VER)
 #pragma warning( pop )
 #endif
@@ -198,20 +236,40 @@
 BOOST_ARCHIVE_DECL(const char *)
 BOOST_ARCHIVE_SIGNATURE();
 
-BOOST_ARCHIVE_DECL(library_version_type)
-BOOST_ARCHIVE_VERSION();
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * If any of these are changed to different sized types,
+ * binary_iarchive won't be able to read older archives
+ * unless you rev the library version and include conditional
+ * code based on the library version. There is nothing
+ * inherently wrong in doing this - but you have to be super
+ * careful because it's easy to get wrong and start breaking
+ * old archives !!!
+ */
+
+#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
+ class D : public T { \
+ public: \
+ explicit D(const T t) : T(t){} \
+ }; \
+/**/
+
+
+BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type)
+BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type)
+BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type)
 
 }// namespace archive
 }// namespace boost
 
 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
 
+#if 0
 namespace boost {
 template<>
 class integer_traits<boost::archive::class_id_type> :
     public integer_traits<boost::archive::class_id_type::base_type>
 {};
-} // namespace boost
+#endif
 
 #include <boost/serialization/level.hpp>
 

Modified: trunk/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_binary_iprimitive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -162,7 +162,7 @@
     );
     if(scount != s)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
         );
     // note: an optimizer should eliminate the following for char files
     assert(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
@@ -176,7 +176,7 @@
         scount = m_sb.sgetn(& t, 1);
         if(scount != 1)
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
             );
         std::memcpy(static_cast<char*>(address) + (count - s), &t, s);
     }

Modified: trunk/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_oprimitive.hpp (original)
+++ trunk/boost/archive/basic_binary_oprimitive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -155,7 +155,7 @@
     // be sure that the output stream is opened with ios::binary
     //if(os.fail())
     // boost::serialization::throw_exception(
- // archive_exception(archive_exception::stream_error)
+ // archive_exception(archive_exception::output_stream_error)
     // );
     // figure number of elements to output - round up
     count = ( count + sizeof(Elem) - 1)
@@ -167,7 +167,7 @@
     );
     if(count != static_cast<std::size_t>(scount))
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
         );
     //os.write(
     // static_cast<const BOOST_DEDUCED_TYPENAME OStream::char_type *>(address),

Modified: trunk/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iarchive.hpp (original)
+++ trunk/boost/archive/basic_text_iarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -30,6 +30,8 @@
 
 #include <boost/archive/detail/common_iarchive.hpp>
 
+#include <boost/serialization/item_version_type.hpp>
+
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 #ifdef BOOST_MSVC
@@ -67,8 +69,20 @@
     // text file don't include the optional information
     void load_override(class_id_optional_type & /*t*/, int){}
 
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
- load_override(version_type & t, int);
+ void load_override(version_type & t, int){
+ unsigned int v;
+ load_override(v, 0);
+ t = version_type(v);
+ }
+ void load_override(
+ boost::serialization::item_version_type & t,
+ int
+ ){
+ unsigned int v;
+ load_override(v, 0);
+ t = boost::serialization::item_version_type(v);
+ }
+
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
     load_override(class_name_type & t, int);
 

Modified: trunk/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_iprimitive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -90,7 +90,7 @@
             return;
         }
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
         );
     }
 

Modified: trunk/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oarchive.hpp (original)
+++ trunk/boost/archive/basic_text_oarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -31,6 +31,7 @@
 
 #include <boost/archive/detail/common_oarchive.hpp>
 #include <boost/serialization/string.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
@@ -83,38 +84,17 @@
     // start new objects on a new line
     void save_override(const object_id_type & t, int){
         this->This()->newline();
- // note extra .t to funciton with Borland 5.51 compiler
- // and invoke prmitive to underlying value
- this->This()->save(t.t);
- }
-
- void save_override(const object_reference_type & t, int){
- this->This()->newline();
- // note extra .t to funciton with Borland 5.51 compiler
- // and invoke prmitive to underlying value
- this->This()->save(t.t);
+ this->detail_common_oarchive::save_override(t, 0);
     }
 
- // note the following four overrides are necessary for some borland
- // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
     void save_override(const version_type & t, int){
- // note:t.t resolves borland ambguity
- const unsigned int x = t.t;
+ const unsigned int x = t;
         * this->This() << x;
     }
- // note the following four overrides are necessary for some borland
- // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
- void save_override(const class_id_type & t, int){
- // note:t.t resolves borland ambguity
- const int x = t.t;
+ void save_override(const boost::serialization::item_version_type & t, int){
+ const unsigned int x = t;
         * this->This() << x;
     }
- void save_override(const class_id_reference_type & t, int){
- // note:t.t resolves borland ambguity
- const int x = t.t;
- * this->This() << x;
- }
-
     // text file don't include the optional information
     void save_override(const class_id_optional_type & /* t */, int){}
 

Modified: trunk/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_oprimitive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -85,7 +85,7 @@
     void save(const T &t){
         if(os.fail())
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
             );
         os << t;
     }
@@ -98,7 +98,7 @@
         assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
         if(os.fail())
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
             );
         os << t;
     }
@@ -117,11 +117,7 @@
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
     void save(const wchar_t t)
     {
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<int>(t);
+ save(static_cast<short int>(t));
     }
     #endif
     void save(const float t)
@@ -129,7 +125,7 @@
         // must be a user mistake - can't serialize un-initialized data
         if(os.fail())
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
             );
         os << std::setprecision(std::numeric_limits<float>::digits10 + 2);
         os << t;
@@ -139,7 +135,7 @@
         // must be a user mistake - can't serialize un-initialized data
         if(os.fail())
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
             );
         os << std::setprecision(std::numeric_limits<double>::digits10 + 2);
         os << t;
@@ -153,16 +149,12 @@
     void put(BOOST_DEDUCED_TYPENAME OStream::char_type c){
         if(os.fail())
             boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
             );
         os.put(c);
     }
     // unformatted append of null terminated string
     void put(const char * s){
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
         while('\0' != *s)
             os.put(*s++);
     }

Modified: trunk/boost/archive/impl/basic_binary_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iarchive.ipp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -87,8 +87,7 @@
     basic_iarchive::set_library_version(input_library_version);
     #endif
     
- // extra little .t is to get around borland quirk
- if(BOOST_ARCHIVE_VERSION() < input_library_version.t)
+ if(BOOST_ARCHIVE_VERSION() < input_library_version)
         boost::serialization::throw_exception(
             archive_exception(archive_exception::unsupported_version)
         );

Modified: trunk/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iarchive.ipp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -30,14 +30,6 @@
 
 template<class Archive>
 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
-basic_text_iarchive<Archive>::load_override(version_type & t, int){
- unsigned int v;
- load_override(v, 0);
- t = version_type(v);
-}
-
-template<class Archive>
-BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
 basic_text_iarchive<Archive>::load_override(class_name_type & t, int){
     std::string cn;
     cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);

Modified: trunk/boost/archive/impl/basic_text_iprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iprimitive.ipp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -70,7 +70,7 @@
         
     if(is.fail())
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
         );
     // convert from base64 to binary
     typedef BOOST_DEDUCED_TYPENAME

Modified: trunk/boost/archive/impl/basic_text_oprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_oprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_oprimitive.ipp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -37,7 +37,7 @@
     
     if(os.fail())
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
         );
         
     os.put('\n');

Modified: trunk/boost/archive/impl/basic_xml_grammar.hpp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_grammar.hpp (original)
+++ trunk/boost/archive/impl/basic_xml_grammar.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -169,9 +169,12 @@
     struct return_values {
         StringType object_name;
         StringType contents;
- class_id_type class_id;
- object_id_type object_id;
- version_type version;
+ //class_id_type class_id;
+ int_least16_t class_id;
+ //object_id_type object_id;
+ uint_least32_t object_id;
+ //version_type version;
+ unsigned int version;
         tracking_type tracking_level;
         StringType class_name;
         return_values() :

Modified: trunk/boost/archive/impl/basic_xml_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_xml_iarchive.ipp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -32,7 +32,7 @@
     bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is());
     if(true != result){
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
         );
     }
     // don't check start tag at highest level
@@ -49,7 +49,7 @@
     bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is());
     if(true != result){
         boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
         );
     }
     
@@ -79,19 +79,19 @@
 template<class Archive>
 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
 basic_xml_iarchive<Archive>::load_override(object_id_type & t, int){
- t = this->This()->gimpl->rv.object_id;
+ t = object_id_type(this->This()->gimpl->rv.object_id);
 }
 
 template<class Archive>
 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
 basic_xml_iarchive<Archive>::load_override(version_type & t, int){
- t = this->This()->gimpl->rv.version;
+ t = version_type(this->This()->gimpl->rv.version);
 }
 
 template<class Archive>
 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
 basic_xml_iarchive<Archive>::load_override(class_id_type & t, int){
- t = this->This()->gimpl->rv.class_id;
+ t = class_id_type(this->This()->gimpl->rv.class_id);
 }
 
 template<class Archive>

Modified: trunk/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_iarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -111,12 +111,12 @@
     // special treatment for name-value pairs.
     template<class T>
     void load_override(
- #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- const
- #endif
- boost::serialization::nvp<T> & t,
- int
- ){
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ const
+ #endif
+ boost::serialization::nvp<T> & t,
+ int
+ ){
         load_start(t.name());
         archive::load(* this->This(), t.value());
         load_end(t.name());

Modified: trunk/boost/archive/xml_iarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_iarchive.hpp (original)
+++ trunk/boost/archive/xml_iarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -23,6 +23,7 @@
 #include <boost/archive/basic_text_iprimitive.hpp>
 #include <boost/archive/basic_xml_iarchive.hpp>
 #include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
@@ -63,13 +64,11 @@
     void load(T & t){
         basic_text_iprimitive<std::istream>::load(t);
     }
- #if 0 // only if implementing back versioning
     void load(boost::serialization::item_version_type & t){
- unsigned int x;
- basic_text_iprimitive<std::istream>::load(x);
- t = boost::serialization::item_version_type(x);
+ unsigned int v;
+ basic_text_iprimitive<std::istream>::load(v);
+ t = boost::serialization::item_version_type(v);
     }
- #endif
     BOOST_ARCHIVE_DECL(void)
     load(char * t);
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T

Modified: trunk/boost/archive/xml_oarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_oarchive.hpp (original)
+++ trunk/boost/archive/xml_oarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -30,6 +30,7 @@
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_xml_oarchive.hpp>
 #include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
@@ -61,6 +62,11 @@
     void save(const T & t){
         basic_text_oprimitive<std::ostream>::save(t);
     }
+
+ void save(const boost::serialization::item_version_type & t){
+ const unsigned int x = t;
+ basic_text_oprimitive<std::ostream>::save(x);
+ }
     BOOST_ARCHIVE_DECL(void)
     save(const char * t);
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T

Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -28,7 +28,6 @@
 #include <boost/archive/basic_text_iprimitive.hpp>
 #include <boost/archive/basic_xml_iarchive.hpp>
 #include <boost/archive/detail/register_archive.hpp>
-
 #include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header

Modified: trunk/boost/archive/xml_woarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_woarchive.hpp (original)
+++ trunk/boost/archive/xml_woarchive.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -34,6 +34,7 @@
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_xml_oarchive.hpp>
 #include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
@@ -74,6 +75,10 @@
     save(const T & t){
         basic_text_oprimitive<std::wostream>::save(t);
     }
+ void save(const boost::serialization::item_version_type & t){
+ const unsigned int x = t;
+ basic_text_oprimitive<std::wostream>::save(x);
+ }
     BOOST_WARCHIVE_DECL(void)
     save(const char * t);
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T

Modified: trunk/boost/serialization/collection_size_type.hpp
==============================================================================
--- trunk/boost/serialization/collection_size_type.hpp (original)
+++ trunk/boost/serialization/collection_size_type.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -14,11 +14,42 @@
 namespace boost {
 namespace serialization {
 
-BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type)
+//BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type)
+
+class collection_size_type {
+private:
+ typedef std::size_t base_type;
+ base_type t;
+public:
+ collection_size_type(): t(0) {};
+ explicit collection_size_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ collection_size_type(const collection_size_type & t_) :
+ t(t_.t)
+ {}
+ collection_size_type & operator=(const collection_size_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const base_type () const {
+ return t;
+ }
+ // used for text input
+ operator base_type & () {
+ return t;
+ }
+ bool operator==(const collection_size_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const collection_size_type & rhs) const {
+ return t < rhs.t;
+ }
+};
 
-} } // end namespace boost::serialization
 
-BOOST_SERIALIZATION_SPLIT_FREE(collection_size_type)
+} } // end namespace boost::serialization
 
 BOOST_CLASS_IMPLEMENTATION(collection_size_type, primitive_type)
 

Modified: trunk/boost/serialization/collections_load_imp.hpp
==============================================================================
--- trunk/boost/serialization/collections_load_imp.hpp (original)
+++ trunk/boost/serialization/collections_load_imp.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -139,11 +139,11 @@
 {
     s.clear();
     collection_size_type count;
- item_version_type item_version;
     const boost::archive::library_version_type library_version(
         ar.get_library_version()
     );
     // retrieve number of elements
+ item_version_type item_version(0);
     ar >> BOOST_SERIALIZATION_NVP(count);
     if(boost::archive::library_version_type(3) < library_version){
         ar >> BOOST_SERIALIZATION_NVP(item_version);

Modified: trunk/boost/serialization/item_version_type.hpp
==============================================================================
--- trunk/boost/serialization/item_version_type.hpp (original)
+++ trunk/boost/serialization/item_version_type.hpp 2010-06-07 23:26:10 EDT (Mon, 07 Jun 2010)
@@ -19,28 +19,26 @@
 #pragma warning( disable : 4244 4267 )
 #endif
 
-struct item_version_type
- : boost::totally_ordered1< item_version_type
- , boost::totally_ordered2< item_version_type, uint_least8_t
- > >
-{
+class item_version_type {
+private:
     typedef uint_least8_t base_type;
     base_type t;
- item_version_type(){};
- item_version_type(const item_version_type & t_) : t(t_.t){}
+ item_version_type(): t(0) {};
+public:
     explicit item_version_type(const unsigned int & t_) : t(t_){
         assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
+ item_version_type(const item_version_type & t_) :
+ t(t_.t)
+ {}
     item_version_type & operator=(const item_version_type & rhs){
         t = rhs.t;
         return *this;
     }
- operator const base_type () const {
+ // used for text output
+ operator const unsigned int () const {
         return t;
     }
- operator base_type & (){
- return t;
- }
     bool operator==(const item_version_type & rhs) const {
         return t == rhs.t;
     }


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