epoc32/include/stdapis/boost/ptr_container/ptr_sequence_adapter.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/ptr_container/ptr_sequence_adapter.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,610 @@
     1.4 +//
     1.5 +// Boost.Pointer Container
     1.6 +//
     1.7 +//  Copyright Thorsten Ottosen 2003-2005. Use, modification and
     1.8 +//  distribution is subject to the Boost Software License, Version
     1.9 +//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.10 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.11 +//
    1.12 +// For more information, see http://www.boost.org/libs/ptr_container/
    1.13 +//
    1.14 +/*
    1.15 + * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
    1.16 +*/
    1.17 +#ifndef BOOST_ptr_container_PTR_SEQUENCE_ADAPTER_HPP
    1.18 +#define BOOST_ptr_container_PTR_SEQUENCE_ADAPTER_HPP
    1.19 +
    1.20 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.21 +# pragma once
    1.22 +#endif
    1.23 +
    1.24 +
    1.25 +#include <boost/ptr_container/detail/reversible_ptr_container.hpp>
    1.26 +#include <boost/ptr_container/indirect_fun.hpp>
    1.27 +#include <boost/ptr_container/detail/void_ptr_iterator.hpp>
    1.28 +#include <boost/type_traits/remove_pointer.hpp>
    1.29 +#include <boost/type_traits/is_same.hpp>
    1.30 +#include <boost/type_traits/is_pointer.hpp>
    1.31 +#include <boost/type_traits/is_integral.hpp>
    1.32 +#include <boost/iterator/iterator_categories.hpp>
    1.33 +#ifdef __SYMBIAN32__
    1.34 +#include <boost/range/begin.hpp>
    1.35 +#include <boost/range/end.hpp>
    1.36 +#endif
    1.37 +
    1.38 +namespace boost
    1.39 +{   
    1.40 +namespace ptr_container_detail
    1.41 +{
    1.42 +
    1.43 +
    1.44 +    
    1.45 +    
    1.46 +    template
    1.47 +    < 
    1.48 +        class T, 
    1.49 +        class VoidPtrSeq
    1.50 +    >
    1.51 +    struct sequence_config
    1.52 +    {
    1.53 +        typedef BOOST_DEDUCED_TYPENAME remove_nullable<T>::type
    1.54 +                    U;
    1.55 +        typedef VoidPtrSeq
    1.56 +                    void_container_type;
    1.57 +
    1.58 +        typedef BOOST_DEDUCED_TYPENAME VoidPtrSeq::allocator_type
    1.59 +                    allocator_type;
    1.60 +        
    1.61 +        typedef U   value_type;
    1.62 +
    1.63 +        typedef void_ptr_iterator<
    1.64 +                        BOOST_DEDUCED_TYPENAME VoidPtrSeq::iterator, U > 
    1.65 +                    iterator;
    1.66 +       
    1.67 +        typedef void_ptr_iterator<
    1.68 +                        BOOST_DEDUCED_TYPENAME VoidPtrSeq::const_iterator, const U >
    1.69 +                    const_iterator;
    1.70 +
    1.71 +#ifdef BOOST_NO_SFINAE
    1.72 +
    1.73 +        template< class Iter >
    1.74 +        static U* get_pointer( Iter i )
    1.75 +        {
    1.76 +            return static_cast<U*>( *i.base() );
    1.77 +        }
    1.78 +        
    1.79 +#else
    1.80 +        template< class Iter >
    1.81 +        static U* get_pointer( void_ptr_iterator<Iter,U> i )
    1.82 +        {
    1.83 +            return static_cast<U*>( *i.base() );
    1.84 +        }
    1.85 +
    1.86 +        template< class Iter >
    1.87 +        static U* get_pointer( Iter i )
    1.88 +        {
    1.89 +            return &*i;
    1.90 +        }
    1.91 +#endif        
    1.92 +
    1.93 +#if defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
    1.94 +
    1.95 +        template< class Iter >
    1.96 +        static const U* get_const_pointer( Iter i )
    1.97 +        {
    1.98 +            return static_cast<const U*>( *i.base() );
    1.99 +        }
   1.100 +        
   1.101 +#else // BOOST_NO_SFINAE
   1.102 +
   1.103 +#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
   1.104 +        template< class Iter >
   1.105 +        static const U* get_const_pointer( void_ptr_iterator<Iter,U> i )
   1.106 +        {
   1.107 +            return static_cast<const U*>( *i.base() );
   1.108 +        }
   1.109 +#else // BOOST_WORKAROUND
   1.110 +        template< class Iter >
   1.111 +        static const U* get_const_pointer( void_ptr_iterator<Iter,const U> i )
   1.112 +        {
   1.113 +            return static_cast<const U*>( *i.base() );
   1.114 +        }
   1.115 +#endif // BOOST_WORKAROUND
   1.116 +
   1.117 +        template< class Iter >
   1.118 +        static const U* get_const_pointer( Iter i )
   1.119 +        {
   1.120 +            return &*i;
   1.121 +        }
   1.122 +#endif // BOOST_NO_SFINAE
   1.123 +
   1.124 +        BOOST_STATIC_CONSTANT(bool, allow_null = boost::is_nullable<T>::value );
   1.125 +    };
   1.126 +    
   1.127 +} // ptr_container_detail
   1.128 +
   1.129 +
   1.130 +    template< class Iterator, class T >
   1.131 +    inline bool is_null( void_ptr_iterator<Iterator,T> i )
   1.132 +    {
   1.133 +        return *i.base() == 0;
   1.134 +    }
   1.135 +
   1.136 +
   1.137 +    
   1.138 +    template
   1.139 +    < 
   1.140 +        class T,
   1.141 +        class VoidPtrSeq, 
   1.142 +        class CloneAllocator = heap_clone_allocator
   1.143 +    >
   1.144 +    class ptr_sequence_adapter : public 
   1.145 +        ptr_container_detail::reversible_ptr_container< ptr_container_detail::sequence_config<T,VoidPtrSeq>, 
   1.146 +                                            CloneAllocator >
   1.147 +    {
   1.148 +        typedef ptr_container_detail::reversible_ptr_container< ptr_container_detail::sequence_config<T,VoidPtrSeq>,
   1.149 +                                                    CloneAllocator >
   1.150 +             base_type;
   1.151 +        
   1.152 +        typedef BOOST_DEDUCED_TYPENAME base_type::scoped_deleter scoped_deleter;
   1.153 +
   1.154 +        typedef ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>                         
   1.155 +            this_type;
   1.156 +         
   1.157 +    public:
   1.158 +        typedef BOOST_DEDUCED_TYPENAME base_type::value_type  value_type; 
   1.159 +        typedef BOOST_DEDUCED_TYPENAME base_type::reference   reference; 
   1.160 +        typedef BOOST_DEDUCED_TYPENAME base_type::auto_type   auto_type;
   1.161 +         
   1.162 +        BOOST_PTR_CONTAINER_DEFINE_CONSTRUCTORS( ptr_sequence_adapter, 
   1.163 +                                                 base_type )
   1.164 +    
   1.165 +        template< class PtrContainer >
   1.166 +        ptr_sequence_adapter( std::auto_ptr<PtrContainer> clone )
   1.167 +          : base_type( clone )
   1.168 +        { }
   1.169 +
   1.170 +        template< class PtrContainer >
   1.171 +        void operator=( std::auto_ptr<PtrContainer> clone )    
   1.172 +        {
   1.173 +            base_type::operator=( clone );
   1.174 +        }
   1.175 +
   1.176 +        /////////////////////////////////////////////////////////////
   1.177 +        // modifiers
   1.178 +        /////////////////////////////////////////////////////////////
   1.179 +
   1.180 +        void push_back( value_type x )  // strong               
   1.181 +        {
   1.182 +            this->enforce_null_policy( x, "Null pointer in 'push_back()'" );
   1.183 +
   1.184 +            auto_type ptr( x );                // notrow
   1.185 +            this->c_private().push_back( x );  // strong, commit
   1.186 +            ptr.release();                     // nothrow
   1.187 +        }
   1.188 +
   1.189 +        template< class U >
   1.190 +        void push_back( std::auto_ptr<U> x )
   1.191 +        {
   1.192 +            push_back( x.release() );
   1.193 +        }
   1.194 +        
   1.195 +        void push_front( value_type x )                
   1.196 +        {
   1.197 +            this->enforce_null_policy( x, "Null pointer in 'push_front()'" );
   1.198 +
   1.199 +            auto_type ptr( x );                // nothrow
   1.200 +            this->c_private().push_front( x ); // strong, commit
   1.201 +            ptr.release();                     // nothrow
   1.202 +        }
   1.203 +
   1.204 +        template< class U >
   1.205 +        void push_front( std::auto_ptr<U> x )
   1.206 +        {
   1.207 +            push_front( x.release() );
   1.208 +        }
   1.209 +
   1.210 +        auto_type pop_back()
   1.211 +        {
   1.212 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(), 
   1.213 +                                                 bad_ptr_container_operation,
   1.214 +                                          "'pop_back()' on empty container" );
   1.215 +            auto_type ptr( static_cast<value_type>( 
   1.216 +                         this->c_private().back() ) ); // nothrow
   1.217 +            this->c_private().pop_back();              // nothrow
   1.218 +            return ptr_container_detail::move( ptr );  // nothrow
   1.219 +        }
   1.220 +
   1.221 +        auto_type pop_front()
   1.222 +        {
   1.223 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
   1.224 +                                                 bad_ptr_container_operation,
   1.225 +                                         "'pop_front()' on empty container" ); 
   1.226 +            auto_type ptr( static_cast<value_type>(
   1.227 +                        this->c_private().front() ) ); // nothrow 
   1.228 +            this->c_private().pop_front();             // nothrow
   1.229 +            return ptr_container_detail::move( ptr ); 
   1.230 +        }
   1.231 +        
   1.232 +        reference front()        
   1.233 +        { 
   1.234 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(), 
   1.235 +                                                 bad_ptr_container_operation,
   1.236 +                                    "accessing 'front()' on empty container" );
   1.237 +            BOOST_ASSERT( !::boost::is_null( this->begin() ) );
   1.238 +            return *this->begin(); 
   1.239 +        }
   1.240 +
   1.241 +        const_reference front() const  
   1.242 +        {
   1.243 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(), 
   1.244 +                                                 bad_ptr_container_operation, 
   1.245 +                                   "accessing 'front()' on empty container" );
   1.246 +            BOOST_ASSERT( !::boost::is_null( this->begin() ) );
   1.247 +            return *this->begin(); 
   1.248 +        }
   1.249 +
   1.250 +        reference back()
   1.251 +        {
   1.252 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
   1.253 +                                                 bad_ptr_container_operation,
   1.254 +                                    "accessing 'back()' on empty container" );
   1.255 +            BOOST_ASSERT( !::boost::is_null( --this->end() ) );
   1.256 +            return *--this->end(); 
   1.257 +        }
   1.258 +
   1.259 +        const_reference back() const
   1.260 +        {
   1.261 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
   1.262 +                                                 bad_ptr_container_operation,
   1.263 +                                    "accessing 'back()' on empty container" );
   1.264 +            BOOST_ASSERT( !::boost::is_null( --this->end() ) );
   1.265 +            return *--this->end(); 
   1.266 +        }
   1.267 +
   1.268 +    public: // deque/vector inerface
   1.269 +        
   1.270 +        reference operator[]( size_type n ) // nothrow 
   1.271 +        {
   1.272 +            BOOST_ASSERT( n < this->size() );
   1.273 +            BOOST_ASSERT( !this->is_null( n ) );
   1.274 +            return *static_cast<value_type>( this->c_private()[n] ); 
   1.275 +        }
   1.276 +        
   1.277 +        const_reference operator[]( size_type n ) const // nothrow  
   1.278 +        { 
   1.279 +            BOOST_ASSERT( n < this->size() ); 
   1.280 +            BOOST_ASSERT( !this->is_null( n ) );
   1.281 +            return *static_cast<value_type>( this->c_private()[n] );
   1.282 +        }
   1.283 +        
   1.284 +        reference at( size_type n )
   1.285 +        {
   1.286 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index, 
   1.287 +                                                 "'at()' out of bounds" );
   1.288 +            BOOST_ASSERT( !this->is_null( n ) );
   1.289 +            return (*this)[n];
   1.290 +        }
   1.291 +        
   1.292 +        const_reference at( size_type n ) const
   1.293 +        {
   1.294 +            BOOST_PTR_CONTAINER_THROW_EXCEPTION( n >= this->size(), bad_index, 
   1.295 +                                                 "'at()' out of bounds" );
   1.296 +            BOOST_ASSERT( !this->is_null( n ) );
   1.297 +            return (*this)[n]; 
   1.298 +        }
   1.299 +        
   1.300 +    public: // vector interface
   1.301 +        
   1.302 +        size_type capacity() const
   1.303 +        {
   1.304 +            return this->c_private().capacity();
   1.305 +        }
   1.306 +        
   1.307 +        void reserve( size_type n )
   1.308 +        {
   1.309 +            this->c_private().reserve( n ); 
   1.310 +        }
   1.311 +
   1.312 +        void reverse()
   1.313 +        {
   1.314 +            this->c_private().reverse(); 
   1.315 +        }
   1.316 +
   1.317 +    public: // assign, insert, transfer
   1.318 +
   1.319 +        // overhead: 1 heap allocation (very cheap compared to cloning)
   1.320 +        template< class InputIterator >
   1.321 +        void assign( InputIterator first, InputIterator last ) // strong
   1.322 +        { 
   1.323 +            base_type temp( first, last );
   1.324 +            this->swap( temp );
   1.325 +        }
   1.326 +
   1.327 +        template< class Range >
   1.328 +        void assign( const Range& r )
   1.329 +        {
   1.330 +            assign( boost::begin(r), boost::end(r ) );
   1.331 +        }
   1.332 +
   1.333 +    private:
   1.334 +        template< class I >
   1.335 +        void insert_impl( iterator before, I first, I last, std::input_iterator_tag ) // strong
   1.336 +        {
   1.337 +            ptr_sequence_adapter temp(first,last);  // strong
   1.338 +            transfer( before, temp );               // strong, commit
   1.339 +        }
   1.340 +
   1.341 +        template< class I >
   1.342 +        void insert_impl( iterator before, I first, I last, std::forward_iterator_tag ) // strong
   1.343 +        {
   1.344 +            if( first == last ) 
   1.345 +                return;
   1.346 +            scoped_deleter sd( first, last );                // strong
   1.347 +            this->insert_clones_and_release( sd, before );   // strong, commit 
   1.348 +        }
   1.349 +
   1.350 +    public:
   1.351 +
   1.352 +        using base_type::insert;
   1.353 +        
   1.354 +        template< class InputIterator >
   1.355 +        void insert( iterator before, InputIterator first, InputIterator last ) // strong
   1.356 +        {
   1.357 +            insert_impl( before, first, last, BOOST_DEDUCED_TYPENAME
   1.358 +                         iterator_category<InputIterator>::type() );
   1.359 +        } 
   1.360 +
   1.361 +#if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
   1.362 +#else
   1.363 +        template< class Range >
   1.364 +        BOOST_DEDUCED_TYPENAME
   1.365 +        boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
   1.366 +        insert( iterator before, const Range& r )
   1.367 +        {
   1.368 +            insert( before, boost::begin(r), boost::end(r) );
   1.369 +        }
   1.370 +
   1.371 +#endif
   1.372 +
   1.373 +        template< class PtrSeqAdapter >
   1.374 +        void transfer( iterator before, 
   1.375 +                       BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator first, 
   1.376 +                       BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator last, 
   1.377 +                       PtrSeqAdapter& from ) // strong
   1.378 +        {
   1.379 +            BOOST_ASSERT( (void*)&from != (void*)this );
   1.380 +            if( from.empty() )
   1.381 +                return;
   1.382 +            this->c_private().
   1.383 +                insert( before.base(), 
   1.384 +                        first.base(), last.base() ); // strong
   1.385 +            from.c_private().erase( first.base(),
   1.386 +                                    last.base() );   // nothrow
   1.387 +        }
   1.388 +
   1.389 +        template< class PtrSeqAdapter >
   1.390 +        void transfer( iterator before, 
   1.391 +                       BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator object, 
   1.392 +                       PtrSeqAdapter& from ) // strong
   1.393 +        {
   1.394 +            BOOST_ASSERT( (void*)&from != (void*)this );
   1.395 +            if( from.empty() )
   1.396 +                return;
   1.397 +            this->c_private().
   1.398 +                insert( before.base(),
   1.399 +                        *object.base() );                 // strong
   1.400 +            from.c_private().erase( object.base() );      // nothrow
   1.401 +        }
   1.402 +
   1.403 +#if defined(BOOST_NO_SFINAE) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
   1.404 +#else
   1.405 +        
   1.406 +        template< class PtrSeqAdapter, class Range >
   1.407 +        BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
   1.408 +                      BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator > >::type
   1.409 +        transfer( iterator before, const Range& r, PtrSeqAdapter& from ) // strong
   1.410 +        {
   1.411 +            transfer( before, boost::begin(r), boost::end(r), from );
   1.412 +        }
   1.413 +
   1.414 +#endif
   1.415 +        template< class PtrSeqAdapter >
   1.416 +        void transfer( iterator before, PtrSeqAdapter& from ) // strong
   1.417 +        {
   1.418 +            BOOST_ASSERT( (void*)&from != (void*)this );
   1.419 +            if( from.empty() )
   1.420 +                return;
   1.421 +            this->c_private().
   1.422 +                insert( before.base(),
   1.423 +                        from.begin().base(), from.end().base() ); // strong
   1.424 +            from.c_private().clear();                             // nothrow
   1.425 +        }
   1.426 +
   1.427 +    public: // null functions
   1.428 +         
   1.429 +        bool is_null( size_type idx ) const
   1.430 +        {
   1.431 +            BOOST_ASSERT( idx < this->size() );
   1.432 +            return this->c_private()[idx] == 0;
   1.433 +        }
   1.434 +
   1.435 +    public: // algorithms
   1.436 +
   1.437 +        void sort( iterator first, iterator last )
   1.438 +        {
   1.439 +            sort( first, last, std::less<T>() );
   1.440 +        }
   1.441 +        
   1.442 +        void sort()
   1.443 +        {
   1.444 +            sort( this->begin(), this->end() );
   1.445 +        }
   1.446 +
   1.447 +        template< class Compare >
   1.448 +        void sort( iterator first, iterator last, Compare comp )
   1.449 +        {
   1.450 +            BOOST_ASSERT( first <= last && "out of range sort()" );
   1.451 +            BOOST_ASSERT( this->begin() <= first && "out of range sort()" );
   1.452 +            BOOST_ASSERT( last <= this->end() && "out of range sort()" ); 
   1.453 +            // some static assert on the arguments of the comparison
   1.454 +            std::sort( first.base(), last.base(), 
   1.455 +                       void_ptr_indirect_fun<Compare,T>(comp) );
   1.456 +        }
   1.457 +        
   1.458 +        template< class Compare >
   1.459 +        void sort( Compare comp )
   1.460 +        {
   1.461 +            sort( this->begin(), this->end(), comp );
   1.462 +        }
   1.463 +        
   1.464 +        void unique( iterator first, iterator last )
   1.465 +        {
   1.466 +            unique( first, last, std::equal_to<T>() );
   1.467 +        }
   1.468 +        
   1.469 +        void unique()
   1.470 +        {
   1.471 +            unique( this->begin(), this->end() );
   1.472 +        }
   1.473 +
   1.474 +    private:
   1.475 +        struct is_not_zero_ptr
   1.476 +        {
   1.477 +            template< class U >
   1.478 +            bool operator()( const U* r ) const
   1.479 +            {
   1.480 +                return r != 0;
   1.481 +            }
   1.482 +        };
   1.483 +
   1.484 +        void compact_and_erase_nulls( iterator first, iterator last ) // nothrow
   1.485 +        {
   1.486 +            
   1.487 +            typename base_type::ptr_iterator p = std::stable_partition( 
   1.488 +                                                    first.base(), 
   1.489 +                                                    last.base(), 
   1.490 +                                                    is_not_zero_ptr() );
   1.491 +            this->c_private().erase( p, this->end().base() );
   1.492 +            
   1.493 +        }
   1.494 +
   1.495 +        void range_check_impl( iterator first, iterator last, 
   1.496 +                               std::bidirectional_iterator_tag )
   1.497 +        { /* do nothing */ }
   1.498 +
   1.499 +        void range_check_impl( iterator first, iterator last,
   1.500 +                               std::random_access_iterator_tag )
   1.501 +        {
   1.502 +            BOOST_ASSERT( first <= last && "out of range unique()/erase_if()" );
   1.503 +            BOOST_ASSERT( this->begin() <= first && "out of range unique()/erase_if()" );
   1.504 +            BOOST_ASSERT( last <= this->end() && "out of range unique()/erase_if)(" );             
   1.505 +        }
   1.506 +        
   1.507 +        void range_check( iterator first, iterator last )
   1.508 +        {
   1.509 +            range_check_impl( first, last, 
   1.510 +                              BOOST_DEDUCED_TYPENAME iterator_category<iterator>::type() );
   1.511 +        }
   1.512 +        
   1.513 +    public:
   1.514 +        
   1.515 +        template< class Compare >
   1.516 +        void unique( iterator first, iterator last, Compare comp )
   1.517 +        {
   1.518 +            range_check(first,last);
   1.519 +            
   1.520 +            iterator prev = first;
   1.521 +            iterator next = first;
   1.522 +            ++next;
   1.523 +            for( ; next != last; ++next )
   1.524 +            {
   1.525 +                BOOST_ASSERT( !::boost::is_null(prev) );
   1.526 +                BOOST_ASSERT( !::boost::is_null(next) );
   1.527 +                if( comp( *prev, *next ) )
   1.528 +                {
   1.529 +                    this->remove( next ); // delete object
   1.530 +                    *next.base() = 0;     // mark pointer as deleted
   1.531 +                }
   1.532 +                else
   1.533 +                {
   1.534 +                    prev = next;
   1.535 +                }
   1.536 +                // ++next
   1.537 +            }
   1.538 +
   1.539 +            compact_and_erase_nulls( first, last );
   1.540 +        }
   1.541 +        
   1.542 +        template< class Compare >
   1.543 +        void unique( Compare comp )
   1.544 +        {
   1.545 +            unique( this->begin(), this->end(), comp );
   1.546 +        }
   1.547 +
   1.548 +        template< class Pred >
   1.549 +        void erase_if( iterator first, iterator last, Pred pred )
   1.550 +        {
   1.551 +            range_check(first,last);
   1.552 +
   1.553 +            iterator next = first; 
   1.554 +            for( ; next != last; ++next )
   1.555 +            {
   1.556 +                BOOST_ASSERT( !::boost::is_null(next) );
   1.557 +                if( pred( *next ) )
   1.558 +                {
   1.559 +                    this->remove( next ); // delete object
   1.560 +                    *next.base() = 0;     // mark pointer as deleted
   1.561 +                }
   1.562 +            }
   1.563 +
   1.564 +            compact_and_erase_nulls( first, last );
   1.565 +        }
   1.566 +        
   1.567 +        template< class Pred >
   1.568 +        void erase_if( Pred pred )
   1.569 +        {
   1.570 +            erase_if( this->begin(), this->end(), pred );
   1.571 +        }
   1.572 +
   1.573 +
   1.574 +        void merge( iterator first, iterator last, 
   1.575 +                    ptr_sequence_adapter& from )
   1.576 +        {
   1.577 +             merge( first, last, from, std::less<T>() );
   1.578 +        }
   1.579 +        
   1.580 +        template< class BinPred >
   1.581 +        void merge( iterator first, iterator last, 
   1.582 +                    ptr_sequence_adapter& from, BinPred pred )
   1.583 +        {
   1.584 +            void_ptr_indirect_fun<BinPred,T>  bin_pred(pred);
   1.585 +            size_type                         current_size = this->size(); 
   1.586 +            this->transfer( this->end(), first, last, from );
   1.587 +            typename base_type::ptr_iterator middle = this->begin().base();
   1.588 +            std::advance(middle,current_size); 
   1.589 +            std::inplace_merge( this->begin().base(),
   1.590 +                                middle,
   1.591 +                                this->end().base(),
   1.592 +                                bin_pred );
   1.593 +        }
   1.594 +        
   1.595 +        void merge( ptr_sequence_adapter& r )
   1.596 +        {
   1.597 +            merge( r, std::less<T>() );
   1.598 +            BOOST_ASSERT( r.empty() );
   1.599 +        }
   1.600 +        
   1.601 +        template< class BinPred >
   1.602 +        void merge( ptr_sequence_adapter& r, BinPred pred )
   1.603 +        {
   1.604 +            merge( r.begin(), r.end(), r, pred );
   1.605 +            BOOST_ASSERT( r.empty() );    
   1.606 +        }
   1.607 +        
   1.608 +    };
   1.609 +
   1.610 +
   1.611 +} // namespace 'boost'  
   1.612 +
   1.613 +#endif