2 // Boost.Pointer Container
4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/ptr_container/
12 #ifndef BOOST_PTR_CONTAINER_DETAIL_PTR_MAP_ADAPTER_HPP
13 #define BOOST_PTR_CONTAINER_DETAIL_PTR_MAP_ADAPTER_HPP
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
19 #include <boost/ptr_container/detail/map_iterator.hpp>
20 #include <boost/ptr_container/detail/associative_ptr_container.hpp>
21 #include <boost/ptr_container/detail/meta_functions.hpp>
22 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
23 #include <boost/static_assert.hpp>
24 #include <boost/range/iterator_range.hpp>
26 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
33 namespace ptr_container_detail
44 typedef BOOST_DEDUCED_TYPENAME remove_nullable<T>::type
49 typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
52 typedef BOOST_DEDUCED_TYPENAME
53 mpl::eval_if_c<Ordered,
54 select_value_compare<VoidPtrMap>,
55 mpl::identity<void> >::type
58 typedef BOOST_DEDUCED_TYPENAME
59 mpl::eval_if_c<Ordered,
60 select_key_compare<VoidPtrMap>,
61 mpl::identity<void> >::type
64 typedef BOOST_DEDUCED_TYPENAME
65 mpl::eval_if_c<Ordered,
67 select_hasher<VoidPtrMap> >::type
70 typedef BOOST_DEDUCED_TYPENAME
71 mpl::eval_if_c<Ordered,
73 select_key_equal<VoidPtrMap> >::type
76 typedef BOOST_DEDUCED_TYPENAME
78 ptr_container_detail::ordered_associative_container_tag,
79 ptr_container_detail::unordered_associative_container_tag>::type
82 typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::key_type
87 typedef ptr_map_iterator< BOOST_DEDUCED_TYPENAME VoidPtrMap::iterator, key_type, U* const >
90 typedef ptr_map_iterator< BOOST_DEDUCED_TYPENAME VoidPtrMap::const_iterator, key_type, const U* const>
93 typedef ptr_map_iterator<
94 BOOST_DEDUCED_TYPENAME
95 mpl::eval_if_c<Ordered,
96 select_iterator<VoidPtrMap>,
97 select_local_iterator<VoidPtrMap> >::type,
101 typedef ptr_map_iterator<
102 BOOST_DEDUCED_TYPENAME
103 mpl::eval_if_c<Ordered,
104 select_iterator<VoidPtrMap>,
105 select_const_local_iterator<VoidPtrMap> >::type,
106 key_type, const U* const >
107 const_local_iterator;
109 template< class Iter >
110 static U* get_pointer( Iter i )
115 template< class Iter >
116 static const U* get_const_pointer( Iter i )
121 BOOST_STATIC_CONSTANT( bool, allow_null = boost::is_nullable<T>::value );
130 class CloneAllocator,
133 class ptr_map_adapter_base :
134 public ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
137 typedef ptr_container_detail::associative_ptr_container< map_config<T,VoidPtrMap,Ordered>,
141 typedef map_config<T,VoidPtrMap,Ordered> config;
142 typedef ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered> this_type;
146 typedef BOOST_DEDUCED_TYPENAME base_type::allocator_type
148 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
150 typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
152 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
154 typedef BOOST_DEDUCED_TYPENAME base_type::key_type
156 typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
158 typedef BOOST_DEDUCED_TYPENAME base_type::value_type
160 typedef BOOST_DEDUCED_TYPENAME base_type::reference
162 typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
163 const_mapped_reference;
164 typedef BOOST_DEDUCED_TYPENAME iterator_value<iterator>::type
168 typedef BOOST_DEDUCED_TYPENAME iterator_value<const_iterator>::type
172 typedef const_reference
176 const_mapped_reference lookup( const key_type& key ) const
178 const_iterator i = this->find( key );
179 BOOST_PTR_CONTAINER_THROW_EXCEPTION( i == this->end(), bad_ptr_container_operation,
180 "'ptr_map/multimap::at()' could"
185 struct eraser // scope guard
189 const key_type& key_;
191 eraser( VoidPtrMap* m, const key_type& key )
192 : released_(false), m_(m), key_(key)
201 void release() { released_ = true; }
204 eraser& operator=(const eraser&);
207 mapped_reference insert_lookup( const key_type& key )
209 void*& ref = this->base()[key];
212 return *static_cast<mapped_type>(ref);
216 eraser e(&this->base(),key); // nothrow
217 mapped_type res = new T(); // strong
218 ref = res; // nothrow
219 e.release(); // nothrow
226 ptr_map_adapter_base()
229 template< class SizeType >
230 explicit ptr_map_adapter_base( SizeType n,
231 ptr_container_detail::unordered_associative_container_tag tag )
232 : base_type( n, tag )
235 template< class Compare, class Allocator >
236 ptr_map_adapter_base( const Compare& comp,
238 : base_type( comp, a )
241 template< class Hash, class Pred, class Allocator >
242 ptr_map_adapter_base( const Hash& hash,
245 : base_type( hash, pred, a )
248 template< class InputIterator >
249 ptr_map_adapter_base( InputIterator first, InputIterator last )
250 : base_type( first, last )
253 template< class InputIterator, class Comp >
254 ptr_map_adapter_base( InputIterator first, InputIterator last,
256 const allocator_type& a = allocator_type() )
257 : base_type( first, last, comp, a )
260 template< class InputIterator, class Hash, class Pred, class Allocator >
261 ptr_map_adapter_base( InputIterator first, InputIterator last,
265 : base_type( first, last, hash, pred, a )
268 #ifndef BOOST_NO_AUTO_PTR
269 template< class PtrContainer >
270 explicit ptr_map_adapter_base( std::auto_ptr<PtrContainer> clone )
274 template< typename PtrContainer >
275 ptr_map_adapter_base& operator=( std::auto_ptr<PtrContainer> clone )
277 base_type::operator=( clone );
281 #ifndef BOOST_NO_CXX11_SMART_PTR
282 template< class PtrContainer >
283 explicit ptr_map_adapter_base( std::unique_ptr<PtrContainer> clone )
284 : base_type( std::move( clone ) )
287 template< typename PtrContainer >
288 ptr_map_adapter_base& operator=( std::unique_ptr<PtrContainer> clone )
290 base_type::operator=( std::move( clone ) );
295 iterator find( const key_type& x )
297 return iterator( this->base().find( x ) );
300 const_iterator find( const key_type& x ) const
302 return const_iterator( this->base().find( x ) );
305 size_type count( const key_type& x ) const
307 return this->base().count( x );
310 iterator lower_bound( const key_type& x )
312 return iterator( this->base().lower_bound( x ) );
315 const_iterator lower_bound( const key_type& x ) const
317 return const_iterator( this->base().lower_bound( x ) );
320 iterator upper_bound( const key_type& x )
322 return iterator( this->base().upper_bound( x ) );
325 const_iterator upper_bound( const key_type& x ) const
327 return const_iterator( this->base().upper_bound( x ) );
330 iterator_range<iterator> equal_range( const key_type& x )
332 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,
333 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
334 p = this->base().equal_range( x );
335 return make_iterator_range( iterator( p.first ), iterator( p.second ) );
338 iterator_range<const_iterator> equal_range( const key_type& x ) const
340 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
341 BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
342 p = this->base().equal_range( x );
343 return make_iterator_range( const_iterator( p.first ),
344 const_iterator( p.second ) );
347 mapped_reference at( const key_type& key )
349 return const_cast<mapped_reference>( lookup( key ) );
352 const_mapped_reference at( const key_type& key ) const
354 return lookup( key );
357 mapped_reference operator[]( const key_type& key )
359 return insert_lookup( key );
362 auto_type replace( iterator where, mapped_type x ) // strong
364 BOOST_ASSERT( where != this->end() );
365 this->enforce_null_policy( x, "Null pointer in 'replace()'" );
367 auto_type ptr( x, *this );
368 BOOST_PTR_CONTAINER_THROW_EXCEPTION( this->empty(),
369 bad_ptr_container_operation,
370 "'replace()' on empty container" );
372 auto_type old( where->second, *this ); // nothrow
373 where.base()->second = ptr.release(); // nothrow, commit
374 return boost::ptr_container::move( old );
377 #ifndef BOOST_NO_AUTO_PTR
379 auto_type replace( iterator where, std::auto_ptr<U> x )
381 return replace( where, x.release() );
384 #ifndef BOOST_NO_CXX11_SMART_PTR
386 auto_type replace( iterator where, std::unique_ptr<U> x )
388 return replace( where, x.release() );
393 size_type bucket( const key_type& key ) const
395 return this->base().bucket( key );
399 } // ptr_container_detail
401 /////////////////////////////////////////////////////////////////////////
403 /////////////////////////////////////////////////////////////////////////
409 class CloneAllocator = heap_clone_allocator,
412 class ptr_map_adapter :
413 public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
415 typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMap,CloneAllocator,Ordered>
419 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
421 typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
423 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
425 typedef BOOST_DEDUCED_TYPENAME base_type::key_type
427 typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
429 typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
431 typedef BOOST_DEDUCED_TYPENAME VoidPtrMap::allocator_type
433 typedef BOOST_DEDUCED_TYPENAME base_type::mapped_type
437 void safe_insert( const key_type& key, auto_type ptr ) // strong
439 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
441 this->base().insert( std::make_pair( key, ptr.get() ) ); // strong, commit
442 if( res.second ) // nothrow
443 ptr.release(); // nothrow
447 void map_basic_clone_and_insert( II first, II last )
449 while( first != last )
451 if( this->find( first->first ) == this->end() )
453 const_reference p = *first.base(); // nothrow
454 auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
456 this->safe_insert( p.first,
457 boost::ptr_container::move( ptr ) );
468 template< class Comp >
469 explicit ptr_map_adapter( const Comp& comp,
470 const allocator_type& a )
471 : base_type( comp, a ) { }
473 template< class SizeType >
474 explicit ptr_map_adapter( SizeType n,
475 ptr_container_detail::unordered_associative_container_tag tag )
476 : base_type( n, tag ) { }
478 template< class Hash, class Pred, class Allocator >
479 ptr_map_adapter( const Hash& hash,
482 : base_type( hash, pred, a )
485 template< class InputIterator >
486 ptr_map_adapter( InputIterator first, InputIterator last )
488 map_basic_clone_and_insert( first, last );
491 template< class InputIterator, class Comp >
492 ptr_map_adapter( InputIterator first, InputIterator last,
494 const allocator_type& a = allocator_type() )
495 : base_type( comp, a )
497 map_basic_clone_and_insert( first, last );
500 template< class InputIterator, class Hash, class Pred, class Allocator >
501 ptr_map_adapter( InputIterator first, InputIterator last,
505 : base_type( hash, pred, a )
507 map_basic_clone_and_insert( first, last );
510 ptr_map_adapter( const ptr_map_adapter& r )
512 map_basic_clone_and_insert( r.begin(), r.end() );
515 template< class Key, class U, class CA, bool b >
516 ptr_map_adapter( const ptr_map_adapter<Key,U,CA,b>& r )
518 map_basic_clone_and_insert( r.begin(), r.end() );
521 #ifndef BOOST_NO_AUTO_PTR
523 ptr_map_adapter( std::auto_ptr<U> r ) : base_type( r )
526 #ifndef BOOST_NO_CXX11_SMART_PTR
528 ptr_map_adapter( std::unique_ptr<U> r ) : base_type( std::move( r ) )
532 ptr_map_adapter& operator=( ptr_map_adapter r )
538 #ifndef BOOST_NO_AUTO_PTR
540 ptr_map_adapter& operator=( std::auto_ptr<U> r )
542 base_type::operator=( r );
546 #ifndef BOOST_NO_CXX11_SMART_PTR
548 ptr_map_adapter& operator=( std::unique_ptr<U> r )
550 base_type::operator=( std::move( r ) );
555 using base_type::release;
557 template< typename InputIterator >
558 void insert( InputIterator first, InputIterator last ) // basic
560 map_basic_clone_and_insert( first, last );
563 template< class Range >
564 void insert( const Range& r )
566 insert( boost::begin(r), boost::end(r) );
570 std::pair<iterator,bool> insert_impl( const key_type& key, mapped_type x ) // strong
572 this->enforce_null_policy( x, "Null pointer in ptr_map_adapter::insert()" );
574 auto_type ptr( x, *this ); // nothrow
575 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
576 res = this->base().insert( std::make_pair( key, x ) ); // strong, commit
577 if( res.second ) // nothrow
578 ptr.release(); // nothrow
579 return std::make_pair( iterator( res.first ), res.second ); // nothrow
582 iterator insert_impl( iterator before, const key_type& key, mapped_type x ) // strong
584 this->enforce_null_policy( x,
585 "Null pointer in 'ptr_map_adapter::insert()'" );
587 auto_type ptr( x, *this ); // nothrow
588 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
589 res = this->base().insert( before.base(), std::make_pair( key, x ) );
591 ptr.release(); // notrow
592 return iterator( res );
597 std::pair<iterator,bool> insert( key_type& key, mapped_type x )
599 return insert_impl( key, x );
602 #ifndef BOOST_NO_AUTO_PTR
604 std::pair<iterator,bool> insert( const key_type& key, std::auto_ptr<U> x )
606 return insert_impl( key, x.release() );
609 #ifndef BOOST_NO_CXX11_SMART_PTR
611 std::pair<iterator,bool> insert( const key_type& key, std::unique_ptr<U> x )
613 return insert_impl( key, x.release() );
617 template< class F, class S >
618 iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
620 this->enforce_null_policy( p.second,
621 "Null pointer in 'ptr_map_adapter::insert()'" );
623 auto_type ptr( this->null_policy_allocate_clone(p.second), *this );
624 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
625 result = this->base().insert( before.base(),
626 std::make_pair(p.first,ptr.get()) ); // strong
627 if( ptr.get() == result->second )
630 return iterator( result );
633 iterator insert( iterator before, key_type& key, mapped_type x ) // strong
635 return insert_impl( before, key, x );
638 #ifndef BOOST_NO_AUTO_PTR
640 iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong
642 return insert_impl( before, key, x.release() );
645 #ifndef BOOST_NO_CXX11_SMART_PTR
647 iterator insert( iterator before, const key_type& key, std::unique_ptr<U> x ) // strong
649 return insert_impl( before, key, x.release() );
653 template< class PtrMapAdapter >
654 bool transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
655 PtrMapAdapter& from ) // strong
657 return this->single_transfer( object, from );
660 template< class PtrMapAdapter >
661 size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
662 BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
663 PtrMapAdapter& from ) // basic
665 return this->single_transfer( first, last, from );
668 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
671 template< class PtrMapAdapter, class Range >
672 BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
673 BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator >,
675 transfer( const Range& r, PtrMapAdapter& from ) // basic
677 return transfer( boost::begin(r), boost::end(r), from );
682 template< class PtrMapAdapter >
683 size_type transfer( PtrMapAdapter& from ) // basic
685 return transfer( from.begin(), from.end(), from );
689 /////////////////////////////////////////////////////////////////////////
690 // ptr_multimap_adapter
691 /////////////////////////////////////////////////////////////////////////
696 class VoidPtrMultiMap,
697 class CloneAllocator = heap_clone_allocator,
700 class ptr_multimap_adapter :
701 public ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
703 typedef ptr_container_detail::ptr_map_adapter_base<T,VoidPtrMultiMap,CloneAllocator,Ordered>
707 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
709 typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
711 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
713 typedef BOOST_DEDUCED_TYPENAME base_type::key_type
715 typedef BOOST_DEDUCED_TYPENAME base_type::const_reference
717 typedef BOOST_DEDUCED_TYPENAME base_type::mapped_type
719 typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
721 typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiMap::allocator_type
725 void safe_insert( const key_type& key, auto_type ptr ) // strong
728 std::make_pair( key, ptr.get() ) ); // strong, commit
729 ptr.release(); // nothrow
732 template< typename II >
733 void map_basic_clone_and_insert( II first, II last )
735 while( first != last )
737 const_reference pair = *first.base(); // nothrow
738 auto_type ptr( this->null_policy_allocate_clone(pair.second), *this );
740 safe_insert( pair.first,
741 boost::ptr_container::move( ptr ) );
749 ptr_multimap_adapter()
752 template< class SizeType >
753 ptr_multimap_adapter( SizeType n,
754 ptr_container_detail::unordered_associative_container_tag tag )
755 : base_type( n, tag )
758 template< class Comp >
759 explicit ptr_multimap_adapter( const Comp& comp,
760 const allocator_type& a )
761 : base_type( comp, a ) { }
763 template< class Hash, class Pred, class Allocator >
764 ptr_multimap_adapter( const Hash& hash,
767 : base_type( hash, pred, a )
770 template< class InputIterator >
771 ptr_multimap_adapter( InputIterator first, InputIterator last )
773 map_basic_clone_and_insert( first, last );
776 template< class InputIterator, class Comp >
777 ptr_multimap_adapter( InputIterator first, InputIterator last,
779 const allocator_type& a )
780 : base_type( comp, a )
782 map_basic_clone_and_insert( first, last );
785 template< class InputIterator, class Hash, class Pred, class Allocator >
786 ptr_multimap_adapter( InputIterator first, InputIterator last,
790 : base_type( hash, pred, a )
792 map_basic_clone_and_insert( first, last );
795 ptr_multimap_adapter( const ptr_multimap_adapter& r )
797 map_basic_clone_and_insert( r.begin(), r.end() );
800 template< class Key, class U, class CA, bool b >
801 ptr_multimap_adapter( const ptr_multimap_adapter<Key,U,CA,b>& r )
803 map_basic_clone_and_insert( r.begin(), r.end() );
806 #ifndef BOOST_NO_AUTO_PTR
808 explicit ptr_multimap_adapter( std::auto_ptr<U> r ) : base_type( r )
811 #ifndef BOOST_NO_CXX11_SMART_PTR
813 explicit ptr_multimap_adapter( std::unique_ptr<U> r ) : base_type( std::move( r ) )
817 ptr_multimap_adapter& operator=( ptr_multimap_adapter r )
823 #ifndef BOOST_NO_AUTO_PTR
825 ptr_multimap_adapter& operator=( std::auto_ptr<U> r )
827 base_type::operator=( r );
831 #ifndef BOOST_NO_CXX11_SMART_PTR
833 ptr_multimap_adapter& operator=( std::unique_ptr<U> r )
835 base_type::operator=( std::move( r ) );
840 using base_type::release;
843 iterator insert_impl( const key_type& key, mapped_type x ) // strong
845 this->enforce_null_policy( x,
846 "Null pointer in 'ptr_multimap_adapter::insert()'" );
848 auto_type ptr( x, *this ); // nothrow
849 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
850 res = this->base().insert( std::make_pair( key, x ) );
852 ptr.release(); // notrow
853 return iterator( res );
856 iterator insert_impl( iterator before, const key_type& key, mapped_type x ) // strong
858 this->enforce_null_policy( x,
859 "Null pointer in 'ptr_multimap_adapter::insert()'" );
861 auto_type ptr( x, *this ); // nothrow
862 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
863 res = this->base().insert( before.base(),
864 std::make_pair( key, x ) );
866 ptr.release(); // notrow
867 return iterator( res );
871 template< typename InputIterator >
872 void insert( InputIterator first, InputIterator last ) // basic
874 map_basic_clone_and_insert( first, last );
877 template< class Range >
878 void insert( const Range& r )
880 insert( boost::begin(r), boost::end(r) );
883 iterator insert( key_type& key, mapped_type x ) // strong
885 return insert_impl( key, x );
888 #ifndef BOOST_NO_AUTO_PTR
890 iterator insert( const key_type& key, std::auto_ptr<U> x )
892 return insert_impl( key, x.release() );
895 #ifndef BOOST_NO_CXX11_SMART_PTR
897 iterator insert( const key_type& key, std::unique_ptr<U> x )
899 return insert_impl( key, x.release() );
903 template< class F, class S >
904 iterator insert( iterator before, ptr_container_detail::ref_pair<F,S> p ) // strong
906 this->enforce_null_policy( p.second,
907 "Null pointer in 'ptr_multimap_adapter::insert()'" );
908 iterator res = insert_impl( before, p.first,
909 this->null_policy_allocate_clone( p.second ) );
913 iterator insert( iterator before, key_type& key, mapped_type x ) // strong
915 return insert_impl( before, key, x );
918 #ifndef BOOST_NO_AUTO_PTR
920 iterator insert( iterator before, const key_type& key, std::auto_ptr<U> x ) // strong
922 return insert_impl( before, key, x.release() );
925 #ifndef BOOST_NO_CXX11_SMART_PTR
927 iterator insert( iterator before, const key_type& key, std::unique_ptr<U> x ) // strong
929 return insert_impl( before, key, x.release() );
933 template< class PtrMapAdapter >
934 void transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator object,
935 PtrMapAdapter& from ) // strong
937 this->multi_transfer( object, from );
940 template< class PtrMapAdapter >
941 size_type transfer( BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator first,
942 BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator last,
943 PtrMapAdapter& from ) // basic
945 return this->multi_transfer( first, last, from );
948 #if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
951 template< class PtrMapAdapter, class Range >
952 BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
953 BOOST_DEDUCED_TYPENAME PtrMapAdapter::iterator >,
955 transfer( const Range& r, PtrMapAdapter& from ) // basic
957 return transfer( boost::begin(r), boost::end(r), from );
961 template< class PtrMapAdapter >
962 void transfer( PtrMapAdapter& from ) // basic
964 transfer( from.begin(), from.end(), from );
965 BOOST_ASSERT( from.empty() );
970 template< class I, class F, class S >
971 inline bool is_null( const ptr_map_iterator<I,F,S>& i )
973 return i->second == 0;
976 } // namespace 'boost'
978 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
979 #pragma GCC diagnostic pop