Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:36

0001 //
0002 // Boost.Pointer Container
0003 //
0004 //  Copyright Thorsten Ottosen 2003-2005. Use, modification and
0005 //  distribution is subject to the Boost Software License, Version
0006 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see http://www.boost.org/libs/ptr_container/
0010 //
0011 
0012 #ifndef BOOST_PTR_CONTAINER_PTR_SET_ADAPTER_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_SET_ADAPTER_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <boost/ptr_container/detail/associative_ptr_container.hpp>
0020 #include <boost/ptr_container/detail/meta_functions.hpp>
0021 #include <boost/ptr_container/detail/void_ptr_iterator.hpp>
0022 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
0023 #include <boost/range/iterator_range.hpp>
0024 
0025 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0026 #pragma GCC diagnostic push
0027 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0028 #endif
0029 
0030 namespace boost
0031 {
0032 namespace ptr_container_detail
0033 {
0034     template
0035     <
0036         class Key,
0037         class VoidPtrSet,
0038         bool  Ordered
0039     >
0040     struct set_config
0041     {
0042        typedef VoidPtrSet
0043                     void_container_type;
0044 
0045        typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
0046                     allocator_type;
0047 
0048        typedef Key  value_type;
0049 
0050        typedef value_type
0051                     key_type;
0052 
0053        typedef BOOST_DEDUCED_TYPENAME
0054            mpl::eval_if_c<Ordered,
0055                           select_value_compare<VoidPtrSet>,
0056                           mpl::identity<void> >::type
0057                     value_compare;
0058 
0059        typedef value_compare
0060                     key_compare;
0061 
0062        typedef BOOST_DEDUCED_TYPENAME
0063            mpl::eval_if_c<Ordered,
0064                           mpl::identity<void>,
0065                           select_hasher<VoidPtrSet> >::type
0066                     hasher;
0067 
0068        typedef BOOST_DEDUCED_TYPENAME
0069            mpl::eval_if_c<Ordered,
0070                           mpl::identity<void>,
0071                           select_key_equal<VoidPtrSet> >::type
0072                     key_equal;
0073 
0074        typedef BOOST_DEDUCED_TYPENAME
0075            mpl::if_c<Ordered,
0076                      ordered_associative_container_tag,
0077                      unordered_associative_container_tag>::type
0078                     container_type;
0079 
0080        typedef void_ptr_iterator<
0081                        BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
0082                     iterator;
0083 
0084        typedef void_ptr_iterator<
0085                         BOOST_DEDUCED_TYPENAME VoidPtrSet::const_iterator, const Key >
0086                     const_iterator;
0087 
0088        typedef void_ptr_iterator<
0089            BOOST_DEDUCED_TYPENAME
0090              mpl::eval_if_c<Ordered,
0091                             select_iterator<VoidPtrSet>,
0092                             select_local_iterator<VoidPtrSet> >::type,
0093              Key >
0094                     local_iterator;
0095 
0096        typedef void_ptr_iterator<
0097            BOOST_DEDUCED_TYPENAME
0098              mpl::eval_if_c<Ordered,
0099                             select_iterator<VoidPtrSet>,
0100                             select_const_local_iterator<VoidPtrSet> >::type,
0101              const Key >
0102                     const_local_iterator;
0103 
0104        template< class Iter >
0105        static Key* get_pointer( Iter i )
0106        {
0107            return static_cast<Key*>( *i.base() );
0108        }
0109 
0110        template< class Iter >
0111        static const Key* get_const_pointer( Iter i )
0112        {
0113            return static_cast<const Key*>( *i.base() );
0114        }
0115 
0116        BOOST_STATIC_CONSTANT(bool, allow_null = false );
0117     };
0118 
0119 
0120 
0121     template
0122     <
0123         class Key,
0124         class VoidPtrSet,
0125         class CloneAllocator = heap_clone_allocator,
0126         bool  Ordered        = true
0127     >
0128     class ptr_set_adapter_base
0129         : public ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
0130                                                       CloneAllocator >
0131     {
0132         typedef ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
0133                                                      CloneAllocator >
0134               base_type;
0135     public:
0136         typedef BOOST_DEDUCED_TYPENAME base_type::iterator
0137                       iterator;
0138         typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
0139                       const_iterator;
0140         typedef Key   key_type;
0141         typedef BOOST_DEDUCED_TYPENAME base_type::size_type
0142                       size_type;
0143 
0144     public:
0145         ptr_set_adapter_base()
0146         { }
0147 
0148         template< class SizeType >
0149         ptr_set_adapter_base( SizeType n,
0150                               ptr_container_detail::unordered_associative_container_tag tag )
0151           : base_type( n, tag )
0152         { }
0153 
0154         template< class Compare, class Allocator >
0155         ptr_set_adapter_base( const Compare& comp,
0156                               const Allocator& a )
0157          : base_type( comp, a )
0158         { }
0159 
0160         template< class Hash, class Pred, class Allocator >
0161         ptr_set_adapter_base( const Hash& hash,
0162                               const Pred& pred,
0163                               const Allocator& a )
0164          : base_type( hash, pred, a )
0165         { }
0166 
0167         template< class InputIterator, class Compare, class Allocator >
0168         ptr_set_adapter_base( InputIterator first, InputIterator last,
0169                               const Compare& comp,
0170                               const Allocator& a )
0171          : base_type( first, last, comp, a )
0172         { }
0173 
0174         template< class InputIterator, class Hash, class Pred, class Allocator >
0175         ptr_set_adapter_base( InputIterator first, InputIterator last,
0176                               const Hash& hash,
0177                               const Pred& pred,
0178                               const Allocator& a )
0179          : base_type( first, last, hash, pred, a )
0180         { }
0181 
0182         template< class U, class Set, class CA, bool b >
0183         ptr_set_adapter_base( const ptr_set_adapter_base<U,Set,CA,b>& r )
0184           : base_type( r )
0185         { }
0186 
0187         ptr_set_adapter_base( const ptr_set_adapter_base& r )
0188           : base_type( r )
0189         { }
0190 
0191 #ifndef BOOST_NO_AUTO_PTR
0192         template< class PtrContainer >
0193         explicit ptr_set_adapter_base( std::auto_ptr<PtrContainer> clone )
0194          : base_type( clone )
0195         { }
0196 #endif
0197 #ifndef BOOST_NO_CXX11_SMART_PTR
0198         template< class PtrContainer >
0199         explicit ptr_set_adapter_base( std::unique_ptr<PtrContainer> clone )
0200          : base_type( std::move( clone ) )
0201         { }
0202 #endif
0203 
0204         ptr_set_adapter_base& operator=( ptr_set_adapter_base r )
0205         {
0206             this->swap( r );
0207             return *this;
0208         }
0209 
0210 #ifndef BOOST_NO_AUTO_PTR
0211         template< typename PtrContainer >
0212         ptr_set_adapter_base& operator=( std::auto_ptr<PtrContainer> clone )
0213         {
0214             base_type::operator=( clone );
0215             return *this;
0216         }
0217 #endif
0218 #ifndef BOOST_NO_CXX11_SMART_PTR
0219         template< typename PtrContainer >
0220         ptr_set_adapter_base& operator=( std::unique_ptr<PtrContainer> clone )
0221         {
0222             base_type::operator=( std::move( clone ) );
0223             return *this;
0224         }
0225 #endif
0226 
0227         using base_type::erase;
0228 
0229         size_type erase( const key_type& x ) // nothrow
0230         {
0231             key_type* key = const_cast<key_type*>(&x);
0232             iterator i( this->base().find( key ) );
0233             if( i == this->end() )                                  // nothrow
0234                 return 0u;                                          // nothrow
0235             key = static_cast<key_type*>(*i.base());                // nothrow
0236             size_type res = this->base().erase( key );              // nothrow
0237             this->remove( key );                                    // nothrow
0238             return res;
0239         }
0240 
0241 
0242         iterator find( const key_type& x )
0243         {
0244             return iterator( this->base().
0245                              find( const_cast<key_type*>(&x) ) );
0246         }
0247 
0248         const_iterator find( const key_type& x ) const
0249         {
0250             return const_iterator( this->base().
0251                                    find( const_cast<key_type*>(&x) ) );
0252         }
0253 
0254         size_type count( const key_type& x ) const
0255         {
0256             return this->base().count( const_cast<key_type*>(&x) );
0257         }
0258 
0259         iterator lower_bound( const key_type& x )
0260         {
0261             return iterator( this->base().
0262                              lower_bound( const_cast<key_type*>(&x) ) );
0263         }
0264 
0265         const_iterator lower_bound( const key_type& x ) const
0266         {
0267             return const_iterator( this->base().
0268                                    lower_bound( const_cast<key_type*>(&x) ) );
0269         }
0270 
0271         iterator upper_bound( const key_type& x )
0272         {
0273             return iterator( this->base().
0274                              upper_bound( const_cast<key_type*>(&x) ) );
0275         }
0276 
0277         const_iterator upper_bound( const key_type& x ) const
0278         {
0279             return const_iterator( this->base().
0280                                    upper_bound( const_cast<key_type*>(&x) ) );
0281         }
0282 
0283         iterator_range<iterator> equal_range( const key_type& x )
0284         {
0285             std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,
0286                       BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
0287                 p = this->base().
0288                 equal_range( const_cast<key_type*>(&x) );
0289             return make_iterator_range( iterator( p.first ),
0290                                         iterator( p.second ) );
0291         }
0292 
0293         iterator_range<const_iterator> equal_range( const key_type& x ) const
0294         {
0295             std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
0296                       BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
0297                 p = this->base().
0298                 equal_range( const_cast<key_type*>(&x) );
0299             return make_iterator_range( const_iterator( p.first ),
0300                                         const_iterator( p.second ) );
0301         }
0302 
0303     protected:
0304         size_type bucket( const key_type& key ) const
0305         {
0306             return this->base().bucket( const_cast<key_type*>(&key) );
0307         }
0308     };
0309 
0310 } // ptr_container_detail
0311 
0312     /////////////////////////////////////////////////////////////////////////
0313     // ptr_set_adapter
0314     /////////////////////////////////////////////////////////////////////////
0315 
0316     template
0317     <
0318         class Key,
0319         class VoidPtrSet,
0320         class CloneAllocator = heap_clone_allocator,
0321         bool  Ordered        = true
0322     >
0323     class ptr_set_adapter :
0324         public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
0325     {
0326         typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
0327             base_type;
0328 
0329     public: // typedefs
0330 
0331         typedef BOOST_DEDUCED_TYPENAME base_type::iterator
0332                      iterator;
0333         typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
0334                      const_iterator;
0335         typedef BOOST_DEDUCED_TYPENAME base_type::size_type
0336                      size_type;
0337         typedef Key  key_type;
0338         typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
0339                      auto_type;
0340         typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
0341                      allocator_type;
0342     private:
0343 
0344         template< typename II >
0345         void set_basic_clone_and_insert( II first, II last ) // basic
0346         {
0347             while( first != last )
0348             {
0349                 if( this->find( *first ) == this->end() )
0350                     insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
0351                 ++first;
0352             }
0353         }
0354 
0355     public:
0356         ptr_set_adapter()
0357         { }
0358 
0359         template< class SizeType >
0360         ptr_set_adapter( SizeType n,
0361                          ptr_container_detail::unordered_associative_container_tag tag )
0362           : base_type( n, tag )
0363         { }
0364 
0365         template< class Comp >
0366         explicit ptr_set_adapter( const Comp& comp,
0367                                   const allocator_type& a )
0368           : base_type( comp, a )
0369         {
0370             BOOST_ASSERT( this->empty() );
0371         }
0372 
0373         template< class SizeType, class Hash, class Pred, class Allocator >
0374         ptr_set_adapter( SizeType n,
0375                          const Hash& hash,
0376                          const Pred& pred,
0377                          const Allocator& a )
0378          : base_type( n, hash, pred, a )
0379         { }
0380 
0381         template< class Hash, class Pred, class Allocator >
0382         ptr_set_adapter( const Hash& hash,
0383                          const Pred& pred,
0384                          const Allocator& a )
0385          : base_type( hash, pred, a )
0386         { }
0387 
0388         template< class InputIterator >
0389         ptr_set_adapter( InputIterator first, InputIterator last )
0390          : base_type( first, last )
0391         { }
0392 
0393         template< class InputIterator, class Compare, class Allocator >
0394         ptr_set_adapter( InputIterator first, InputIterator last,
0395                          const Compare& comp,
0396                          const Allocator a = Allocator() )
0397           : base_type( comp, a )
0398         {
0399             BOOST_ASSERT( this->empty() );
0400             set_basic_clone_and_insert( first, last );
0401         }
0402 
0403         template< class InputIterator, class Hash, class Pred, class Allocator >
0404         ptr_set_adapter( InputIterator first, InputIterator last,
0405                          const Hash& hash,
0406                          const Pred& pred,
0407                          const Allocator& a )
0408           : base_type( first, last, hash, pred, a )
0409         { }
0410 
0411         explicit ptr_set_adapter( const ptr_set_adapter& r )
0412           : base_type( r )
0413         { }
0414 
0415         template< class U, class Set, class CA, bool b >
0416         explicit ptr_set_adapter( const ptr_set_adapter<U,Set,CA,b>& r )
0417           : base_type( r )
0418         { }
0419 
0420 #ifndef BOOST_NO_AUTO_PTR
0421         template< class PtrContainer >
0422         explicit ptr_set_adapter( std::auto_ptr<PtrContainer> clone )
0423          : base_type( clone )
0424         { }
0425 #endif
0426 #ifndef BOOST_NO_CXX11_SMART_PTR
0427         template< class PtrContainer >
0428         explicit ptr_set_adapter( std::unique_ptr<PtrContainer> clone )
0429          : base_type( std::move( clone ) )
0430         { }
0431 #endif
0432 
0433         template< class U, class Set, class CA, bool b >
0434         ptr_set_adapter& operator=( const ptr_set_adapter<U,Set,CA,b>& r )
0435         {
0436             base_type::operator=( r );
0437             return *this;
0438         }
0439 
0440 #ifndef BOOST_NO_AUTO_PTR
0441         template< class T >
0442         void operator=( std::auto_ptr<T> r )
0443         {
0444             base_type::operator=( r );
0445         }
0446 #endif
0447 #ifndef BOOST_NO_CXX11_SMART_PTR
0448         template< class T >
0449         void operator=( std::unique_ptr<T> r )
0450         {
0451             base_type::operator=( std::move( r ) );
0452         }
0453 #endif
0454 
0455         std::pair<iterator,bool> insert( key_type* x ) // strong
0456         {
0457             this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
0458 
0459             auto_type ptr( x, *this );
0460             std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
0461                  res = this->base().insert( x );
0462             if( res.second )
0463                 ptr.release();
0464             return std::make_pair( iterator( res.first ), res.second );
0465         }
0466 
0467 #ifndef BOOST_NO_AUTO_PTR
0468         template< class U >
0469         std::pair<iterator,bool> insert( std::auto_ptr<U> x )
0470         {
0471             return insert( x.release() );
0472         }
0473 #endif
0474 #ifndef BOOST_NO_CXX11_SMART_PTR
0475         template< class U >
0476         std::pair<iterator,bool> insert( std::unique_ptr<U> x )
0477         {
0478             return insert( x.release() );
0479         }
0480 #endif
0481 
0482 
0483         iterator insert( iterator where, key_type* x ) // strong
0484         {
0485             this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
0486 
0487             auto_type ptr( x, *this );
0488             BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
0489                 res = this->base().insert( where.base(), x );
0490             if( *res == x )
0491                 ptr.release();
0492             return iterator( res);
0493         }
0494 
0495 #ifndef BOOST_NO_AUTO_PTR
0496         template< class U >
0497         iterator insert( iterator where, std::auto_ptr<U> x )
0498         {
0499             return insert( where, x.release() );
0500         }
0501 #endif
0502 #ifndef BOOST_NO_CXX11_SMART_PTR
0503         template< class U >
0504         iterator insert( iterator where, std::unique_ptr<U> x )
0505         {
0506             return insert( where, x.release() );
0507         }
0508 #endif
0509 
0510         template< typename InputIterator >
0511         void insert( InputIterator first, InputIterator last ) // basic
0512         {
0513             set_basic_clone_and_insert( first, last );
0514         }
0515 
0516 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0517 #else
0518 
0519         template< class Range >
0520         BOOST_DEDUCED_TYPENAME
0521         boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
0522         insert( const Range& r )
0523         {
0524             insert( boost::begin(r), boost::end(r) );
0525         }
0526 
0527 #endif
0528 
0529         template< class PtrSetAdapter >
0530         bool transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
0531                        PtrSetAdapter& from ) // strong
0532         {
0533             return this->single_transfer( object, from );
0534         }
0535 
0536         template< class PtrSetAdapter >
0537         size_type
0538         transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
0539                   BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
0540                   PtrSetAdapter& from ) // basic
0541         {
0542             return this->single_transfer( first, last, from );
0543         }
0544 
0545 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0546 #else
0547 
0548         template< class PtrSetAdapter, class Range >
0549         BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
0550                             BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator >,
0551                                                             size_type >::type
0552         transfer( const Range& r, PtrSetAdapter& from ) // basic
0553         {
0554             return transfer( boost::begin(r), boost::end(r), from );
0555         }
0556 
0557 #endif
0558 
0559         template< class PtrSetAdapter >
0560         size_type transfer( PtrSetAdapter& from ) // basic
0561         {
0562             return transfer( from.begin(), from.end(), from );
0563         }
0564 
0565     };
0566 
0567     /////////////////////////////////////////////////////////////////////////
0568     // ptr_multiset_adapter
0569     /////////////////////////////////////////////////////////////////////////
0570 
0571     template
0572     <
0573         class Key,
0574         class VoidPtrMultiSet,
0575         class CloneAllocator = heap_clone_allocator,
0576         bool Ordered         = true
0577     >
0578     class ptr_multiset_adapter :
0579         public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered>
0580     {
0581          typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered> base_type;
0582 
0583     public: // typedefs
0584 
0585         typedef BOOST_DEDUCED_TYPENAME base_type::iterator
0586                        iterator;
0587         typedef BOOST_DEDUCED_TYPENAME base_type::size_type
0588                        size_type;
0589         typedef Key    key_type;
0590         typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
0591                        auto_type;
0592         typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiSet::allocator_type
0593                        allocator_type;
0594     private:
0595         template< typename II >
0596         void set_basic_clone_and_insert( II first, II last ) // basic
0597         {
0598             while( first != last )
0599             {
0600                 insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
0601                 ++first;
0602             }
0603         }
0604 
0605     public:
0606         ptr_multiset_adapter()
0607         { }
0608 
0609         template< class SizeType >
0610         ptr_multiset_adapter( SizeType n,
0611                               ptr_container_detail::unordered_associative_container_tag tag )
0612           : base_type( n, tag )
0613         { }
0614 
0615         template< class Comp >
0616         explicit ptr_multiset_adapter( const Comp& comp,
0617                                        const allocator_type& a )
0618         : base_type( comp, a )
0619         { }
0620 
0621         template< class Hash, class Pred, class Allocator >
0622         ptr_multiset_adapter( const Hash& hash,
0623                               const Pred& pred,
0624                               const Allocator& a )
0625          : base_type( hash, pred, a )
0626         { }
0627 
0628         template< class InputIterator >
0629         ptr_multiset_adapter( InputIterator first, InputIterator last )
0630          : base_type( first, last )
0631         { }
0632 
0633         template< class InputIterator, class Comp >
0634         ptr_multiset_adapter( InputIterator first, InputIterator last,
0635                               const Comp& comp,
0636                               const allocator_type& a = allocator_type() )
0637         : base_type( comp, a )
0638         {
0639             set_basic_clone_and_insert( first, last );
0640         }
0641 
0642         template< class InputIterator, class Hash, class Pred, class Allocator >
0643         ptr_multiset_adapter( InputIterator first, InputIterator last,
0644                               const Hash& hash,
0645                               const Pred& pred,
0646                               const Allocator& a )
0647          : base_type( first, last, hash, pred, a )
0648         { }
0649 
0650         template< class U, class Set, class CA, bool b >
0651         explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set,CA,b>& r )
0652           : base_type( r )
0653         { }
0654 
0655 #ifndef BOOST_NO_AUTO_PTR
0656         template< class PtrContainer >
0657         explicit ptr_multiset_adapter( std::auto_ptr<PtrContainer> clone )
0658          : base_type( clone )
0659         { }
0660 #endif
0661 #ifndef BOOST_NO_CXX11_SMART_PTR
0662         template< class PtrContainer >
0663         explicit ptr_multiset_adapter( std::unique_ptr<PtrContainer> clone )
0664          : base_type( std::move( clone ) )
0665         { }
0666 #endif
0667 
0668         template< class U, class Set, class CA, bool b >
0669         ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set,CA,b>& r )
0670         {
0671             base_type::operator=( r );
0672             return *this;
0673         }
0674 
0675 #ifndef BOOST_NO_AUTO_PTR
0676         template< class T >
0677         void operator=( std::auto_ptr<T> r )
0678         {
0679             base_type::operator=( r );
0680         }
0681 #endif
0682 #ifndef BOOST_NO_CXX11_SMART_PTR
0683         template< class T >
0684         void operator=( std::unique_ptr<T> r )
0685         {
0686             base_type::operator=( std::move( r ) );
0687         }
0688 #endif
0689 
0690         iterator insert( iterator before, key_type* x ) // strong
0691         {
0692             return base_type::insert( before, x );
0693         }
0694 
0695 #ifndef BOOST_NO_AUTO_PTR
0696         template< class U >
0697         iterator insert( iterator before, std::auto_ptr<U> x )
0698         {
0699             return insert( before, x.release() );
0700         }
0701 #endif
0702 #ifndef BOOST_NO_CXX11_SMART_PTR
0703         template< class U >
0704         iterator insert( iterator before, std::unique_ptr<U> x )
0705         {
0706             return insert( before, x.release() );
0707         }
0708 #endif
0709 
0710         iterator insert( key_type* x ) // strong
0711         {
0712             this->enforce_null_policy( x, "Null pointer in 'ptr_multiset::insert()'" );
0713 
0714             auto_type ptr( x, *this );
0715             BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
0716                  res = this->base().insert( x );
0717             ptr.release();
0718             return iterator( res );
0719         }
0720 
0721 #ifndef BOOST_NO_AUTO_PTR
0722         template< class U >
0723         iterator insert( std::auto_ptr<U> x )
0724         {
0725             return insert( x.release() );
0726         }
0727 #endif
0728 #ifndef BOOST_NO_CXX11_SMART_PTR
0729         template< class U >
0730         iterator insert( std::unique_ptr<U> x )
0731         {
0732             return insert( x.release() );
0733         }
0734 #endif
0735 
0736         template< typename InputIterator >
0737         void insert( InputIterator first, InputIterator last ) // basic
0738         {
0739             set_basic_clone_and_insert( first, last );
0740         }
0741 
0742 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0743 #else
0744 
0745         template< class Range >
0746         BOOST_DEDUCED_TYPENAME
0747         boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
0748         insert( const Range& r )
0749         {
0750             insert( boost::begin(r), boost::end(r) );
0751         }
0752 
0753 #endif
0754 
0755         template< class PtrSetAdapter >
0756         void transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
0757                        PtrSetAdapter& from ) // strong
0758         {
0759             this->multi_transfer( object, from );
0760         }
0761 
0762         template< class PtrSetAdapter >
0763         size_type transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
0764                             BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
0765                             PtrSetAdapter& from ) // basic
0766         {
0767             return this->multi_transfer( first, last, from );
0768         }
0769 
0770 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0771 #else
0772 
0773         template< class PtrSetAdapter, class Range >
0774         BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
0775                        BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator >, size_type >::type
0776         transfer(  const Range& r, PtrSetAdapter& from ) // basic
0777         {
0778             return transfer( boost::begin(r), boost::end(r), from );
0779         }
0780 
0781 #endif
0782 
0783         template< class PtrSetAdapter >
0784         void transfer( PtrSetAdapter& from ) // basic
0785         {
0786             transfer( from.begin(), from.end(), from );
0787             BOOST_ASSERT( from.empty() );
0788         }
0789 
0790     };
0791 
0792 } // namespace 'boost'
0793 
0794 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0795 #pragma GCC diagnostic pop
0796 #endif
0797 
0798 #endif