Boost logo

Boost-Commit :

From: nesotto_at_[hidden]
Date: 2007-10-26 19:16:17


Author: nesotto
Date: 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
New Revision: 40489
URL: http://svn.boost.org/trac/boost/changeset/40489

Log:
Ticket #1027 (new Patches)
Added:
   trunk/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp (contents, props changed)
   trunk/boost/ptr_container/detail/serialize_reversible_cont.hpp (contents, props changed)
   trunk/boost/ptr_container/detail/serialize_xml_names.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_array.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_deque.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_list.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_map.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_set.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_vector.hpp (contents, props changed)
Text files modified:
   trunk/boost/ptr_container/detail/associative_ptr_container.hpp | 4 -
   trunk/boost/ptr_container/detail/reversible_ptr_container.hpp | 79 +--------------------------------------
   trunk/boost/ptr_container/detail/static_move_ptr.hpp | 1
   trunk/boost/ptr_container/ptr_array.hpp | 26 -------------
   trunk/boost/ptr_container/ptr_deque.hpp | 3 -
   trunk/boost/ptr_container/ptr_map_adapter.hpp | 76 ++++----------------------------------
   trunk/boost/ptr_container/ptr_sequence_adapter.hpp | 41 +++++++-------------
   trunk/boost/ptr_container/ptr_vector.hpp | 22 +---------
   8 files changed, 29 insertions(+), 223 deletions(-)

Modified: trunk/boost/ptr_container/detail/associative_ptr_container.hpp
==============================================================================
--- trunk/boost/ptr_container/detail/associative_ptr_container.hpp (original)
+++ trunk/boost/ptr_container/detail/associative_ptr_container.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -181,8 +181,7 @@
                                   AssociatePtrCont& from ) // basic
         {
             BOOST_ASSERT( (void*)&from != (void*)this );
- BOOST_ASSERT( !from.empty() && "Cannot transfer from empty container" );
-
+
             size_type res = 0;
             for( ; first != last; )
             {
@@ -219,7 +218,6 @@
                                    AssociatePtrCont& from ) // basic
         {
             BOOST_ASSERT( (void*)&from != (void*)this );
- BOOST_ASSERT( !from.empty() && "Cannot transfer from empty container" );
 
             size_type res = 0;
             for( ; first != last; )

Modified: trunk/boost/ptr_container/detail/reversible_ptr_container.hpp
==============================================================================
--- trunk/boost/ptr_container/detail/reversible_ptr_container.hpp (original)
+++ trunk/boost/ptr_container/detail/reversible_ptr_container.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -35,10 +35,6 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_pointer.hpp>
 #include <boost/type_traits/is_integral.hpp>
-#include <boost/serialization/split_member.hpp>
-#include <algorithm>
-#include <exception>
-#include <memory>
 #include <typeinfo>
 
 namespace boost
@@ -46,13 +42,6 @@
     
 namespace ptr_container_detail
 {
-
- template< class T >
- inline T const& serialize_as_const( T const& r )
- {
- return r;
- }
-
     template< class CloneAllocator >
     struct clone_deleter
     {
@@ -500,7 +489,6 @@
 
         iterator erase( iterator first, iterator last ) // nothrow
         {
- //BOOST_ASSERT( !empty() );
             remove( first, last );
             return iterator( c_.erase( first.base(),
                                        last.base() ) );
@@ -543,13 +531,8 @@
             BOOST_PTR_CONTAINER_THROW_EXCEPTION( empty(), bad_ptr_container_operation,
                                                  "'replace()' on empty container" );
 
- auto_type old( Config::get_pointer( where ) ); // nothrow
-
-//#if defined( __GNUC__ ) || defined( __MWERKS__ ) || defined( __COMO__ )
+ auto_type old( Config::get_pointer( where ) ); // nothrow
             const_cast<void*&>(*where.base()) = ptr.release();
-//#else
-// *where.base() = ptr.release(); // nothrow, commit
-//#endif
             return boost::ptr_container_detail::move( old );
         }
 
@@ -578,65 +561,7 @@
         {
             return replace( idx, x.release() );
         }
-
- //
- // serialization
- //
-
- protected:
-
- template< class Archive >
- void save_helper( Archive& ar ) const
- {
- const_iterator i = this->begin(), e = this->end();
- for( ; i != e; ++i )
- ar & ptr_container_detail::serialize_as_const(
- static_cast<value_type>( *i.base() ) );
- }
-
- public:
-
- template< class Archive >
- void save( Archive& ar, const unsigned ) const
- {
- ar & ptr_container_detail::serialize_as_const( this->size() );
- this->save_helper( ar );
- }
-
- protected:
-
- template< class Archive >
- void load_helper( Archive& ar, size_type n )
- {
- //
- // Called after an appropriate reserve on c.
- //
-
- this->clear();
- for( size_type i = 0u; i != n; ++i )
- {
- //
- // Remark: pointers are not tracked,
- // so we need not call ar.reset_object_address(v, u)
- //
- value_type ptr;
- ar & ptr;
- this->insert( this->end(), ptr );
- }
- }
-
- public:
-
- template< class Archive >
- void load( Archive& ar, const unsigned )
- {
- size_type n;
- ar & n;
- this->load_helper( ar, n );
- }
-
- BOOST_SERIALIZATION_SPLIT_MEMBER()
-
+
     }; // 'reversible_ptr_container'
 
 

Added: trunk/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,86 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_PTR_MAP_ADAPTER_HPP
+#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_PTR_MAP_ADAPTER_HPP
+
+#include <boost/ptr_container/ptr_map_adapter.hpp>
+#include <boost/ptr_container/detail/serialize_xml_names.hpp>
+#include <boost/serialization/split_free.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator>
+void save(Archive& ar, const ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator>& c, unsigned int version)
+{
+ typedef ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator> container;
+ typedef BOOST_DEDUCED_TYPENAME container::const_iterator const_iterator;
+
+ ar << boost::serialization::make_nvp( ptr_container_detail::count,
+ ptr_container_detail::serialize_as_const(c.size()) );
+
+ const_iterator i = c.begin(), e = c.end();
+ for(; i != e; ++i)
+ {
+ ar << boost::serialization::make_nvp( ptr_container_detail::first, i->first );
+ ar << boost::serialization::make_nvp( ptr_container_detail::second,
+ ptr_container_detail::serialize_as_const(i->second) );
+ }
+}
+
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator>
+void load(Archive& ar, ptr_map_adapter<T, VoidPtrMap, CloneAllocator>& c, unsigned int version)
+{
+ typedef ptr_map_adapter<T, VoidPtrMap, CloneAllocator> container;
+ typedef BOOST_DEDUCED_TYPENAME container::key_type key_type;
+ typedef BOOST_DEDUCED_TYPENAME container::size_type size_type;
+ typedef BOOST_DEDUCED_TYPENAME container::iterator iterator;
+
+ c.clear();
+ size_type n;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::count, n );
+
+ for(size_type i = 0u; i != n; ++i)
+ {
+ key_type key;
+ T* value;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::first, key );
+ ar >> boost::serialization::make_nvp( ptr_container_detail::second, value );
+ std::pair<iterator, bool> p = c.insert(key, value);
+ ar.reset_object_address(&p.first->first, &key);
+ }
+}
+
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator>
+void load(Archive& ar, ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator>& c, unsigned int version)
+{
+ typedef ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator> container;
+ typedef BOOST_DEDUCED_TYPENAME container::key_type key_type;
+ typedef BOOST_DEDUCED_TYPENAME container::size_type size_type;
+ typedef BOOST_DEDUCED_TYPENAME container::iterator iterator;
+
+ c.clear();
+ size_type n;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::count, n );
+
+ for(size_type i = 0u; i != n; ++i)
+ {
+ key_type key;
+ T* value;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::first, key );
+ ar >> boost::serialization::make_nvp( ptr_container_detail::second, value );
+ iterator p = c.insert(key, value);
+ ar.reset_object_address(&p->first, &key);
+ }
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/detail/serialize_reversible_cont.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/detail/serialize_reversible_cont.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,91 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_REVERSIBLE_PTR_CONTAINER_HPP
+#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_REVERSIBLE_PTR_CONTAINER_HPP
+
+#include <boost/ptr_container/detail/reversible_ptr_container.hpp>
+#include <boost/ptr_container/detail/serialize_xml_names.hpp>
+#include <boost/serialization/split_free.hpp>
+
+namespace boost
+{
+
+namespace ptr_container_detail
+{
+
+template<class T>
+inline T const& serialize_as_const(T const& r)
+{
+ return r;
+}
+
+template<class Archive, class Config, class CloneAllocator>
+void save_helper(Archive& ar, const ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c)
+{
+ typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::const_iterator const_iterator;
+ typedef BOOST_DEDUCED_TYPENAME container_type::value_type value_type;
+
+ const_iterator i = c.begin(), e = c.end();
+ for(; i != e; ++i)
+ ar << boost::serialization::make_nvp( ptr_container_detail::item,
+ ptr_container_detail::serialize_as_const(static_cast<value_type>(*i.base())));
+ }
+
+template<class Archive, class Config, class CloneAllocator>
+void load_helper(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c,
+ BOOST_DEDUCED_TYPENAME ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>::size_type n)
+{
+ typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::value_type value_type;
+
+ //
+ // Called after an appropriate reserve on c.
+ //
+
+ c.clear();
+ for(size_type i = 0u; i != n; ++i)
+ {
+ //
+ // Remark: pointers are not tracked,
+ // so we need not call ar.reset_object_address(v, u)
+ //
+ value_type ptr;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::item, ptr );
+ c.insert(c.end(), ptr);
+ }
+}
+
+} // namespace ptr_container_detail
+
+namespace serialization
+{
+
+template<class Archive, class Config, class CloneAllocator>
+void save(Archive& ar, const ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int version)
+{
+ ar << boost::serialization::make_nvp( ptr_container_detail::count,
+ ptr_container_detail::serialize_as_const(c.size()) );
+ ptr_container_detail::save_helper(ar, c);
+}
+
+template<class Archive, class Config, class CloneAllocator>
+void load(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int version)
+{
+ typedef ptr_container_detail::reversible_ptr_container<Config, CloneAllocator> container_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
+
+ size_type n;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::count, n );
+ ptr_container_detail::load_helper(ar, c, n);
+
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/detail/serialize_xml_names.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/detail/serialize_xml_names.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,26 @@
+//
+// Boost.Pointer Container
+//
+// Copyright Thorsten Ottosen 2003-2007. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// For more information, see http://www.boost.org/libs/ptr_container/
+//
+
+#ifndef BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_XML_NAMES
+#define BOOST_PTR_CONTAINER_DETAIL_SERIALIZE_XML_NAMES
+
+namespace boost
+{
+ namespace ptr_container_detail
+ {
+ const char* count = "count";
+ const char* item = "item";
+ const char* first = "first";
+ const char* second = "second";
+ }
+}
+#endif
+

Modified: trunk/boost/ptr_container/detail/static_move_ptr.hpp
==============================================================================
--- trunk/boost/ptr_container/detail/static_move_ptr.hpp (original)
+++ trunk/boost/ptr_container/detail/static_move_ptr.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -18,7 +18,6 @@
 #define BOOST_STATIC_MOVE_PTR_HPP_INCLUDED
 
 #include <boost/config.hpp> // Member template friends, put size_t in std.
-#include <algorithm> // swap.
 #include <cstddef> // size_t
 #include <boost/compressed_pair.hpp>
 #include <boost/ptr_container/detail/default_deleter.hpp>

Modified: trunk/boost/ptr_container/ptr_array.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_array.hpp (original)
+++ trunk/boost/ptr_container/ptr_array.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -221,32 +221,6 @@
             BOOST_STATIC_ASSERT( idx < N );
             return this->base()[idx] == 0;
         }
-
- public: // serialization
-
- template< class Archive >
- void save( Archive& ar, const unsigned ) const
- {
- this->save_helper( ar );
- }
-
- template< class Archive >
- void load( Archive& ar, const unsigned ) // basic
- {
- for( size_type i = 0u; i != N; ++i )
- {
- //
- // Remark: pointers are not tracked,
- // so we need not call ar.reset_object_address(v, u)
- //
- T* p;
- ar & p;
- this->replace( i, p );
- }
- }
-
- BOOST_SERIALIZATION_SPLIT_MEMBER()
-
     };
 
     //////////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/ptr_container/ptr_deque.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_deque.hpp (original)
+++ trunk/boost/ptr_container/ptr_deque.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -66,7 +66,4 @@
     }
 }
 
-//#undef BOOST_FORWARD_TYPEDEF
-//#undef BOOST_PTR_CONTAINER_RELEASE_AND_CLONE
-
 #endif

Modified: trunk/boost/ptr_container/ptr_map_adapter.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_map_adapter.hpp (original)
+++ trunk/boost/ptr_container/ptr_map_adapter.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -164,7 +164,7 @@
             }
             else
             {
- eraser e(&this->base(),key); // nothrow
+ eraser e(&this->base(),key); // nothrow
                 mapped_type res = new T(); // strong
                 ref = res; // nothrow
                 e.release(); // nothrow
@@ -286,21 +286,6 @@
         {
             return replace( where, x.release() );
         }
-
- public: // serialization
-
- template< class Archive >
- void save( Archive& ar, const unsigned ) const
- {
- ar & ptr_container_detail::serialize_as_const( this->size() );
-
- const_iterator i = this->begin(), e = this->end();
- for( ; i != e; ++i )
- {
- ar & i->first;
- ar & ptr_container_detail::serialize_as_const( i->second );
- }
- }
     };
     
 } // ptr_container_detail
@@ -347,8 +332,8 @@
             std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
                 res =
                 this->base().insert( std::make_pair( key, ptr.get() ) ); // strong, commit
- if( res.second ) // nothrow
- ptr.release(); // nothrow
+ if( res.second ) // nothrow
+ ptr.release(); // nothrow
         }
 
         template< class II >
@@ -440,13 +425,13 @@
         std::pair<iterator,bool> insert_impl( const key_type& key, mapped_type x ) // strong
         {
             this->enforce_null_policy( x, "Null pointer in ptr_map_adapter::insert()" );
- auto_type ptr( x ); // nothrow
+ auto_type ptr( x ); // nothrow
 
             std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
                  res = this->base().insert( std::make_pair( key, x ) ); // strong, commit
- if( res.second ) // nothrow
- ptr.release(); // nothrow
- return std::make_pair( iterator( res.first ), res.second ); // nothrow
+ if( res.second ) // nothrow
+ ptr.release(); // nothrow
+ return std::make_pair( iterator( res.first ), res.second ); // nothrow
         }
         
     public:
@@ -496,29 +481,6 @@
         {
             return transfer( from.begin(), from.end(), from );
         }
-
- public: // serialization
-
- template< class Archive >
- void load( Archive& ar, const unsigned ) // strong
- {
- this->clear();
- size_type n;
- ar & n;
-
- for( size_type i = 0u; i != n; ++i )
- {
- key_type key;
- T* value;
- ar & key;
- ar & value;
- std::pair<iterator,bool> p = this->insert( key, value );
- ar.reset_object_address( &p.first->first, &key );
- }
- }
-
- BOOST_SERIALIZATION_SPLIT_MEMBER()
-
   };
   
   /////////////////////////////////////////////////////////////////////////
@@ -575,7 +537,7 @@
                                                           // strong
                 safe_insert( pair.first,
                              boost::ptr_container::move( ptr ) );
- // strong, commit
+ // strong, commit
                 ++first;
             }
         }
@@ -701,28 +663,6 @@
             BOOST_ASSERT( from.empty() );
         }
 
- public: // serialization
-
- template< class Archive >
- void load( Archive& ar, const unsigned ) // basic
- {
- this->clear();
- size_type n;
- ar & n;
-
- for( size_type i = 0u; i != n; ++i )
- {
- key_type key;
- T* value;
- ar & key;
- ar & value;
- iterator p = this->insert( key, value );
- ar.reset_object_address( &p->first, &key );
- }
- }
-
- BOOST_SERIALIZATION_SPLIT_MEMBER()
-
     };
 
     template< class I, class F, class S >

Modified: trunk/boost/ptr_container/ptr_sequence_adapter.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_sequence_adapter.hpp (original)
+++ trunk/boost/ptr_container/ptr_sequence_adapter.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -22,19 +22,12 @@
 #include <boost/ptr_container/detail/void_ptr_iterator.hpp>
 #include <boost/type_traits/remove_pointer.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/iterator/iterator_categories.hpp>
 
 
 namespace boost
 {
 namespace ptr_container_detail
-{
-
-
-
-
+{
     template
     <
         class T,
@@ -186,9 +179,9 @@
         {
             this->enforce_null_policy( x, "Null pointer in 'push_back()'" );
 
- auto_type ptr( x ); // notrow
+ auto_type ptr( x ); // notrow
             this->base().push_back( x ); // strong, commit
- ptr.release(); // nothrow
+ ptr.release(); // nothrow
         }
 
         template< class U >
@@ -201,9 +194,9 @@
         {
             this->enforce_null_policy( x, "Null pointer in 'push_front()'" );
 
- auto_type ptr( x ); // nothrow
+ auto_type ptr( x ); // nothrow
             this->base().push_front( x ); // strong, commit
- ptr.release(); // nothrow
+ ptr.release(); // nothrow
         }
 
         template< class U >
@@ -217,9 +210,9 @@
             BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
                                                  bad_ptr_container_operation,
                                           "'pop_back()' on empty container" );
- auto_type ptr( static_cast<value_type>(
- this->base().back() ) ); // nothrow
- this->base().pop_back(); // nothrow
+ auto_type ptr( static_cast<value_type>( this->base().back() ) );
+ // nothrow
+ this->base().pop_back(); // nothrow
             return ptr_container_detail::move( ptr ); // nothrow
         }
 
@@ -228,9 +221,9 @@
             BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
                                                  bad_ptr_container_operation,
                                          "'pop_front()' on empty container" );
- auto_type ptr( static_cast<value_type>(
- this->base().front() ) ); // nothrow
- this->base().pop_front(); // nothrow
+ auto_type ptr( static_cast<value_type>( this->base().front() ) );
+ // nothrow
+ this->base().pop_front(); // nothrow
             return ptr_container_detail::move( ptr );
         }
         
@@ -385,10 +378,8 @@
             if( from.empty() )
                 return;
             this->base().
- insert( before.base(),
- first.base(), last.base() ); // strong
- from.base().erase( first.base(),
- last.base() ); // nothrow
+ insert( before.base(), first.base(), last.base() ); // strong
+ from.base().erase( first.base(), last.base() ); // nothrow
         }
 
         template< class PtrSeqAdapter >
@@ -399,10 +390,8 @@
             BOOST_ASSERT( (void*)&from != (void*)this );
             if( from.empty() )
                 return;
- this->base().
- insert( before.base(),
- *object.base() ); // strong
- from.base().erase( object.base() ); // nothrow
+ this->base().insert( before.base(), *object.base() ); // strong
+ from.base().erase( object.base() ); // nothrow
         }
 
 #ifdef BOOST_NO_SFINAE

Modified: trunk/boost/ptr_container/ptr_vector.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_vector.hpp (original)
+++ trunk/boost/ptr_container/ptr_vector.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -45,29 +45,13 @@
         BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_vector,
                                                       base_class,
                                                       this_type );
-
+
         ptr_vector( size_type n,
                     const allocator_type& alloc = allocator_type() )
           : base_class(alloc)
         {
- if( n > 0 )
- this->base().reserve( n );
- }
-
- public: // serialization
-
- template< class Archive >
- void load( Archive& ar, unsigned )
- {
- size_type n;
- ar & n;
-
- this->reserve( n );
- this->load_helper( ar, n );
- }
-
- BOOST_SERIALIZATION_SPLIT_MEMBER()
-
+ this->base().reserve( n );
+ }
     };
 
     //////////////////////////////////////////////////////////////////////////////

Added: trunk/boost/ptr_container/serialize.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,16 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_HPP
+
+#include <boost/ptr_container/serialize_ptr_array.hpp>
+#include <boost/ptr_container/serialize_ptr_deque.hpp>
+#include <boost/ptr_container/serialize_ptr_list.hpp>
+#include <boost/ptr_container/serialize_ptr_map.hpp>
+#include <boost/ptr_container/serialize_ptr_set.hpp>
+#include <boost/ptr_container/serialize_ptr_vector.hpp>
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_array.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_array.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,47 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_ARRAY_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_ARRAY_HPP
+
+#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
+#include <boost/ptr_container/ptr_array.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, std::size_t N, class CloneAllocator>
+void save(Archive& ar, const ptr_array<T, N, CloneAllocator>& c, unsigned int version)
+{
+ ptr_container_detail::save_helper(ar, c);
+}
+
+template<class Archive, class T, std::size_t N, class CloneAllocator>
+void load(Archive& ar, ptr_array<T, N, CloneAllocator>& c, unsigned int version)
+{
+ typedef ptr_array<T, N, CloneAllocator> container_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
+
+ for(size_type i = 0u; i != N; ++i)
+ {
+ T* p;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::item, p );
+ c.replace(i, p);
+ }
+}
+
+template<class Archive, class T, std::size_t N, class CloneAllocator>
+void serialize(Archive& ar, ptr_array<T, N, CloneAllocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_deque.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_deque.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,27 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_DEQUE_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_DEQUE_HPP
+
+#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
+#include <boost/ptr_container/ptr_deque.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_deque<T, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_list.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_list.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,27 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_LIST_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_LIST_HPP
+
+#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
+#include <boost/ptr_container/ptr_list.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_list<T, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_map.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_map.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,33 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_MAP_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_MAP_HPP
+
+#include <boost/ptr_container/detail/serialize_ptr_map_adapter.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class Key, class T, class Compare, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_map<Key, T, Compare, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+template<class Archive, class Key, class T, class Compare, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_multimap<Key, T, Compare, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_set.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_set.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,33 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_SET_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_SET_HPP
+
+#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_set<T, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_multiset<T, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_vector.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/serialize_ptr_vector.hpp 2007-10-26 19:16:15 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,40 @@
+// Copyright Sebastian Ramacher, 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP
+#define BOOST_PTR_CONTAINER_SERIALIZE_PTR_VECTOR_HPP
+
+#include <boost/ptr_container/detail/serialize_reversible_cont.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+namespace boost
+{
+
+namespace serialization
+{
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int version)
+{
+ typedef ptr_vector<T, CloneAllocator, Allocator> container_type;
+ typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type;
+
+ size_type n;
+ ar >> boost::serialization::make_nvp( ptr_container_detail::count, n );
+ c.reserve(n);
+
+ ptr_container_detail::load_helper(ar, c, n);
+}
+
+template<class Archive, class T, class CloneAllocator, class Allocator>
+void serialize(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, const unsigned int version)
+{
+ split_free(ar, c, version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif


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