Boost logo

Boost-Commit :

From: nesotto_at_[hidden]
Date: 2008-06-03 18:19:00


Author: nesotto
Date: 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
New Revision: 46098
URL: http://svn.boost.org/trac/boost/changeset/46098

Log:
update
Added:
   trunk/boost/ptr_container/ptr_circular_buffer.hpp (contents, props changed)
   trunk/boost/ptr_container/ptr_unordered_set.hpp (contents, props changed)
   trunk/boost/ptr_container/ptr_unoredered_map.hpp (contents, props changed)
   trunk/boost/ptr_container/serialize_ptr_circular_buffer.hpp (contents, props changed)
Removed:
   trunk/boost/ptr_container/clone_inserter.hpp
Text files modified:
   trunk/boost/ptr_container/clone_allocator.hpp | 2
   trunk/boost/ptr_container/ptr_map_adapter.hpp | 139 +++++++++++++++++++++++++++++++++++----
   trunk/boost/ptr_container/ptr_sequence_adapter.hpp | 45 +++++++++++-
   trunk/boost/ptr_container/ptr_set_adapter.hpp | 137 ++++++++++++++++++++++++++++++++------
   4 files changed, 277 insertions(+), 46 deletions(-)

Modified: trunk/boost/ptr_container/clone_allocator.hpp
==============================================================================
--- trunk/boost/ptr_container/clone_allocator.hpp (original)
+++ trunk/boost/ptr_container/clone_allocator.hpp 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -70,7 +70,7 @@
         template< class U >
         static U* allocate_clone( const U& r )
         {
- return const_cast<U*>( &r );
+ return const_cast<U*>(&r);
         }
 
         template< class U >

Deleted: trunk/boost/ptr_container/clone_inserter.hpp
==============================================================================
Binary file. No diff available.

Added: trunk/boost/ptr_container/ptr_circular_buffer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/ptr_circular_buffer.hpp 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -0,0 +1,314 @@
+//
+// Boost.Pointer Container
+//
+// Copyright Thorsten Ottosen 2008. 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_PTR_CIRCULAR_BUFFER_HPP
+#define BOOST_PTR_CONTAINER_PTR_CIRCULAR_BUFFER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/circular_buffer.hpp>
+#include <boost/ptr_container/ptr_sequence_adapter.hpp>
+
+namespace boost
+{
+
+ template
+ <
+ class T,
+ class CloneAllocator = heap_clone_allocator,
+ class Allocator = std::allocator<void*>
+ >
+ class ptr_circular_buffer : public
+ ptr_sequence_adapter< T,
+ boost::circular_buffer<void*,Allocator>,
+ CloneAllocator >
+ {
+ typedef ptr_sequence_adapter< T,
+ boost::circular_buffer<void*,Allocator>,
+ CloneAllocator >
+ base_type;
+
+ typedef boost::circular_buffer<void*,Allocator> circular_buffer_type;
+ typedef ptr_circular_buffer<T,CloneAllocator,Allocator> this_type;
+
+ public: // typedefs
+ typedef typename base_type::value_type value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef typename base_type::size_type size_type;
+ typedef typename base_type::allocator_type allocator_type;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::auto_type auto_type;
+
+ typedef std::pair<pointer*,size_type> array_range;
+ typedef std::pair<const_pointer*,size_type> const_array_range;
+ typedef typename circular_buffer_type::capacity_type capacity_type;
+
+ public: // allocators
+ allocator_type& get_allocator()
+ {
+ return this->base().get_allocator();
+ }
+
+ allocator_type get_allocator() const
+ {
+ return this->base().get_allocator();
+ }
+
+ public: // circular buffer functions
+ array_range array_one() // nothrow
+ {
+ typename circular_buffer_type::array_range r = this->base().array_one();
+ return array_range( static_cast<pointer>(r.first,r.second) );
+ }
+
+ const_array_range array_one() const // nothrow
+ {
+ typename circular_buffer_type::const_array_range r = this->base().array_one();
+ return array_range( static_cast<pointer>(r.first,r.second) );
+ }
+
+ array_range array_two() // nothrow
+ {
+ typename circular_buffer_type::const_array_range r = this->base().array_two();
+ return const_array_range( static_cast<pointer>(r.first,r.second) );
+ }
+
+ const_array_range array_two() const // nothrow
+ {
+ typename circular_buffer_type::const_array_range r = this->base().array_two();
+ return const_array_range( static_cast<pointer>(r.first,r.second) );
+ }
+
+ pointer linearise() // nothrow
+ {
+ return this->base().linearise();
+ }
+
+ bool full() const // nothrow
+ {
+ return this->base().full();
+ }
+
+ size_type reserve() const // nothrow
+ {
+ return this->base().reserve();
+ }
+
+ capacity_type capacity() const // nothrow
+ {
+ return this->base().capacity();
+ }
+
+ void set_capacity( capacity_type new_capacity ) // strong
+ {
+ if( this->size() > new_capacity )
+ {
+ this->erase( this->begin() + new_capacity, this->end() );
+ }
+ this->base().set_capacity( new_capacity );
+ }
+
+ void rset_capacity( capacity_type new_capacity ) // strong
+ {
+ if( this->size() > new_capacity )
+ {
+ this->erase( this->begin(),
+ this->begin() + (this->size()-new_capacity) );
+ }
+ this->base().rset_capacity( new_capacity );
+ }
+
+ using base_type::assign;
+
+ void assign( size_type n, value_type to_clone ) // strong
+ {
+ base_type temp;
+ for( size_type i = 0u; i != n; ++i )
+ temp.push_back( this->null_policy_allocate_clone( to_clone ) );
+ temp->base().set_capacity( n );
+ this->swap( temp );
+ }
+
+ void assign( capacity_type capacity, size_type n,
+ value_type to_clone ) // basic
+ {
+ this->assign( n, to_clone );
+ this->base().set_capacity( capacity );
+ }
+
+ template< class InputIterator >
+ void assign( capacity_type capacity,
+ InputIterator first, InputIterator last ) // basic
+ {
+ this->assign( first, last );
+ this->base().set_capacity( capacity );
+ }
+
+ void push_back( value_type ptr ) // nothrow
+ {
+ BOOST_ASSERT( capacity() > 0 );
+ auto_type old_ptr;
+ if( full() )
+ old_ptr.reset( &*this->begin() );
+ this->base().push_back( ptr );
+ }
+
+ template< class U >
+ void push_back( std::auto_ptr<U> ptr ) // nothrow
+ {
+ push_back( ptr.release() );
+ }
+
+ void push_front( value_type ptr ) // nothrow
+ {
+ BOOST_ASSERT( capacity() > 0 );
+ auto_type old_ptr;
+ if( full() )
+ old_ptr.reset( &*(--this->end()) );
+ this->base().push_back( ptr );
+ }
+
+ template< class U >
+ void push_front( std::auto_ptr<U> ptr ) // nothrow
+ {
+ push_front( ptr.release() );
+ }
+
+ iterator insert( iterator pos, value_type ptr ) // nothrow
+ {
+ BOOST_ASSERT( capacity() > 0 );
+ auto_type new_ptr( ptr );
+ iterator b = this->begin();
+ if( full() && pos == b )
+ return b;
+
+ auto_type old_ptr;
+ if( full() )
+ old_ptr.reset( &*this->begin() );
+
+ new_ptr.release();
+ return this->base().insert( pos.base(), ptr );
+ }
+
+ template< class U >
+ iterator insert( iterator pos, std::auto_ptr<U> ptr ) // nothrow
+ {
+ return insert( pos, ptr.release() );
+ }
+
+ template< class InputIterator >
+ void insert( iterator pos, InputIterator first, InputIterator last )
+ {
+ // @todo
+ }
+
+#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+#else
+ template< class Range >
+ BOOST_DEDUCED_TYPENAME
+ boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
+ insert( iterator before, const Range& r )
+ {
+ insert( before, boost::begin(r), boost::end(r) );
+ }
+
+#endif
+
+ iterator rinsert( iterator pos, value_type ptr ) // nothrow
+ {
+ BOOST_ASSERT( capacity() > 0 );
+ auto_type new_ptr( ptr );
+ iterator b = this->end();
+ if (full() && pos == b)
+ return b;
+
+ auto_type old_ptr;
+ if( full() )
+ old_ptr.reset( &this->back() );
+
+ new_ptr.release();
+ return this->base().rinsert( pos.base(), ptr );
+ }
+
+ template< class U >
+ iterator rinsert( iterator pos, std::auto_ptr<U> ptr ) // nothrow
+ {
+ return rinsert( pos, ptr.release() );
+ }
+
+
+ template< class InputIterator >
+ void rinsert( iterator pos, InputIterator first, InputIterator last )
+ {
+ // @todo
+ }
+
+#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+#else
+ template< class Range >
+ BOOST_DEDUCED_TYPENAME
+ boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
+ rinsert( iterator before, const Range& r )
+ {
+ rinsert( before, boost::begin(r), boost::end(r) );
+ }
+
+#endif
+
+ void rerase( iterator pos )
+ {
+ // @todo
+ }
+
+ void rerase( iterator first, iterator last )
+ {
+ // @todo
+ }
+
+
+ public: // constructors
+
+ BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_circular_buffer,
+ base_type,
+ this_type );
+
+ explicit ptr_circular_buffer( capacity_type n,
+ const allocator_type& alloc = allocator_type() )
+ : base_type(alloc)
+ {
+ this->base().set_capacity( n );
+ }
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ // clonability
+
+ template< typename T, typename CA, typename A >
+ inline ptr_circular_buffer<T,CA,A>* new_clone( const ptr_circular_buffer<T,CA,A>& r )
+ {
+ return r.clone().release();
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // swap
+
+ template< typename T, typename CA, typename A >
+ inline void swap( ptr_circular_buffer<T,CA,A>& l, ptr_circular_buffer<T,CA,A>& r )
+ {
+ l.swap(r);
+ }
+
+}
+
+#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 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -18,6 +18,7 @@
 
 #include <boost/ptr_container/detail/map_iterator.hpp>
 #include <boost/ptr_container/detail/associative_ptr_container.hpp>
+#include <boost/ptr_container/detail/meta_functions.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/range/iterator_range.hpp>
 
@@ -29,7 +30,8 @@
     template
     <
         class T,
- class VoidPtrMap
+ class VoidPtrMap,
+ bool Ordered = true
>
     struct map_config
     {
@@ -41,11 +43,35 @@
         typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
                      allocator_type;
         
- typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::key_compare
- key_compare;
-
- typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::value_compare
- value_compare;
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_value_compare<VoidPtrMap>,
+ mpl::identity<void> >::type
+ value_compare;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_key_compare<VoidPtrMap>,
+ mpl::identity<void> >::type
+ key_compare;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ mpl::identity<void>,
+ select_hasher<VoidPtrMap> >::type
+ hasher;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ mpl::identity<void>,
+ select_key_equal<VoidPtrMap> >::type
+ key_equal;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::if_c<Ordered,
+ ptr_container_detail::ordered_associative_container_tag,
+ ptr_container_detail::unordered_associative_container_tag>::type
+ container_type;
         
         typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::key_type
                      key_type;
@@ -435,6 +461,18 @@
                 ptr.release(); // nothrow
             return std::make_pair( iterator( res.first ), res.second ); // nothrow
         }
+
+ iterator insert_impl( iterator before, 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
+ BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
+ res = this->base().insert( before.base(), std::make_pair( key, x ) );
+ // strong, commit
+ ptr.release(); // notrow
+ return iterator( res );
+ }
         
     public:
         
@@ -449,6 +487,33 @@
             return insert_impl( key, x.release() );
         }
 
+ template< class F, class S >
+ iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
+ {
+ this->enforce_null_policy( p.second,
+ "Null pointer in 'ptr_map_adapter::insert()'" );
+
+ auto_type ptr( this->null_policy_allocate_clone( p.second ) );
+ BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
+ result = this->base().insert( before.base(),
+ std::make_pair(p.first,ptr.get()) ); // strong
+ if( ptr.get() == result->second )
+ ptr.release();
+
+ return iterator( result );
+ }
+
+ iterator insert( iterator before, key_type& key, mapped_type x ) // strong
+ {
+ return insert_impl( before, key, x );
+ }
+
+ template< class U >
+ iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong
+ {
+ return insert_impl( before, key, x.release() );
+ }
+
         template< class PtrMapAdapter >
         bool transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
                        PtrMapAdapter& from ) // strong
@@ -599,7 +664,34 @@
         }
 
         using base_type::release;
-
+
+ private:
+ iterator insert_impl( const key_type& key, mapped_type x ) // strong
+ {
+ this->enforce_null_policy( x,
+ "Null pointer in 'ptr_multimap_adapter::insert()'" );
+ auto_type ptr( x ); // nothrow
+ BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
+ res = this->base().insert( std::make_pair( key, x ) );
+ // strong, commit
+ ptr.release(); // notrow
+ return iterator( res );
+ }
+
+ iterator insert_impl( iterator before, const key_type& key, mapped_type x ) // strong
+ {
+ this->enforce_null_policy( x,
+ "Null pointer in 'ptr_multimap_adapter::insert()'" );
+ auto_type ptr( x ); // nothrow
+ BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
+ res = this->base().insert( before.base(),
+ std::make_pair( key, x ) );
+ // strong, commit
+ ptr.release(); // notrow
+ return iterator( res );
+ }
+
+ public:
         template< typename InputIterator >
         void insert( InputIterator first, InputIterator last ) // basic
         {
@@ -614,23 +706,36 @@
 
         iterator insert( key_type& key, mapped_type x ) // strong
         {
- this->enforce_null_policy( x,
- "Null pointer in 'ptr_multimap_adapter::insert()'" );
-
- auto_type ptr( x ); // nothrow
- BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
- res = this->base().insert( std::make_pair( key, x ) );
- // strong, commit
- ptr.release(); // notrow
- return iterator( res );
+ return insert_impl( key, x );
         }
 
         template< class U >
         iterator insert( const key_type& key, std::auto_ptr<U> x )
         {
- return insert( key, x.release() );
+ return insert_impl( key, x.release() );
         }
 
+ template< class F, class S >
+ iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
+ {
+ this->enforce_null_policy( p.second,
+ "Null pointer in 'ptr_multimap_adapter::insert()'" );
+ iterator res = insert_impl( before, p.first,
+ this->null_policy_allocate_clone( p.second ) );
+ return res;
+ }
+
+ iterator insert( iterator before, key_type& key, mapped_type x ) // strong
+ {
+ return insert_impl( before, key, x );
+ }
+
+ template< class U >
+ iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong
+ {
+ return insert_impl( before, key, x.release() );
+ }
+
         template< class PtrMapAdapter >
         void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
                        PtrMapAdapter& from ) // strong

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 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -325,7 +325,7 @@
         }
 
         template< class Range >
- void assign( const Range& r )
+ void assign( const Range& r ) // strong
         {
             assign( boost::begin(r), boost::end(r ) );
         }
@@ -369,7 +369,7 @@
         }
 
 #endif
-
+
         template< class PtrSeqAdapter >
         void transfer( iterator before,
                        BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
@@ -457,7 +457,7 @@
 
     public: // resize
 
- void resize( size_type size )
+ void resize( size_type size ) // basic
         {
             size_type old_size = this->size();
             if( old_size > size )
@@ -474,7 +474,7 @@
             BOOST_ASSERT( this->size() == size );
         }
 
- void resize( size_type size, value_type to_clone )
+ void resize( size_type size, value_type to_clone ) // basic
         {
             size_type old_size = this->size();
             if( old_size > size )
@@ -489,7 +489,42 @@
 
             BOOST_ASSERT( this->size() == size );
         }
-
+
+ void rresize( size_type size ) // basic
+ {
+ size_type old_size = this->size();
+ if( old_size > size )
+ {
+ this->erase( this->begin(),
+ boost::next( this->begin(), old_size - size ) );
+ }
+ else if( size > old_size )
+ {
+ for( ; old_size != size; ++old_size )
+ this->push_front( new BOOST_DEDUCED_TYPENAME
+ boost::remove_pointer<value_type>::type );
+ }
+
+ BOOST_ASSERT( this->size() == size );
+ }
+
+ void rresize( size_type size, value_type to_clone ) // basic
+ {
+ size_type old_size = this->size();
+ if( old_size > size )
+ {
+ this->erase( this->begin(),
+ boost::next( this->begin(), old_size - size ) );
+ }
+ else if( size > old_size )
+ {
+ for( ; old_size != size; ++old_size )
+ this->push_front( this->null_policy_allocate_clone( to_clone ) );
+ }
+
+ BOOST_ASSERT( this->size() == size );
+ }
+
     public: // algorithms
 
         void sort( iterator first, iterator last )

Modified: trunk/boost/ptr_container/ptr_set_adapter.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_set_adapter.hpp (original)
+++ trunk/boost/ptr_container/ptr_set_adapter.hpp 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -17,6 +17,7 @@
 #endif
 
 #include <boost/ptr_container/detail/associative_ptr_container.hpp>
+#include <boost/ptr_container/detail/meta_functions.hpp>
 #include <boost/ptr_container/detail/void_ptr_iterator.hpp>
 #include <boost/range/iterator_range.hpp>
 
@@ -27,7 +28,8 @@
     template
     <
         class Key,
- class VoidPtrSet
+ class VoidPtrSet,
+ bool Ordered = true
>
     struct set_config
     {
@@ -42,12 +44,33 @@
        typedef value_type
                     key_type;
 
- typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::value_compare
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_value_compare<VoidPtrSet>,
+ mpl::identity<void> >::type
                     value_compare;
 
        typedef value_compare
                     key_compare;
 
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ mpl::identity<void>,
+ select_hasher<VoidPtrSet> >::type
+ hasher;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ mpl::identity<void>,
+ select_key_equal<VoidPtrSet> >::type
+ key_equal;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::if_c<Ordered,
+ ptr_container_detail::ordered_associative_container_tag,
+ ptr_container_detail::unordered_associative_container_tag>::type
+ container_type;
+
        typedef void_ptr_iterator<
                        BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
                     iterator;
@@ -77,13 +100,14 @@
     <
         class Key,
         class VoidPtrSet,
- class CloneAllocator = heap_clone_allocator
+ class CloneAllocator = heap_clone_allocator,
+ bool Ordered = true
>
     class ptr_set_adapter_base
- : public ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet>,
+ : public ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
                                                       CloneAllocator >
     {
- typedef ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet>,
+ typedef ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
                                                      CloneAllocator >
               base_type;
     public:
@@ -95,19 +119,28 @@
         typedef BOOST_DEDUCED_TYPENAME base_type::size_type
                       size_type;
 
- private:
+ public:
         ptr_set_adapter_base()
- : base_type( BOOST_DEDUCED_TYPENAME VoidPtrSet::key_compare(),
- BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type() )
         { }
 
- public:
-
+ template< class SizeType >
+ ptr_set_adapter_base( SizeType n,
+ ptr_container_detail::unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
+
         template< class Compare, class Allocator >
         ptr_set_adapter_base( const Compare& comp,
                               const Allocator& a )
          : base_type( comp, a )
         { }
+
+ template< class Hash, class Pred, class Allocator >
+ ptr_set_adapter_base( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
         
         template< class InputIterator, class Compare, class Allocator >
         ptr_set_adapter_base( InputIterator first, InputIterator last,
@@ -115,7 +148,15 @@
                               const Allocator& a )
          : base_type( first, last, comp, a )
         { }
-
+
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_set_adapter_base( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( first, last, hash, pred, a )
+ { }
+
         template< class U, class Set >
         explicit ptr_set_adapter_base( const ptr_set_adapter_base<U,Set>& r )
           : base_type( r )
@@ -226,12 +267,13 @@
     <
         class Key,
         class VoidPtrSet,
- class CloneAllocator = heap_clone_allocator
+ class CloneAllocator = heap_clone_allocator,
+ bool Ordered = true
>
     class ptr_set_adapter :
- public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator>
+ public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
     {
- typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator>
+ typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
             base_type;
     
     public: // typedefs
@@ -245,7 +287,7 @@
         typedef Key key_type;
         typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
                      auto_type;
- typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::key_compare
+ typedef BOOST_DEDUCED_TYPENAME base_type::key_compare
                      key_compare;
         typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
                      allocator_type;
@@ -263,14 +305,30 @@
         }
 
     public:
+ ptr_set_adapter()
+ { }
+
+ template< class SizeType >
+ ptr_set_adapter( SizeType n,
+ ptr_container_detail::unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
         
- explicit ptr_set_adapter( const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type() )
+ template< class Comp >
+ explicit ptr_set_adapter( const Comp& comp,
+ const allocator_type& a )
           : base_type( comp, a )
         {
             BOOST_ASSERT( this->empty() );
         }
 
+ template< class Hash, class Pred, class Allocator >
+ ptr_set_adapter( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
         template< class InputIterator, class Compare, class Allocator >
         ptr_set_adapter( InputIterator first, InputIterator last,
                          const Compare& comp = Compare(),
@@ -281,6 +339,14 @@
             set_basic_clone_and_insert( first, last );
         }
 
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_set_adapter( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( first, last, hash, pred, a )
+ { }
+
         template< class U, class Set >
         explicit ptr_set_adapter( const ptr_set_adapter<U,Set>& r )
           : base_type( r )
@@ -406,12 +472,13 @@
     <
         class Key,
         class VoidPtrMultiSet,
- class CloneAllocator = heap_clone_allocator
+ class CloneAllocator = heap_clone_allocator,
+ bool Ordered = true
>
     class ptr_multiset_adapter :
- public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator>
+ public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered>
     {
- typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator> base_type;
+ typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered> base_type;
     
     public: // typedefs
     
@@ -438,12 +505,28 @@
         }
     
     public:
+ ptr_multiset_adapter()
+ { }
 
- ptr_multiset_adapter( const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type() )
+ template< class SizeType >
+ ptr_multiset_adapter( SizeType n,
+ ptr_container_detail::unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
+
+ template< class Comp >
+ explicit ptr_multiset_adapter( const Comp& comp,
+ const allocator_type& a )
         : base_type( comp, a )
         { }
-
+
+ template< class Hash, class Pred, class Allocator >
+ ptr_multiset_adapter( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
         template< class InputIterator >
         ptr_multiset_adapter( InputIterator first, InputIterator last,
                               const key_compare& comp = key_compare(),
@@ -453,6 +536,14 @@
             set_basic_clone_and_insert( first, last );
         }
 
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_multiset_adapter( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( first, last, hash, pred, a )
+ { }
+
         template< class U, class Set >
         explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set>& r )
           : base_type( r )

Added: trunk/boost/ptr_container/ptr_unordered_set.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/ptr_unordered_set.hpp 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -0,0 +1,170 @@
+//
+// Boost.Pointer Container
+//
+// Copyright Thorsten Ottosen 2008. 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_PTR_UNORDERED_SET_HPP
+#define BOOST_PTR_CONTAINER_PTR_UNORDERED_SET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/ptr_container/indirect_fun.hpp>
+#include <boost/ptr_container/ptr_set_adapter.hpp>
+#include <boost/unordered_set.hpp>
+
+namespace boost
+{
+
+ template
+ <
+ class Key,
+ class Hash = boost::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class CloneAllocator = heap_clone_allocator,
+ class Allocator = std::allocator<void*>
+ >
+ class ptr_unordered_set :
+ public ptr_set_adapter< Key,
+ boost::unordered_set<void*,void_ptr_indirect_fun<Hash,Key>,
+ void_ptr_indirect_fun<Pred,Key>,Allocator>,
+ CloneAllocator, false >
+ {
+ typedef ptr_set_adapter< Key,
+ boost::unordered_set<void*,void_ptr_indirect_fun<Hash,Key>,
+ void_ptr_indirect_fun<Pred,Key>,Allocator>,
+ CloneAllocator, false >
+ base_type;
+
+ typedef ptr_unordered_set<Key,Hash,Pred,CloneAllocator,Allocator> this_type;
+
+ public:
+ typedef typename base_type::size_type size_type;
+
+ public:
+ ptr_unordered_set()
+ {}
+
+ explicit ptr_unordered_set( size_type n )
+ : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
+ { }
+
+ ptr_unordered_set( size_type n,
+ const Hash& comp,
+ const Pred& pred = Pred(),
+ const Allocator& a = Allocator() )
+ : base_type( n, comp, pred, a )
+ { }
+
+ // @todo: add const with two iterator arguments, and use
+ // tags to by-pass default arguments
+
+ template< typename InputIterator >
+ ptr_unordered_set( InputIterator first, InputIterator last,
+ const Hash& comp = Hash(),
+ const Pred& pred = Pred(),
+ const Allocator& a = Allocator() )
+ : base_type( first, last, comp, pred, a )
+ { }
+
+ BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_set,
+ base_type,
+ this_type );
+ BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_set, base_type )
+
+ };
+
+
+
+ template
+ <
+ class Key,
+ class Hash = boost::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class CloneAllocator = heap_clone_allocator,
+ class Allocator = std::allocator<void*>
+ >
+ class ptr_unordered_multiset :
+ public ptr_set_adapter< Key,
+ boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
+ void_ptr_indirect_fun<Pred,Key>,Allocator>,
+ CloneAllocator, false >
+ {
+ typedef ptr_set_adapter< Key,
+ boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
+ void_ptr_indirect_fun<Pred,Key>,Allocator>,
+ CloneAllocator, false >
+ base_type;
+ typedef ptr_unordered_multiset<Key,Hash,Pred,CloneAllocator,Allocator> this_type;
+
+ public:
+ typedef typename base_type::size_type size_type;
+
+ public:
+ explicit ptr_unordered_multiset( size_type n )
+ : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
+ { }
+
+ ptr_unordered_multiset( size_type n,
+ const Hash& comp,
+ const Pred& pred = Pred(),
+ const Allocator& a = Allocator() )
+ : base_type( n, comp, pred, a )
+ { }
+
+ template< typename InputIterator >
+ ptr_unordered_multiset( InputIterator first, InputIterator last,
+ const Hash& comp = Hash(),
+ const Pred& pred = Pred(),
+ const Allocator& a = Allocator() )
+ : base_type( first, last, comp, pred, a )
+ { }
+
+ BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multiset,
+ base_type,
+ this_type );
+ BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_multiset,
+ base_type );
+
+ };
+
+ /////////////////////////////////////////////////////////////////////////
+ // clonability
+
+ template< typename K, typename C, typename CA, typename A >
+ inline ptr_unordered_set<K,C,CA,A>* new_clone( const ptr_unordered_set<K,C,CA,A>& r )
+ {
+ return r.clone().release();
+ }
+
+ template< typename K, typename C, typename CA, typename A >
+ inline ptr_unordered_multiset<K,C,CA,A>* new_clone( const ptr_unordered_multiset<K,C,CA,A>& r )
+ {
+ return r.clone().release();
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // swap
+
+ template< typename K, typename C, typename CA, typename A >
+ inline void swap( ptr_unordered_set<K,C,CA,A>& l, ptr_unordered_set<K,C,CA,A>& r )
+ {
+ l.swap(r);
+ }
+
+ template< typename K, typename C, typename CA, typename A >
+ inline void swap( ptr_unordered_multiset<K,C,CA,A>& l, ptr_unordered_multiset<K,C,CA,A>& r )
+ {
+ l.swap(r);
+ }
+
+}
+
+#endif

Added: trunk/boost/ptr_container/ptr_unoredered_map.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/ptr_container/ptr_unoredered_map.hpp 2008-06-03 18:18:59 EDT (Tue, 03 Jun 2008)
@@ -0,0 +1,151 @@
+//
+// Boost.Pointer Container
+//
+// Copyright Thorsten Ottosen 2003-2005. 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_PTR_MAP_HPP
+#define BOOST_PTR_CONTAINER_PTR_MAP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <map>
+#include <boost/ptr_container/ptr_map_adapter.hpp>
+
+namespace boost
+{
+
+ template
+ <
+ class Key,
+ class T,
+ class Compare = std::less<Key>,
+ class CloneAllocator = heap_clone_allocator,
+ class Allocator = std::allocator< std::pair<const Key,void*> >
+ >
+ class ptr_map :
+ public ptr_map_adapter<T,std::map<Key,void*,
+ Compare,Allocator>,CloneAllocator>
+ {
+ typedef ptr_map_adapter<T,std::map<Key,void*,
+ Compare,Allocator>,CloneAllocator>
+ base_type;
+
+ typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
+
+ public:
+ explicit ptr_map( const Compare& comp = Compare(),
+ const Allocator& a = Allocator() )
+ : base_type( comp, a ) { }
+
+ template< class InputIterator >
+ ptr_map( InputIterator first, InputIterator last,
+ const Compare& comp = Compare(),
+ const Allocator& a = Allocator() )
+ : base_type( first, last, comp, a )
+ { }
+
+ BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
+ this_type );
+
+ template< class U >
+ ptr_map( const ptr_map<Key,U>& r ) : base_type( r )
+ { }
+
+ template< class U >
+ ptr_map& operator=( const ptr_map<Key,U>& r )
+ {
+ base_type::operator=( r );
+ return *this;
+ }
+ };
+
+
+
+ template
+ <
+ class Key,
+ class T,
+ class Compare = std::less<Key>,
+ class CloneAllocator = heap_clone_allocator,
+ class Allocator = std::allocator< std::pair<const Key,void*> >
+ >
+ class ptr_multimap :
+ public ptr_multimap_adapter<T,std::multimap<Key,void*,
+ Compare,Allocator>,CloneAllocator>
+ {
+ typedef ptr_multimap_adapter<T,std::multimap<Key,void*,
+ Compare,Allocator>,CloneAllocator>
+ base_type;
+
+ typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
+
+ public:
+ explicit ptr_multimap( const Compare& comp = Compare(),
+ const Allocator& a = Allocator() )
+ : base_type( comp, a ) { }
+
+ template< class InputIterator >
+ ptr_multimap( InputIterator first, InputIterator last,
+ const Compare& comp = Compare(),
+ const Allocator& a = Allocator() )
+ : base_type( first, last, comp, a )
+ { }
+
+ BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
+ base_type,
+ this_type );
+
+ template< class U >
+ ptr_multimap( const ptr_multimap<Key,U>& r ) : base_type( r )
+ { }
+
+ template< class U >
+ ptr_multimap& operator=( const ptr_multimap<Key,U>& r )
+ {
+ base_type::operator=( r );
+ return *this;
+ }
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ // clonability
+
+ template< class K, class T, class C, class CA, class A >
+ inline ptr_map<K,T,C,CA,A>* new_clone( const ptr_map<K,T,C,CA,A>& r )
+ {
+ return r.clone().release();
+ }
+
+ template< class K, class T, class C, class CA, class A >
+ inline ptr_multimap<K,T,C,CA,A>* new_clone( const ptr_multimap<K,T,C,CA,A>& r )
+ {
+ return r.clone().release();
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // swap
+
+ template< typename K, typename T, typename C, typename CA, typename A >
+ inline void swap( ptr_map<K,T,C,CA,A>& l, ptr_map<K,T,C,CA,A>& r )
+ {
+ l.swap(r);
+ }
+
+ template< typename K, typename T, typename C, typename CA, typename A >
+ inline void swap( ptr_multimap<K,T,C,CA,A>& l, ptr_multimap<K,T,C,CA,A>& r )
+ {
+ l.swap(r);
+ }
+
+
+}
+
+#endif

Added: trunk/boost/ptr_container/serialize_ptr_circular_buffer.hpp
==============================================================================
Binary file. No diff available.


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