|
Boost-Commit : |
From: nesotto_at_[hidden]
Date: 2008-06-24 16:37:37
Author: nesotto
Date: 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
New Revision: 46662
URL: http://svn.boost.org/trac/boost/changeset/46662
Log:
update from trunk
Added:
branches/release/boost/ptr_container/detail/meta_functions.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/detail/meta_functions.hpp
branches/release/boost/ptr_container/ptr_circular_buffer.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/ptr_circular_buffer.hpp
branches/release/boost/ptr_container/ptr_inserter.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/ptr_inserter.hpp
branches/release/boost/ptr_container/ptr_unordered_map.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/ptr_unordered_map.hpp
branches/release/boost/ptr_container/ptr_unordered_set.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/ptr_unordered_set.hpp
branches/release/boost/ptr_container/serialize_ptr_circular_buffer.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/serialize_ptr_circular_buffer.hpp
branches/release/boost/ptr_container/serialize_ptr_unordered_map.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/serialize_ptr_unordered_map.hpp
branches/release/boost/ptr_container/serialize_ptr_unordered_set.hpp
- copied unchanged from r46660, /trunk/boost/ptr_container/serialize_ptr_unordered_set.hpp
Binary files modified:
branches/release/boost/ptr_container/serialize_ptr_container.hpp
Text files modified:
branches/release/boost/ptr_container/clone_allocator.hpp | 4
branches/release/boost/ptr_container/detail/associative_ptr_container.hpp | 256 +++++++++++++++++++++++-----
branches/release/boost/ptr_container/detail/map_iterator.hpp | 45 +++++
branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp | 178 ++++++++++++++-----
branches/release/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp | 18 +-
branches/release/boost/ptr_container/detail/serialize_reversible_cont.hpp | 10
branches/release/boost/ptr_container/detail/serialize_xml_names.hpp | 6
branches/release/boost/ptr_container/ptr_array.hpp | 29 +--
branches/release/boost/ptr_container/ptr_container.hpp | 6
branches/release/boost/ptr_container/ptr_deque.hpp | 2
branches/release/boost/ptr_container/ptr_list.hpp | 20 ++
branches/release/boost/ptr_container/ptr_map.hpp | 38 ++-
branches/release/boost/ptr_container/ptr_map_adapter.hpp | 359 ++++++++++++++++++++++++++++++---------
branches/release/boost/ptr_container/ptr_sequence_adapter.hpp | 208 +++++++++++++++++-----
branches/release/boost/ptr_container/ptr_set.hpp | 44 +++-
branches/release/boost/ptr_container/ptr_set_adapter.hpp | 217 +++++++++++++++++++-----
branches/release/boost/ptr_container/ptr_vector.hpp | 2
branches/release/boost/ptr_container/serialize_ptr_array.hpp | 4
branches/release/boost/ptr_container/serialize_ptr_vector.hpp | 2
19 files changed, 1105 insertions(+), 343 deletions(-)
Modified: branches/release/boost/ptr_container/clone_allocator.hpp
==============================================================================
--- branches/release/boost/ptr_container/clone_allocator.hpp (original)
+++ branches/release/boost/ptr_container/clone_allocator.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -70,11 +70,11 @@
template< class U >
static U* allocate_clone( const U& r )
{
- return const_cast<U*>( &r );
+ return const_cast<U*>(&r);
}
template< class U >
- static void deallocate_clone( const U* r )
+ static void deallocate_clone( const U* /*r*/ )
{
// do nothing
}
Modified: branches/release/boost/ptr_container/detail/associative_ptr_container.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/associative_ptr_container.hpp (original)
+++ branches/release/boost/ptr_container/detail/associative_ptr_container.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -38,6 +38,8 @@
typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter
scoped_deleter;
+ typedef BOOST_DEDUCED_TYPENAME Config::container_type
+ container_type;
public: // typedefs
typedef BOOST_DEDUCED_TYPENAME Config::key_type
key_type;
@@ -45,65 +47,88 @@
key_compare;
typedef BOOST_DEDUCED_TYPENAME Config::value_compare
value_compare;
+ typedef BOOST_DEDUCED_TYPENAME Config::hasher
+ hasher;
+ typedef BOOST_DEDUCED_TYPENAME Config::key_equal
+ key_equal;
typedef BOOST_DEDUCED_TYPENAME Config::iterator
iterator;
typedef BOOST_DEDUCED_TYPENAME Config::const_iterator
const_iterator;
+ typedef BOOST_DEDUCED_TYPENAME Config::local_iterator
+ local_iterator;
+ typedef BOOST_DEDUCED_TYPENAME Config::const_local_iterator
+ const_local_iterator;
typedef BOOST_DEDUCED_TYPENAME base_type::size_type
size_type;
+ typedef BOOST_DEDUCED_TYPENAME base_type::reference
+ reference;
+ typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
+ const_reference;
public: // foundation
+ associative_ptr_container()
+ { }
- template< class Compare, class Allocator >
- associative_ptr_container( const Compare& comp,
- const Allocator& a )
- : base_type( comp, a )
- { }
-
- template< class InputIterator, class Compare, class Allocator >
- associative_ptr_container( InputIterator first, InputIterator last,
- const Compare& comp,
- const Allocator& a )
- : base_type( first, last, comp, a )
- { }
-
- template< class PtrContainer >
- explicit associative_ptr_container( std::auto_ptr<PtrContainer> r )
- : base_type( r, key_compare() )
- { }
-
- explicit associative_ptr_container( const associative_ptr_container& r )
- : base_type( r.begin(), r.end(), key_compare(),
- BOOST_DEDUCED_TYPENAME Config::allocator_type() )
- { }
-
- template< class C, class V >
- explicit associative_ptr_container( const associative_ptr_container<C,V>& r )
- : base_type( r.begin(), r.end(), key_compare(),
- BOOST_DEDUCED_TYPENAME Config::allocator_type() )
- { }
-
- template< class PtrContainer >
- associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow
- {
+ template< class SizeType >
+ associative_ptr_container( SizeType n, unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
+
+ template< class Compare, class Allocator >
+ associative_ptr_container( const Compare& comp,
+ const Allocator& a )
+ : base_type( comp, a, container_type() )
+ { }
+
+ template< class Hash, class Pred, class Allocator >
+ associative_ptr_container( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
+ template< class InputIterator, class Compare, class Allocator >
+ associative_ptr_container( InputIterator first, InputIterator last,
+ const Compare& comp,
+ const Allocator& a )
+ : base_type( first, last, comp, a, container_type() )
+ { }
+
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ associative_ptr_container( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( first, last, hash, pred, a )
+ { }
+
+ template< class PtrContainer >
+ explicit associative_ptr_container( std::auto_ptr<PtrContainer> r )
+ : base_type( r )
+ { }
+
+ associative_ptr_container( const associative_ptr_container& r )
+ : base_type( r.begin(), r.end(), container_type() )
+ { }
+
+ template< class C, class V >
+ associative_ptr_container( const associative_ptr_container<C,V>& r )
+ : base_type( r.begin(), r.end(), container_type() )
+ { }
+
+ template< class PtrContainer >
+ associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow
+ {
base_type::operator=( r );
return *this;
- }
-
- template< class C, class V >
- associative_ptr_container& operator=( const associative_ptr_container<C,V>& r ) // strong
- {
- associative_ptr_container clone( r );
- this->swap( clone );
- return *this;
- }
+ }
- associative_ptr_container& operator=( const associative_ptr_container& r ) // strong
- {
- associative_ptr_container clone( r );
- this->swap( clone );
+ associative_ptr_container& operator=( associative_ptr_container r ) // strong
+ {
+ this->swap( r );
return *this;
- }
+ }
public: // associative container interface
key_compare key_comp() const
@@ -236,6 +261,145 @@
}
return res;
}
+
+ reference front()
+ {
+ BOOST_ASSERT( !this->empty() );
+ BOOST_ASSERT( *this->begin().base() != 0 );
+ return *this->begin();
+ }
+
+ const_reference front() const
+ {
+ return const_cast<associative_ptr_container*>(this)->front();
+ }
+
+ reference back()
+ {
+ BOOST_ASSERT( !this->empty() );
+ BOOST_ASSERT( *(--this->end()).base() != 0 );
+ return *--this->end();
+ }
+
+ const_reference back() const
+ {
+ return const_cast<associative_ptr_container*>(this)->back();
+ }
+
+ protected: // unordered interface
+ hasher hash_function() const
+ {
+ return this->base().hash_function();
+ }
+
+ key_equal key_eq() const
+ {
+ return this->base().key_eq();
+ }
+
+ size_type bucket_count() const
+ {
+ return this->base().bucket_count();
+ }
+
+ size_type max_bucket_count() const
+ {
+ return this->base().max_bucket_count();
+ }
+
+ size_type bucket_size( size_type n ) const
+ {
+ return this->base().bucket_size( n );
+ }
+
+ float load_factor() const
+ {
+ return this->base().load_factor();
+ }
+
+ float max_load_factor() const
+ {
+ return this->base().max_load_factor();
+ }
+
+ void max_load_factor( float factor )
+ {
+ return this->base().max_load_factor( factor );
+ }
+
+ void rehash( size_type n )
+ {
+ this->base().rehash( n );
+ }
+
+ public:
+#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(70190006))
+ iterator begin()
+ {
+ return base_type::begin();
+ }
+
+ const_iterator begin() const
+ {
+ return base_type::begin();
+ }
+
+ iterator end()
+ {
+ return base_type::end();
+ }
+
+ const_iterator end() const
+ {
+ return base_type::end();
+ }
+
+ const_iterator cbegin() const
+ {
+ return base_type::cbegin();
+ }
+
+ const_iterator cend() const
+ {
+ return base_type::cend();
+ }
+#else
+ using base_type::begin;
+ using base_type::end;
+ using base_type::cbegin;
+ using base_type::cend;
+#endif
+
+ protected:
+ local_iterator begin( size_type n )
+ {
+ return local_iterator( this->base().begin( n ) );
+ }
+
+ const_local_iterator begin( size_type n ) const
+ {
+ return const_local_iterator( this->base().begin( n ) );
+ }
+
+ local_iterator end( size_type n )
+ {
+ return local_iterator( this->base().end( n ) );
+ }
+
+ const_local_iterator end( size_type n ) const
+ {
+ return const_local_iterator( this->base().end( n ) );
+ }
+
+ const_local_iterator cbegin( size_type n ) const
+ {
+ return const_local_iterator( this->base().cbegin( n ) );
+ }
+
+ const_local_iterator cend( size_type n )
+ {
+ return const_local_iterator( this->base().cend( n ) );
+ }
}; // class 'associative_ptr_container'
Modified: branches/release/boost/ptr_container/detail/map_iterator.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/map_iterator.hpp (original)
+++ branches/release/boost/ptr_container/detail/map_iterator.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -18,8 +18,14 @@
#include <boost/config.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/utility/compare_pointees.hpp>
#include <utility>
+#if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable:4512) // Assignment operator could not be generated.
+#endif
+
namespace boost
{
namespace ptr_container_detail
@@ -47,6 +53,41 @@
{
return this;
}
+
+ friend inline bool operator==( ref_pair l, ref_pair r )
+ {
+ return l.first == r.first &&
+ boost::equal_pointees( l.second, r.second );
+ }
+
+ friend inline bool operator!=( ref_pair l, ref_pair r )
+ {
+ return !( l == r );
+ }
+
+ friend inline bool operator<( ref_pair l, ref_pair r )
+ {
+ if( l.first == r.first )
+ return boost::less_pointees( l.second, r.second );
+ else
+ return l.first < r.first;
+ }
+
+ friend inline bool operator>( ref_pair l, ref_pair r )
+ {
+ return r < l;
+ }
+
+ friend inline bool operator<=( ref_pair l, ref_pair r )
+ {
+ return !(r < l);
+ }
+
+ friend inline bool operator>=( ref_pair l, ref_pair r )
+ {
+ return !(l < r);
+ }
+
};
}
@@ -84,4 +125,8 @@
}
+#if defined(BOOST_MSVC)
+# pragma warning(pop)
+#endif
+
#endif
Modified: branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp (original)
+++ branches/release/boost/ptr_container/detail/reversible_ptr_container.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -66,8 +66,13 @@
struct is_pointer_or_integral_tag {};
struct is_range_tag {};
-
+ struct sequence_tag {};
+ struct fixed_length_sequence_tag : sequence_tag {};
+ struct associative_container_tag {};
+ struct ordered_associative_container_tag : associative_container_tag {};
+ struct unordered_associative_container_tag : associative_container_tag {};
+
template
<
@@ -135,6 +140,7 @@
public:
Cont& base() { return c_; }
+ protected: // having this public could break encapsulation
const Cont& base() const { return c_; }
public: // typedefs
@@ -157,7 +163,7 @@
size_type;
typedef BOOST_DEDUCED_TYPENAME Config::allocator_type
allocator_type;
-
+ typedef CloneAllocator clone_allocator_type;
typedef ptr_container_detail::static_move_ptr<Ty_,Deleter>
auto_type;
@@ -291,30 +297,57 @@
clone_back_insert( first, last );
}
+ template< class I >
+ void associative_constructor_impl( I first, I last ) // strong
+ {
+ if( first == last )
+ return;
+
+ scoped_deleter sd( first, last );
+ insert_clones_and_release( sd );
+ }
+
public: // foundation! should be protected!
- reversible_ptr_container( const allocator_type& a = allocator_type() )
+ reversible_ptr_container()
+ { }
+
+ template< class SizeType >
+ reversible_ptr_container( SizeType n, unordered_associative_container_tag )
+ : c_( n )
+ { }
+
+ template< class SizeType >
+ reversible_ptr_container( SizeType n, fixed_length_sequence_tag )
+ : c_( n )
+ { }
+
+ template< class SizeType >
+ reversible_ptr_container( SizeType n, const allocator_type& a,
+ fixed_length_sequence_tag )
+ : c_( n, a )
+ { }
+
+ explicit reversible_ptr_container( const allocator_type& a )
: c_( a )
- {}
+ { }
template< class PtrContainer >
- explicit reversible_ptr_container( std::auto_ptr<PtrContainer> clone )
- : c_( allocator_type() )
+ explicit reversible_ptr_container( std::auto_ptr<PtrContainer> clone )
{
swap( *clone );
}
- explicit reversible_ptr_container( const reversible_ptr_container& r )
+ reversible_ptr_container( const reversible_ptr_container& r )
{
- constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
+ constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
}
template< class C, class V >
- explicit reversible_ptr_container( const reversible_ptr_container<C,V>& r )
+ reversible_ptr_container( const reversible_ptr_container<C,V>& r )
{
- constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
+ constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
}
-
template< class PtrContainer >
reversible_ptr_container& operator=( std::auto_ptr<PtrContainer> clone ) // nothrow
{
@@ -322,27 +355,19 @@
return *this;
}
- reversible_ptr_container& operator=( const reversible_ptr_container& r ) // strong
- {
- reversible_ptr_container clone( r );
- swap( clone );
- return *this;
- }
-
- template< class C, class V >
- reversible_ptr_container& operator=( const reversible_ptr_container<C,V>& r ) // strong
+ reversible_ptr_container& operator=( reversible_ptr_container r ) // strong
{
- reversible_ptr_container clone( r );
- swap( clone );
+ swap( r );
return *this;
}
+
// overhead: null-initilization of container pointer (very cheap compared to cloning)
// overhead: 1 heap allocation (very cheap compared to cloning)
template< class InputIterator >
reversible_ptr_container( InputIterator first,
InputIterator last,
const allocator_type& a = allocator_type() ) // basic, strong
- : c_( a )
+ : c_( a )
{
constructor_impl( first, last,
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
@@ -355,28 +380,77 @@
template< class Compare >
reversible_ptr_container( const Compare& comp,
const allocator_type& a )
- : c_( comp, a ) {}
+ : c_( comp, a ) {}
+ template< class ForwardIterator >
+ reversible_ptr_container( ForwardIterator first,
+ ForwardIterator last,
+ fixed_length_sequence_tag )
+ : c_( std::distance(first,last) )
+ {
+ constructor_impl( first, last,
+ std::forward_iterator_tag() );
+ }
+
+ template< class SizeType, class InputIterator >
+ reversible_ptr_container( SizeType n,
+ InputIterator first,
+ InputIterator last,
+ fixed_length_sequence_tag )
+ : c_( n )
+ {
+ constructor_impl( first, last,
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+#else
+ BOOST_DEDUCED_TYPENAME
+#endif
+ iterator_category<InputIterator>::type() );
+ }
+
+ template< class Compare >
+ reversible_ptr_container( const Compare& comp,
+ const allocator_type& a,
+ associative_container_tag )
+ : c_( comp, a )
+ { }
+
+ template< class InputIterator >
+ reversible_ptr_container( InputIterator first,
+ InputIterator last,
+ associative_container_tag )
+ {
+ associative_constructor_impl( first, last );
+ }
+
template< class InputIterator, class Compare >
reversible_ptr_container( InputIterator first,
InputIterator last,
const Compare& comp,
- const allocator_type& a )
- : c_( comp, a )
+ const allocator_type& a,
+ associative_container_tag )
+ : c_( comp, a )
{
- if( first == last )
- return;
-
- scoped_deleter sd( first, last );
- insert_clones_and_release( sd );
+ associative_constructor_impl( first, last );
}
- template< class PtrContainer, class Compare >
- reversible_ptr_container( std::auto_ptr<PtrContainer> clone,
- Compare comp )
- : c_( comp, allocator_type() )
- {
- swap( *clone );
+ explicit reversible_ptr_container( size_type n )
+ : c_( n ) {}
+
+ template< class Hash, class Pred >
+ reversible_ptr_container( const Hash& hash,
+ const Pred& pred,
+ const allocator_type& a )
+ : c_( hash, pred, a ) {}
+
+ template< class InputIterator, class Hash, class Pred >
+ reversible_ptr_container( InputIterator first,
+ InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const allocator_type& a )
+ : c_( hash, pred, a )
+ {
+ associative_constructor_impl( first, last );
}
public:
@@ -410,7 +484,17 @@
{ return reverse_iterator( this->begin() ); }
const_reverse_iterator rend() const
{ return const_reverse_iterator( this->begin() ); }
-
+
+ const_iterator cbegin() const
+ { return const_iterator( c_.begin() ); }
+ const_iterator cend() const
+ { return const_iterator( c_.end() ); }
+
+ const_reverse_iterator crbegin() const
+ { return const_reverse_iterator( this->end() ); }
+ const_reverse_iterator crend() const
+ { return const_reverse_iterator( this->begin() ); }
+
void swap( reversible_ptr_container& r ) // nothrow
{
c_.swap( r.c_ );
@@ -613,25 +697,27 @@
#define BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( PC, base_type ) \
\
template< class U > \
- explicit PC( const PC<U>& r ) : base_type( r ) { } \
+ PC( const PC<U>& r ) : base_type( r ) { } \
\
- template< class U > \
- PC& operator=( const PC<U>& r ) \
+ PC& operator=( PC r ) \
{ \
- base_type::operator=( r ); \
+ this->swap( r ); \
return *this; \
- }
-
+ } \
+
#define BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( PC, base_type ) \
typedef BOOST_DEDUCED_TYPENAME base_type::iterator iterator; \
typedef BOOST_DEDUCED_TYPENAME base_type::size_type size_type; \
typedef BOOST_DEDUCED_TYPENAME base_type::const_reference const_reference; \
typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type allocator_type; \
- explicit PC( const allocator_type& a = allocator_type() ) : base_type(a) {} \
+ PC() {} \
+ explicit PC( const allocator_type& a ) : base_type(a) {} \
+ template< class InputIterator > \
+ PC( InputIterator first, InputIterator last ) : base_type( first, last ) {} \
template< class InputIterator > \
PC( InputIterator first, InputIterator last, \
- const allocator_type& a = allocator_type() ) : base_type( first, last, a ) {}
+ const allocator_type& a ) : base_type( first, last, a ) {}
#define BOOST_PTR_CONTAINER_DEFINE_NON_INHERITED_MEMBERS( PC, base_type, this_type ) \
BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( PC, base_type ) \
Modified: branches/release/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp (original)
+++ branches/release/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -16,10 +16,10 @@
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)
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
+void save(Archive& ar, const ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
{
- typedef ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator> container;
+ typedef ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, CloneAllocator,Ordered> container;
typedef BOOST_DEDUCED_TYPENAME container::const_iterator const_iterator;
ar << boost::serialization::make_nvp( ptr_container_detail::count(),
@@ -34,10 +34,10 @@
}
}
-template<class Archive, class T, class VoidPtrMap, class CloneAllocator>
-void load(Archive& ar, ptr_map_adapter<T, VoidPtrMap, CloneAllocator>& c, unsigned int version)
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
+void load(Archive& ar, ptr_map_adapter<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
{
- typedef ptr_map_adapter<T, VoidPtrMap, CloneAllocator> container;
+ typedef ptr_map_adapter<T, VoidPtrMap, CloneAllocator,Ordered> 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;
@@ -57,10 +57,10 @@
}
}
-template<class Archive, class T, class VoidPtrMap, class CloneAllocator>
-void load(Archive& ar, ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator>& c, unsigned int version)
+template<class Archive, class T, class VoidPtrMap, class CloneAllocator, bool Ordered>
+void load(Archive& ar, ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator,Ordered>& c, unsigned int /*version*/)
{
- typedef ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator> container;
+ typedef ptr_multimap_adapter<T, VoidPtrMap, CloneAllocator,Ordered> 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;
Modified: branches/release/boost/ptr_container/detail/serialize_reversible_cont.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/serialize_reversible_cont.hpp (original)
+++ branches/release/boost/ptr_container/detail/serialize_reversible_cont.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -16,12 +16,6 @@
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)
{
@@ -66,7 +60,7 @@
{
template<class Archive, class Config, class CloneAllocator>
-void save(Archive& ar, const ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int version)
+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()) );
@@ -74,7 +68,7 @@
}
template<class Archive, class Config, class CloneAllocator>
-void load(Archive& ar, ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>& c, unsigned int version)
+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;
Modified: branches/release/boost/ptr_container/detail/serialize_xml_names.hpp
==============================================================================
--- branches/release/boost/ptr_container/detail/serialize_xml_names.hpp (original)
+++ branches/release/boost/ptr_container/detail/serialize_xml_names.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -20,6 +20,12 @@
inline const char* item() { return "item"; }
inline const char* first() { return "first"; }
inline const char* second() { return "second"; }
+
+ template<class T>
+ inline T const& serialize_as_const(T const& r)
+ {
+ return r;
+ }
}
}
#endif
Modified: branches/release/boost/ptr_container/ptr_array.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_array.hpp (original)
+++ branches/release/boost/ptr_container/ptr_array.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -36,12 +36,12 @@
public:
typedef Allocator allocator_type;
- ptr_array_impl( Allocator a = Allocator() )
+ ptr_array_impl( Allocator /*a*/ = Allocator() )
{
this->assign( 0 );
}
- ptr_array_impl( size_t, T*, Allocator a = Allocator() )
+ ptr_array_impl( size_t, T*, Allocator /*a*/ = Allocator() )
{
this->assign( 0 );
}
@@ -83,41 +83,30 @@
ptr_array() : base_class()
{ }
- explicit ptr_array( const ptr_array& r )
+ ptr_array( const ptr_array& r )
{
size_t i = 0;
for( ; i != N; ++i )
this->base()[i] = this->null_policy_allocate_clone(
- static_cast<T*>( r.base()[i] ) );
+ static_cast<const T*>( &r[i] ) );
}
template< class U >
- explicit ptr_array( const ptr_array<U,N>& r )
+ ptr_array( const ptr_array<U,N>& r )
{
size_t i = 0;
for( ; i != N; ++i )
this->base()[i] = this->null_policy_allocate_clone(
- static_cast<U*>( r.base()[i] ) );
+ static_cast<const T*>( &r[i] ) );
}
explicit ptr_array( std::auto_ptr<this_type> r )
: base_class( r ) { }
- ptr_array& operator=( const ptr_array& r )
+ ptr_array& operator=( ptr_array r )
{
- ptr_array clone( r );
- this->swap( clone );
- return *this;
-
- }
-
- template< class U >
- ptr_array& operator=( const ptr_array<U,N>& r )
- {
- ptr_array clone( r );
- this->swap( clone );
- return *this;
-
+ this->swap( r );
+ return *this;
}
ptr_array& operator=( std::auto_ptr<this_type> r )
Modified: branches/release/boost/ptr_container/ptr_container.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_container.hpp (original)
+++ branches/release/boost/ptr_container/ptr_container.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -1,7 +1,7 @@
//
// Boost.Pointer Container
//
-// Copyright Thorsten Ottosen 2003-2005. Use, modification and
+// Copyright Thorsten Ottosen 2003-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)
@@ -22,6 +22,10 @@
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/ptr_container/ptr_set.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_unordered_map.hpp>
+#include <boost/ptr_container/ptr_unordered_set.hpp>
+#include <boost/ptr_container/ptr_circular_buffer.hpp>
+#include <boost/ptr_container/ptr_inserter.hpp>
#endif
Modified: branches/release/boost/ptr_container/ptr_deque.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_deque.hpp (original)
+++ branches/release/boost/ptr_container/ptr_deque.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -44,7 +44,7 @@
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_deque,
base_class,
- this_type );
+ this_type )
};
//////////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/ptr_container/ptr_list.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_list.hpp (original)
+++ branches/release/boost/ptr_container/ptr_list.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -38,12 +38,14 @@
CloneAllocator >
base_class;
- typedef ptr_list<T,CloneAllocator,Allocator> this_type;
+ typedef ptr_list<T,CloneAllocator,Allocator> this_type;
public:
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_list,
base_class,
- this_type );
+ this_type )
+
+ typedef BOOST_DEDUCED_TYPENAME base_class::value_type value_type;
public:
using base_class::merge;
@@ -69,6 +71,20 @@
this->base().sort( void_ptr_indirect_fun<Compare,T>( comp ) );
}
+ template< class Pred >
+ void erase_if( iterator first, iterator last, Pred pred )
+ {
+ base_class::erase_if( first, last, pred );
+ }
+
+ template< class Pred >
+ void erase_if( Pred pred )
+ {
+ this->base().remove_if( BOOST_DEDUCED_TYPENAME base_class::
+ BOOST_NESTED_TEMPLATE void_ptr_delete_if<Pred,value_type>
+ (pred) );
+ }
+
}; // class 'ptr_list'
//////////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/ptr_container/ptr_map.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_map.hpp (original)
+++ branches/release/boost/ptr_container/ptr_map.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -41,28 +41,35 @@
typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
public:
- explicit ptr_map( const Compare& comp = Compare(),
+ ptr_map()
+ { }
+
+ explicit ptr_map( const Compare& comp,
const Allocator& a = Allocator() )
: base_type( comp, a ) { }
template< class InputIterator >
+ ptr_map( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
+ template< class InputIterator >
ptr_map( InputIterator first, InputIterator last,
- const Compare& comp = Compare(),
+ const Compare& comp,
const Allocator& a = Allocator() )
: base_type( first, last, comp, a )
{ }
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
- this_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 )
+ ptr_map& operator=( ptr_map r )
{
- base_type::operator=( r );
+ this->swap( r );
return *this;
}
};
@@ -88,29 +95,36 @@
typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
public:
- explicit ptr_multimap( const Compare& comp = Compare(),
+ ptr_multimap()
+ { }
+
+ explicit ptr_multimap( const Compare& comp,
const Allocator& a = Allocator() )
: base_type( comp, a ) { }
+
+ template< class InputIterator >
+ ptr_multimap( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
template< class InputIterator >
ptr_multimap( InputIterator first, InputIterator last,
- const Compare& comp = Compare(),
+ const Compare& comp,
const Allocator& a = Allocator() )
: base_type( first, last, comp, a )
{ }
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
base_type,
- this_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 )
+ ptr_multimap& operator=( ptr_multimap r )
{
- base_type::operator=( r );
+ this->swap( r );
return *this;
}
};
Modified: branches/release/boost/ptr_container/ptr_map_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_map_adapter.hpp (original)
+++ branches/release/boost/ptr_container/ptr_map_adapter.hpp 2008-06-24 16:37:35 EDT (Tue, 24 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
>
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;
@@ -57,7 +83,23 @@
typedef ptr_map_iterator< BOOST_DEDUCED_TYPENAME VoidPtrMap::const_iterator, key_type, const U* const>
const_iterator;
-
+
+ typedef ptr_map_iterator<
+ BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_iterator<VoidPtrMap>,
+ select_local_iterator<VoidPtrMap> >::type,
+ key_type, U* const >
+ local_iterator;
+
+ typedef ptr_map_iterator<
+ BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_iterator<VoidPtrMap>,
+ select_const_local_iterator<VoidPtrMap> >::type,
+ key_type, const U* const >
+ const_local_iterator;
+
template< class Iter >
static U* get_pointer( Iter i )
{
@@ -79,19 +121,19 @@
<
class T,
class VoidPtrMap,
- class CloneAllocator
+ class CloneAllocator,
+ bool Ordered
>
class ptr_map_adapter_base :
- public ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap>,
+ public ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
CloneAllocator >
{
- typedef ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap>,
+ typedef ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
CloneAllocator >
base_type;
- typedef map_config<T,VoidPtrMap> config;
-
- typedef ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator> this_type;
+ typedef map_config<T,VoidPtrMap,Ordered> config;
+ typedef ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered> this_type;
public:
@@ -153,6 +195,9 @@
}
void release() { released_ = true; }
+
+ private:
+ eraser& operator=(const eraser&);
};
mapped_reference insert_lookup( const key_type& key )
@@ -174,18 +219,48 @@
public:
- template< class InputIterator >
- ptr_map_adapter_base( InputIterator first, InputIterator last,
- const allocator_type& a = allocator_type() )
- : base_type( first, last, a )
+ ptr_map_adapter_base()
{ }
-
+
+ template< class SizeType >
+ explicit ptr_map_adapter_base( SizeType n,
+ ptr_container_detail::unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
+
template< class Compare, class Allocator >
ptr_map_adapter_base( const Compare& comp,
const Allocator& a )
: base_type( comp, a )
{ }
-
+
+ template< class Hash, class Pred, class Allocator >
+ ptr_map_adapter_base( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
+ template< class InputIterator >
+ ptr_map_adapter_base( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
+ template< class InputIterator, class Comp >
+ ptr_map_adapter_base( InputIterator first, InputIterator last,
+ const Comp& comp,
+ const allocator_type& a = allocator_type() )
+ : base_type( first, last, comp, a )
+ { }
+
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_map_adapter_base( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( first, last, hash, pred, a )
+ { }
+
template< class PtrContainer >
explicit ptr_map_adapter_base( std::auto_ptr<PtrContainer> clone )
: base_type( clone )
@@ -287,6 +362,12 @@
{
return replace( where, x.release() );
}
+
+ protected:
+ size_type bucket( const key_type& key ) const
+ {
+ return this->base().bucket( key );
+ }
};
} // ptr_container_detail
@@ -299,12 +380,13 @@
<
class T,
class VoidPtrMap,
- class CloneAllocator = heap_clone_allocator
+ class CloneAllocator = heap_clone_allocator,
+ bool Ordered = true
>
class ptr_map_adapter :
- public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator>
+ public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
{
- typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator>
+ typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
base_type;
public:
@@ -320,8 +402,6 @@
const_reference;
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
auto_type;
- typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::key_compare
- key_compare;
typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
allocator_type;
typedef BOOST_DEDUCED_TYPENAME base_type::mapped_type
@@ -356,29 +436,53 @@
}
public:
+ ptr_map_adapter( )
+ { }
- explicit ptr_map_adapter( const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type() )
+ template< class Comp >
+ explicit ptr_map_adapter( const Comp& comp,
+ const allocator_type& a )
: base_type( comp, a ) { }
-
+
+ template< class Hash, class Pred, class Allocator >
+ ptr_map_adapter( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
template< class InputIterator >
+ ptr_map_adapter( InputIterator first, InputIterator last )
+ {
+ map_basic_clone_and_insert( first, last );
+ }
+
+ template< class InputIterator, class Comp >
ptr_map_adapter( InputIterator first, InputIterator last,
- const key_compare& comp = key_compare(),
+ const Comp& comp,
const allocator_type& a = allocator_type() )
: base_type( comp, a )
{
map_basic_clone_and_insert( first, last );
}
- explicit ptr_map_adapter( const ptr_map_adapter& r )
- : base_type( key_compare(), allocator_type() )
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_map_adapter( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ {
+ map_basic_clone_and_insert( first, last );
+ }
+
+ ptr_map_adapter( const ptr_map_adapter& r )
{
map_basic_clone_and_insert( r.begin(), r.end() );
}
- template< class Key, class U >
- explicit ptr_map_adapter( const ptr_map_adapter<Key,U>& r )
- : base_type( key_compare(), allocator_type() )
+ template< class Key, class U, class CA, bool b >
+ ptr_map_adapter( const ptr_map_adapter<Key,U,CA,b>& r )
{
map_basic_clone_and_insert( r.begin(), r.end() );
}
@@ -387,18 +491,9 @@
ptr_map_adapter( std::auto_ptr<U> r ) : base_type( r )
{ }
- ptr_map_adapter& operator=( const ptr_map_adapter& r )
+ ptr_map_adapter& operator=( ptr_map_adapter r )
{
- ptr_map_adapter clone( r );
- this->swap( clone );
- return *this;
- }
-
- template< class Key, class U >
- ptr_map_adapter& operator=( const ptr_map_adapter<Key,U>& r )
- {
- ptr_map_adapter clone( r );
- this->swap( clone );
+ this->swap( r );
return *this;
}
@@ -435,6 +530,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 +556,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
@@ -493,12 +627,13 @@
<
class T,
class VoidPtrMultiMap,
- class CloneAllocator = heap_clone_allocator
+ class CloneAllocator = heap_clone_allocator,
+ bool Ordered = true
>
class ptr_multimap_adapter :
- public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator>
+ public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
{
- typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator>
+ typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
base_type;
public: // typedefs
@@ -516,8 +651,6 @@
mapped_type;
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
auto_type;
- typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiMap::key_compare
- key_compare;
typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiMap::allocator_type
allocator_type;
private:
@@ -545,29 +678,60 @@
}
public:
-
- explicit ptr_multimap_adapter( const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type() )
+
+ ptr_multimap_adapter()
+ { }
+
+ template< class SizeType >
+ ptr_multimap_adapter( SizeType n,
+ ptr_container_detail::unordered_associative_container_tag tag )
+ : base_type( n, tag )
+ { }
+
+ template< class Comp >
+ explicit ptr_multimap_adapter( const Comp& comp,
+ const allocator_type& a )
: base_type( comp, a ) { }
-
+
+ template< class Hash, class Pred, class Allocator >
+ ptr_multimap_adapter( const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ { }
+
template< class InputIterator >
+ ptr_multimap_adapter( InputIterator first, InputIterator last )
+ {
+ map_basic_clone_and_insert( first, last );
+ }
+
+ template< class InputIterator, class Comp >
ptr_multimap_adapter( InputIterator first, InputIterator last,
- const key_compare& comp = key_compare(),
- const allocator_type& a = allocator_type() )
+ const Comp& comp,
+ const allocator_type& a )
: base_type( comp, a )
{
map_basic_clone_and_insert( first, last );
}
- explicit ptr_multimap_adapter( const ptr_multimap_adapter& r )
- : base_type( key_compare(), allocator_type() )
+ template< class InputIterator, class Hash, class Pred, class Allocator >
+ ptr_multimap_adapter( InputIterator first, InputIterator last,
+ const Hash& hash,
+ const Pred& pred,
+ const Allocator& a )
+ : base_type( hash, pred, a )
+ {
+ map_basic_clone_and_insert( first, last );
+ }
+
+ ptr_multimap_adapter( const ptr_multimap_adapter& r )
{
map_basic_clone_and_insert( r.begin(), r.end() );
}
- template< class Key, class U >
- explicit ptr_multimap_adapter( const ptr_multimap_adapter<Key,U>& r )
- : base_type( key_compare(), allocator_type() )
+ template< class Key, class U, class CA, bool b >
+ ptr_multimap_adapter( const ptr_multimap_adapter<Key,U,CA,b>& r )
{
map_basic_clone_and_insert( r.begin(), r.end() );
}
@@ -576,21 +740,12 @@
explicit ptr_multimap_adapter( std::auto_ptr<U> r ) : base_type( r )
{ }
- ptr_multimap_adapter& operator=( const ptr_multimap_adapter& r )
+ ptr_multimap_adapter& operator=( ptr_multimap_adapter r )
{
- ptr_multimap_adapter clone( r );
- this->swap( clone );
+ this->swap( r );
return *this;
}
- template< class Key, class U >
- ptr_multimap_adapter& operator=( const ptr_multimap_adapter<Key,U>& r )
- {
- ptr_multimap_adapter clone( r );
- this->swap( clone );
- return *this;
- }
-
template< class U >
ptr_multimap_adapter& operator=( std::auto_ptr<U> r )
{
@@ -599,7 +754,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 +796,36 @@
iterator insert( key_type& key, mapped_type x ) // strong
{
- this->enforce_null_policy( x,
+ return insert_impl( key, x );
+ }
+
+ template< class U >
+ iterator insert( const key_type& key, std::auto_ptr<U> x )
+ {
+ 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;
+ }
- 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( iterator before, key_type& key, mapped_type x ) // strong
+ {
+ return insert_impl( before, key, x );
}
template< class U >
- iterator insert( key_type& key, std::auto_ptr<U> x )
+ iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong
{
- return insert( key, x.release() );
+ return insert_impl( before, key, x.release() );
}
-
+
template< class PtrMapAdapter >
void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
PtrMapAdapter& from ) // strong
Modified: branches/release/boost/ptr_container/ptr_sequence_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_sequence_adapter.hpp (original)
+++ branches/release/boost/ptr_container/ptr_sequence_adapter.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -134,34 +134,100 @@
CloneAllocator >
base_type;
- typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter scoped_deleter;
-
typedef ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>
this_type;
+
+ protected:
+ typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter scoped_deleter;
public:
typedef BOOST_DEDUCED_TYPENAME base_type::value_type value_type;
typedef BOOST_DEDUCED_TYPENAME base_type::reference reference;
+ typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
+ const_reference;
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type auto_type;
-
- BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( ptr_sequence_adapter,
- base_type )
+ typedef BOOST_DEDUCED_TYPENAME base_type::clone_allocator_type
+ clone_allocator_type;
+ typedef BOOST_DEDUCED_TYPENAME base_type::iterator iterator;
+ typedef BOOST_DEDUCED_TYPENAME base_type::size_type size_type;
+ typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type
+ allocator_type;
+
+ ptr_sequence_adapter()
+ { }
+
+ template< class Allocator >
+ explicit ptr_sequence_adapter( const Allocator& a )
+ : base_type( a )
+ { }
+
+ template< class SizeType >
+ ptr_sequence_adapter( SizeType n,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( n, tag )
+ { }
+
+ template< class SizeType, class Allocator >
+ ptr_sequence_adapter( SizeType n, const Allocator& a,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( n, a, tag )
+ { }
+
+ template< class InputIterator >
+ ptr_sequence_adapter( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
+ template< class InputIterator, class Allocator >
+ ptr_sequence_adapter( InputIterator first, InputIterator last,
+ const Allocator& a )
+ : base_type( first, last, a )
+ { }
+
+ template< class ForwardIterator >
+ ptr_sequence_adapter( ForwardIterator first,
+ ForwardIterator last,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( first, last, tag )
+ { }
+
+ template< class SizeType, class ForwardIterator >
+ ptr_sequence_adapter( SizeType n,
+ ForwardIterator first,
+ ForwardIterator last,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( n, first, last, tag )
+ { }
+ ptr_sequence_adapter( const ptr_sequence_adapter& r )
+ : base_type( r )
+ { }
+
template< class U >
- explicit ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq>& r )
+ ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r )
: base_type( r )
{ }
+ ptr_sequence_adapter( const ptr_sequence_adapter& r,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( r, tag )
+ { }
+
+ template< class U >
+ ptr_sequence_adapter( const ptr_sequence_adapter<U,VoidPtrSeq,CloneAllocator>& r,
+ ptr_container_detail::fixed_length_sequence_tag tag )
+ : base_type( r, tag )
+ { }
+
template< class PtrContainer >
explicit ptr_sequence_adapter( std::auto_ptr<PtrContainer> clone )
: base_type( clone )
{ }
- template< class U >
- ptr_sequence_adapter& operator=( const ptr_sequence_adapter<U,VoidPtrSeq>& r )
+ ptr_sequence_adapter& operator=( const ptr_sequence_adapter r )
{
- base_type::operator=( r );
- return *this;
+ this->swap( r );
+ return *this;
}
template< class PtrContainer >
@@ -207,9 +273,8 @@
auto_type pop_back()
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "'pop_back()' on empty container" );
+ BOOST_ASSERT( !this->empty() &&
+ "'pop_back()' on empty container" );
auto_type ptr( static_cast<value_type>( this->base().back() ) );
// nothrow
this->base().pop_back(); // nothrow
@@ -218,9 +283,8 @@
auto_type pop_front()
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "'pop_front()' on empty container" );
+ BOOST_ASSERT( !this->empty() &&
+ "'pop_front()' on empty container" );
auto_type ptr( static_cast<value_type>( this->base().front() ) );
// nothrow
this->base().pop_front(); // nothrow
@@ -229,38 +293,29 @@
reference front()
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "accessing 'front()' on empty container" );
+ BOOST_ASSERT( !this->empty() &&
+ "accessing 'front()' on empty container" );
+
BOOST_ASSERT( !::boost::is_null( this->begin() ) );
return *this->begin();
}
const_reference front() const
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "accessing 'front()' on empty container" );
- BOOST_ASSERT( !::boost::is_null( this->begin() ) );
- return *this->begin();
+ return const_cast<ptr_sequence_adapter*>(this)->front();
}
reference back()
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "accessing 'back()' on empty container" );
+ BOOST_ASSERT( !this->empty() &&
+ "accessing 'back()' on empty container" );
BOOST_ASSERT( !::boost::is_null( --this->end() ) );
return *--this->end();
}
const_reference back() const
{
- BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
- bad_ptr_container_operation,
- "accessing 'back()' on empty container" );
- BOOST_ASSERT( !::boost::is_null( --this->end() ) );
- return *--this->end();
+ return const_cast<ptr_sequence_adapter*>(this)->back();
}
public: // deque/vector inerface
@@ -323,7 +378,7 @@
}
template< class Range >
- void assign( const Range& r )
+ void assign( const Range& r ) // strong
{
assign( boost::begin(r), boost::end(r ) );
}
@@ -367,7 +422,7 @@
}
#endif
-
+
template< class PtrSeqAdapter >
void transfer( iterator before,
BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first,
@@ -455,7 +510,7 @@
public: // resize
- void resize( size_type size )
+ void resize( size_type size ) // basic
{
size_type old_size = this->size();
if( old_size > size )
@@ -472,7 +527,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 )
@@ -487,7 +542,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 )
@@ -537,9 +627,35 @@
}
};
+ protected:
+ template< class Fun, class Arg1 >
+ class void_ptr_delete_if
+ {
+ Fun fun;
+ public:
+
+ void_ptr_delete_if() : fun(Fun())
+ { }
+
+ void_ptr_delete_if( Fun f ) : fun(f)
+ { }
+
+ bool operator()( void* r ) const
+ {
+ BOOST_ASSERT( r != 0 );
+ Arg1 arg1 = static_cast<Arg1>(r);
+ if( fun( *arg1 ) )
+ {
+ clone_allocator_type::deallocate_clone( arg1 );
+ return true;
+ }
+ return false;
+ }
+ };
+
+ private:
void compact_and_erase_nulls( iterator first, iterator last ) // nothrow
{
-
typename base_type::ptr_iterator p = std::stable_partition(
first.base(),
last.base(),
@@ -605,19 +721,9 @@
void erase_if( iterator first, iterator last, Pred pred )
{
range_check(first,last);
-
- iterator next = first;
- for( ; next != last; ++next )
- {
- BOOST_ASSERT( !::boost::is_null(next) );
- if( pred( *next ) )
- {
- this->remove( next ); // delete object
- *next.base() = 0; // mark pointer as deleted
- }
- }
-
- compact_and_erase_nulls( first, last );
+ this->base().erase( std::remove_if( first.base(), last.base(),
+ void_ptr_delete_if<Pred,value_type>(pred) ),
+ this->base().end() );
}
template< class Pred >
Modified: branches/release/boost/ptr_container/ptr_set.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_set.hpp (original)
+++ branches/release/boost/ptr_container/ptr_set.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -33,30 +33,39 @@
class ptr_set :
public ptr_set_adapter< Key,
std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
- CloneAllocator >
+ CloneAllocator, true >
{
typedef ptr_set_adapter< Key, std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
- CloneAllocator >
+ CloneAllocator, true >
base_type;
typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
public:
- explicit ptr_set( const Compare& comp = Compare(),
+ ptr_set()
+ { }
+
+ explicit ptr_set( const Compare& comp,
const Allocator& a = Allocator() )
: base_type( comp, a )
{ }
-
+
+ template< typename InputIterator >
+ ptr_set( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
template< typename InputIterator >
ptr_set( InputIterator first, InputIterator last,
- const Compare& comp = Compare(),
+ const Compare& comp,
const Allocator& a = Allocator() )
: base_type( first, last, comp, a )
{ }
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
base_type,
- this_type );
+ this_type )
+
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set, base_type )
};
@@ -73,32 +82,41 @@
class ptr_multiset :
public ptr_multiset_adapter< Key,
std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
- CloneAllocator >
+ CloneAllocator, true >
{
typedef ptr_multiset_adapter< Key,
std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
- CloneAllocator >
+ CloneAllocator, true >
base_type;
typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
public:
- explicit ptr_multiset( const Compare& comp = Compare(),
+ ptr_multiset()
+ { }
+
+ explicit ptr_multiset( const Compare& comp,
const Allocator& a = Allocator() )
: base_type( comp, a )
{ }
-
+
+ template< typename InputIterator >
+ ptr_multiset( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
template< typename InputIterator >
ptr_multiset( InputIterator first, InputIterator last,
- const Compare& comp = Compare(),
+ const Compare& comp,
const Allocator& a = Allocator() )
: base_type( first, last, comp, a )
{ }
BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
base_type,
- this_type );
+ this_type )
+
BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset,
- base_type );
+ base_type )
};
Modified: branches/release/boost/ptr_container/ptr_set_adapter.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_set_adapter.hpp (original)
+++ branches/release/boost/ptr_container/ptr_set_adapter.hpp 2008-06-24 16:37:35 EDT (Tue, 24 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
>
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,
+ ordered_associative_container_tag,
+ unordered_associative_container_tag>::type
+ container_type;
+
typedef void_ptr_iterator<
BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
iterator;
@@ -56,6 +79,22 @@
BOOST_DEDUCED_TYPENAME VoidPtrSet::const_iterator, const Key >
const_iterator;
+ typedef void_ptr_iterator<
+ BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_iterator<VoidPtrSet>,
+ select_local_iterator<VoidPtrSet> >::type,
+ Key >
+ local_iterator;
+
+ typedef void_ptr_iterator<
+ BOOST_DEDUCED_TYPENAME
+ mpl::eval_if_c<Ordered,
+ select_iterator<VoidPtrSet>,
+ select_const_local_iterator<VoidPtrSet> >::type,
+ const Key >
+ const_local_iterator;
+
template< class Iter >
static Key* get_pointer( Iter i )
{
@@ -77,13 +116,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,41 +135,61 @@
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,
const Compare& comp,
const Allocator& a )
: base_type( first, last, comp, a )
{ }
-
- template< class U, class Set >
- explicit ptr_set_adapter_base( const ptr_set_adapter_base<U,Set>& r )
+
+ 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, class CA, bool b >
+ ptr_set_adapter_base( const ptr_set_adapter_base<U,Set,CA,b>& r )
: base_type( r )
{ }
-
+
+ ptr_set_adapter_base( const ptr_set_adapter_base& r )
+ : base_type( r )
+ { }
+
template< class PtrContainer >
explicit ptr_set_adapter_base( std::auto_ptr<PtrContainer> clone )
: base_type( clone )
{ }
-
- template< class U, class Set >
- ptr_set_adapter_base& operator=( const ptr_set_adapter_base<U,Set>& r )
+
+ ptr_set_adapter_base& operator=( ptr_set_adapter_base r )
{
- base_type::operator=( r );
+ this->swap( r );
return *this;
}
@@ -212,8 +272,13 @@
equal_range( const_cast<key_type*>(&x) );
return make_iterator_range( const_iterator( p.first ),
const_iterator( p.second ) );
- }
+ }
+ protected:
+ size_type bucket( const key_type& key ) const
+ {
+ return this->base().bucket( const_cast<key_type*>(&key) );
+ }
};
} // ptr_container_detail
@@ -226,12 +291,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,10 +311,8 @@
typedef Key key_type;
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
auto_type;
- typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::key_compare
- key_compare;
typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
- allocator_type;
+ allocator_type;
private:
template< typename II >
@@ -263,17 +327,38 @@
}
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 >
+ ptr_set_adapter( InputIterator first, InputIterator last )
+ : base_type( first, last )
+ { }
+
template< class InputIterator, class Compare, class Allocator >
ptr_set_adapter( InputIterator first, InputIterator last,
- const Compare& comp = Compare(),
+ const Compare& comp,
const Allocator a = Allocator() )
: base_type( comp, a )
{
@@ -281,8 +366,20 @@
set_basic_clone_and_insert( first, last );
}
- template< class U, class Set >
- explicit ptr_set_adapter( const ptr_set_adapter<U,Set>& r )
+ 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 )
+ { }
+
+ explicit ptr_set_adapter( const ptr_set_adapter& r )
+ : base_type( r )
+ { }
+
+ template< class U, class Set, class CA, bool b >
+ explicit ptr_set_adapter( const ptr_set_adapter<U,Set,CA,b>& r )
: base_type( r )
{ }
@@ -291,8 +388,8 @@
: base_type( clone )
{ }
- template< class U, class Set >
- ptr_set_adapter& operator=( const ptr_set_adapter<U,Set>& r )
+ template< class U, class Set, class CA, bool b >
+ ptr_set_adapter& operator=( const ptr_set_adapter<U,Set,CA,b>& r )
{
base_type::operator=( r );
return *this;
@@ -406,12 +503,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
@@ -422,8 +520,6 @@
typedef Key key_type;
typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
auto_type;
- typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiSet::key_compare
- key_compare;
typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiSet::allocator_type
allocator_type;
private:
@@ -438,23 +534,52 @@
}
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 )
+ : base_type( first, last )
+ { }
+
+ template< class InputIterator, class Comp >
ptr_multiset_adapter( InputIterator first, InputIterator last,
- const key_compare& comp = key_compare(),
+ const Comp& comp,
const allocator_type& a = allocator_type() )
: base_type( comp, a )
{
set_basic_clone_and_insert( first, last );
}
- template< class U, class Set >
- explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set>& r )
+ 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, class CA, bool b >
+ explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set,CA,b>& r )
: base_type( r )
{ }
@@ -463,8 +588,8 @@
: base_type( clone )
{ }
- template< class U, class Set >
- ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set>& r )
+ template< class U, class Set, class CA, bool b >
+ ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set,CA,b>& r )
{
base_type::operator=( r );
return *this;
Modified: branches/release/boost/ptr_container/ptr_vector.hpp
==============================================================================
--- branches/release/boost/ptr_container/ptr_vector.hpp (original)
+++ branches/release/boost/ptr_container/ptr_vector.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -44,7 +44,7 @@
BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_vector,
base_class,
- this_type );
+ this_type )
explicit ptr_vector( size_type n,
const allocator_type& alloc = allocator_type() )
Modified: branches/release/boost/ptr_container/serialize_ptr_array.hpp
==============================================================================
--- branches/release/boost/ptr_container/serialize_ptr_array.hpp (original)
+++ branches/release/boost/ptr_container/serialize_ptr_array.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -16,13 +16,13 @@
{
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)
+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)
+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;
Modified: branches/release/boost/ptr_container/serialize_ptr_container.hpp
==============================================================================
Binary files. No diff available.
Modified: branches/release/boost/ptr_container/serialize_ptr_vector.hpp
==============================================================================
--- branches/release/boost/ptr_container/serialize_ptr_vector.hpp (original)
+++ branches/release/boost/ptr_container/serialize_ptr_vector.hpp 2008-06-24 16:37:35 EDT (Tue, 24 Jun 2008)
@@ -16,7 +16,7 @@
{
template<class Archive, class T, class CloneAllocator, class Allocator>
-void load(Archive& ar, ptr_vector<T, CloneAllocator, Allocator>& c, unsigned int version)
+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;
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