Boost logo

Boost-Commit :

From: nesotto_at_[hidden]
Date: 2007-10-24 12:26:54


Author: nesotto
Date: 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
New Revision: 40426
URL: http://svn.boost.org/trac/boost/changeset/40426

Log:
minor updates from 1.34
Text files modified:
   trunk/boost/ptr_container/detail/associative_ptr_container.hpp | 6 ++++++
   trunk/boost/ptr_container/ptr_array.hpp | 4 ++--
   trunk/boost/ptr_container/ptr_map_adapter.hpp | 18 ++++++++++--------
   trunk/boost/ptr_container/ptr_sequence_adapter.hpp | 34 ++++++++++++++++++++++++++++++++++
   trunk/boost/ptr_container/ptr_set_adapter.hpp | 6 +++---
   5 files changed, 55 insertions(+), 13 deletions(-)

Modified: trunk/boost/ptr_container/detail/associative_ptr_container.hpp
==============================================================================
--- trunk/boost/ptr_container/detail/associative_ptr_container.hpp (original)
+++ trunk/boost/ptr_container/detail/associative_ptr_container.hpp 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
@@ -135,6 +135,12 @@
             return res; // nothrow
         }
 
+ template< class Range >
+ iterator erase( const Range& r )
+ {
+ return erase( boost::begin(r), boost::end(r) );
+ }
+
     protected:
 
         template< class AssociatePtrCont >

Modified: trunk/boost/ptr_container/ptr_array.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_array.hpp (original)
+++ trunk/boost/ptr_container/ptr_array.hpp 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
@@ -133,7 +133,7 @@
 
             auto_type res( static_cast<U*>( this->base()[idx] ) ); // nothrow
             this->base()[idx] = r; // nothrow
- return move(res); // nothrow
+ return boost::ptr_container::move(res); // nothrow
         }
 
         template< size_t idx, class V >
@@ -153,7 +153,7 @@
 
             auto_type res( static_cast<U*>( this->base()[idx] ) ); // nothrow
             this->base()[idx] = ptr.release(); // nothrow
- return move(res); // nothrow
+ return boost::ptr_container::move(res); // nothrow
         }
 
         template< class V >

Modified: trunk/boost/ptr_container/ptr_map_adapter.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_map_adapter.hpp (original)
+++ trunk/boost/ptr_container/ptr_map_adapter.hpp 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
@@ -282,7 +282,7 @@
 
             auto_type old( where->second ); // nothrow
             where.base()->second = ptr.release(); // nothrow, commit
- return move( old );
+ return boost::ptr_container::move( old );
         }
 
         template< class U >
@@ -364,9 +364,10 @@
                 {
                     const_reference p = *first.base(); // nothrow
                     auto_type ptr( this->null_policy_allocate_clone( p.second ) );
- // strong
- this->safe_insert( p.first, ptr_container_detail::
- move( ptr ) );// strong, commit
+ // strong
+ this->safe_insert( p.first,
+ boost::ptr_container::move( ptr ) );
+ // strong, commit
                 }
                 ++first;
             }
@@ -452,7 +453,7 @@
             return this->single_transfer( first, last, from );
         }
 
-#ifdef BOOST_NO_SFINAE
+#ifdef BOOST_NO_SFINAE
 #else
 
         template< class PtrMapAdapter, class Range >
@@ -548,8 +549,9 @@
                 const_reference pair = *first.base(); // nothrow
                 auto_type ptr( this->null_policy_allocate_clone( pair.second ) );
                                                           // strong
- safe_insert( pair.first, ptr_container_detail::
- move( ptr ) ); // strong, commit
+ safe_insert( pair.first,
+ boost::ptr_container::move( ptr ) );
+ // strong, commit
                 ++first;
             }
         }
@@ -627,7 +629,7 @@
             return this->multi_transfer( first, last, from );
         }
 
-#ifdef BOOST_NO_SFINAE
+#ifdef BOOST_NO_SFINAE
 #else
 
         template< class PtrMapAdapter, class Range >

Modified: trunk/boost/ptr_container/ptr_sequence_adapter.hpp
==============================================================================
--- trunk/boost/ptr_container/ptr_sequence_adapter.hpp (original)
+++ trunk/boost/ptr_container/ptr_sequence_adapter.hpp 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
@@ -429,6 +429,40 @@
             return this->base()[idx] == 0;
         }
 
+ public: // resize
+
+ void resize( size_type size )
+ {
+ size_type old_size = this->size();
+ if( old_size > size )
+ {
+ this->erase( boost::next( this->begin(), size ), this->end() );
+ }
+ else if( size > old_size )
+ {
+ for( ; old_size != size; ++old_size )
+ this->push_back( new T );
+ }
+
+ BOOST_ASSERT( this->size() == size );
+ }
+
+ void resize( size_type size, T* to_clone )
+ {
+ size_type old_size = this->size();
+ if( old_size > size )
+ {
+ this->erase( boost::next( this->begin(), size ), this->end() );
+ }
+ else if( size > old_size )
+ {
+ for( ; old_size != size; ++old_size )
+ this->push_back( 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 2007-10-24 12:26:54 EDT (Wed, 24 Oct 2007)
@@ -337,7 +337,7 @@
             return this->single_transfer( first, last, from );
         }
 
-#ifdef BOOST_NO_SFINAE
+#ifdef BOOST_NO_SFINAE || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
 #else
 
         template< class PtrSetAdapter, class Range >
@@ -458,7 +458,7 @@
             set_basic_clone_and_insert( first, last );
         }
 
-#ifdef BOOST_NO_SFINAE
+#ifdef BOOST_NO_SFINAE || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
 #else
         
         template< class Range >
@@ -486,7 +486,7 @@
             return this->multi_transfer( first, last, from );
         }
 
-#ifdef BOOST_NO_SFINAE
+#ifdef BOOST_NO_SFINAE || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
 #else
         
         template< class PtrSetAdapter, class Range >


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