Boost logo

Boost-Commit :

From: nesotto_at_[hidden]
Date: 2008-06-03 18:10:59


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

Log:
update
Text files modified:
   trunk/boost/ptr_container/detail/reversible_ptr_container.hpp | 73 +++++++++++++++++++++++++++++++--------
   1 files changed, 58 insertions(+), 15 deletions(-)

Modified: trunk/boost/ptr_container/detail/reversible_ptr_container.hpp
==============================================================================
--- trunk/boost/ptr_container/detail/reversible_ptr_container.hpp (original)
+++ trunk/boost/ptr_container/detail/reversible_ptr_container.hpp 2008-06-03 18:10:58 EDT (Tue, 03 Jun 2008)
@@ -66,8 +66,12 @@
 
     struct is_pointer_or_integral_tag {};
     struct is_range_tag {};
-
+ struct sequence_tag {};
+ struct associative_container_tag {};
+ struct ordered_associative_container_tag : associative_container_tag {};
+ struct unordered_associative_container_tag : associative_container_tag {};
     
+
     
     template
     <
@@ -291,27 +295,44 @@
             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 )
+ { }
+
+ 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 )
         {
- 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 )
         {
- constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
+ constructor_impl( r.begin(), r.end(), std::forward_iterator_tag() );
         }
 
 
@@ -336,6 +357,7 @@
             swap( clone );
             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 >
@@ -357,13 +379,42 @@
                                   const allocator_type& a )
         : 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 )
+ const allocator_type& a,
+ associative_container_tag )
         : c_( comp, a )
         {
+ associative_constructor_impl( first, last );
+ }
+
+ 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 )
+ {
             if( first == last )
                 return;
 
@@ -371,14 +422,6 @@
             insert_clones_and_release( sd );
         }
 
- template< class PtrContainer, class Compare >
- reversible_ptr_container( std::auto_ptr<PtrContainer> clone,
- Compare comp )
- : c_( comp, allocator_type() )
- {
- swap( *clone );
- }
-
     public:
         ~reversible_ptr_container()
         {


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