]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/ptr_container/ptr_set_adapter.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / ptr_container / ptr_set_adapter.hpp
CommitLineData
7c673cae
FG
1//
2// Boost.Pointer Container
3//
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)
8//
9// For more information, see http://www.boost.org/libs/ptr_container/
10//
11
12#ifndef BOOST_PTR_CONTAINER_PTR_SET_ADAPTER_HPP
13#define BOOST_PTR_CONTAINER_PTR_SET_ADAPTER_HPP
14
15#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16# pragma once
17#endif
18
19#include <boost/ptr_container/detail/associative_ptr_container.hpp>
20#include <boost/ptr_container/detail/meta_functions.hpp>
21#include <boost/ptr_container/detail/void_ptr_iterator.hpp>
11fdf7f2 22#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
7c673cae
FG
23#include <boost/range/iterator_range.hpp>
24
11fdf7f2
TL
25#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
26#pragma GCC diagnostic push
27#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
28#endif
29
7c673cae
FG
30namespace boost
31{
32namespace ptr_container_detail
33{
34 template
35 <
36 class Key,
37 class VoidPtrSet,
38 bool Ordered
39 >
40 struct set_config
41 {
42 typedef VoidPtrSet
43 void_container_type;
44
45 typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
46 allocator_type;
47
48 typedef Key value_type;
49
50 typedef value_type
51 key_type;
52
53 typedef BOOST_DEDUCED_TYPENAME
54 mpl::eval_if_c<Ordered,
55 select_value_compare<VoidPtrSet>,
56 mpl::identity<void> >::type
57 value_compare;
58
59 typedef value_compare
60 key_compare;
61
62 typedef BOOST_DEDUCED_TYPENAME
63 mpl::eval_if_c<Ordered,
64 mpl::identity<void>,
65 select_hasher<VoidPtrSet> >::type
66 hasher;
67
68 typedef BOOST_DEDUCED_TYPENAME
69 mpl::eval_if_c<Ordered,
70 mpl::identity<void>,
71 select_key_equal<VoidPtrSet> >::type
72 key_equal;
73
74 typedef BOOST_DEDUCED_TYPENAME
75 mpl::if_c<Ordered,
76 ordered_associative_container_tag,
77 unordered_associative_container_tag>::type
78 container_type;
79
80 typedef void_ptr_iterator<
81 BOOST_DEDUCED_TYPENAME VoidPtrSet::iterator, Key >
82 iterator;
83
84 typedef void_ptr_iterator<
85 BOOST_DEDUCED_TYPENAME VoidPtrSet::const_iterator, const Key >
86 const_iterator;
87
88 typedef void_ptr_iterator<
89 BOOST_DEDUCED_TYPENAME
90 mpl::eval_if_c<Ordered,
91 select_iterator<VoidPtrSet>,
92 select_local_iterator<VoidPtrSet> >::type,
93 Key >
94 local_iterator;
95
96 typedef void_ptr_iterator<
97 BOOST_DEDUCED_TYPENAME
98 mpl::eval_if_c<Ordered,
99 select_iterator<VoidPtrSet>,
100 select_const_local_iterator<VoidPtrSet> >::type,
101 const Key >
102 const_local_iterator;
103
104 template< class Iter >
105 static Key* get_pointer( Iter i )
106 {
107 return static_cast<Key*>( *i.base() );
108 }
109
110 template< class Iter >
111 static const Key* get_const_pointer( Iter i )
112 {
113 return static_cast<const Key*>( *i.base() );
114 }
115
116 BOOST_STATIC_CONSTANT(bool, allow_null = false );
117 };
118
119
120
121 template
122 <
123 class Key,
124 class VoidPtrSet,
125 class CloneAllocator = heap_clone_allocator,
126 bool Ordered = true
127 >
128 class ptr_set_adapter_base
129 : public ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
130 CloneAllocator >
131 {
132 typedef ptr_container_detail::associative_ptr_container< set_config<Key,VoidPtrSet,Ordered>,
133 CloneAllocator >
134 base_type;
135 public:
136 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
137 iterator;
138 typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
139 const_iterator;
140 typedef Key key_type;
141 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
142 size_type;
143
144 public:
145 ptr_set_adapter_base()
146 { }
147
148 template< class SizeType >
149 ptr_set_adapter_base( SizeType n,
150 ptr_container_detail::unordered_associative_container_tag tag )
151 : base_type( n, tag )
152 { }
153
154 template< class Compare, class Allocator >
155 ptr_set_adapter_base( const Compare& comp,
156 const Allocator& a )
157 : base_type( comp, a )
158 { }
159
160 template< class Hash, class Pred, class Allocator >
161 ptr_set_adapter_base( const Hash& hash,
162 const Pred& pred,
163 const Allocator& a )
164 : base_type( hash, pred, a )
165 { }
166
167 template< class InputIterator, class Compare, class Allocator >
168 ptr_set_adapter_base( InputIterator first, InputIterator last,
169 const Compare& comp,
170 const Allocator& a )
171 : base_type( first, last, comp, a )
172 { }
173
174 template< class InputIterator, class Hash, class Pred, class Allocator >
175 ptr_set_adapter_base( InputIterator first, InputIterator last,
176 const Hash& hash,
177 const Pred& pred,
178 const Allocator& a )
179 : base_type( first, last, hash, pred, a )
180 { }
181
182 template< class U, class Set, class CA, bool b >
183 ptr_set_adapter_base( const ptr_set_adapter_base<U,Set,CA,b>& r )
184 : base_type( r )
185 { }
186
187 ptr_set_adapter_base( const ptr_set_adapter_base& r )
188 : base_type( r )
189 { }
190
11fdf7f2 191#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
192 template< class PtrContainer >
193 explicit ptr_set_adapter_base( std::auto_ptr<PtrContainer> clone )
194 : base_type( clone )
195 { }
11fdf7f2
TL
196#endif
197#ifndef BOOST_NO_CXX11_SMART_PTR
198 template< class PtrContainer >
199 explicit ptr_set_adapter_base( std::unique_ptr<PtrContainer> clone )
200 : base_type( std::move( clone ) )
201 { }
202#endif
7c673cae
FG
203
204 ptr_set_adapter_base& operator=( ptr_set_adapter_base r )
205 {
206 this->swap( r );
207 return *this;
208 }
209
11fdf7f2 210#ifndef BOOST_NO_AUTO_PTR
7c673cae 211 template< typename PtrContainer >
11fdf7f2 212 ptr_set_adapter_base& operator=( std::auto_ptr<PtrContainer> clone )
7c673cae
FG
213 {
214 base_type::operator=( clone );
215 return *this;
216 }
11fdf7f2
TL
217#endif
218#ifndef BOOST_NO_CXX11_SMART_PTR
219 template< typename PtrContainer >
220 ptr_set_adapter_base& operator=( std::unique_ptr<PtrContainer> clone )
221 {
222 base_type::operator=( std::move( clone ) );
223 return *this;
224 }
225#endif
7c673cae
FG
226
227 using base_type::erase;
228
229 size_type erase( const key_type& x ) // nothrow
230 {
231 key_type* key = const_cast<key_type*>(&x);
232 iterator i( this->base().find( key ) );
233 if( i == this->end() ) // nothrow
234 return 0u; // nothrow
235 key = static_cast<key_type*>(*i.base()); // nothrow
236 size_type res = this->base().erase( key ); // nothrow
237 this->remove( key ); // nothrow
238 return res;
239 }
240
241
242 iterator find( const key_type& x )
243 {
244 return iterator( this->base().
245 find( const_cast<key_type*>(&x) ) );
246 }
247
248 const_iterator find( const key_type& x ) const
249 {
250 return const_iterator( this->base().
251 find( const_cast<key_type*>(&x) ) );
252 }
253
254 size_type count( const key_type& x ) const
255 {
256 return this->base().count( const_cast<key_type*>(&x) );
257 }
258
259 iterator lower_bound( const key_type& x )
260 {
261 return iterator( this->base().
262 lower_bound( const_cast<key_type*>(&x) ) );
263 }
264
265 const_iterator lower_bound( const key_type& x ) const
266 {
267 return const_iterator( this->base().
268 lower_bound( const_cast<key_type*>(&x) ) );
269 }
270
271 iterator upper_bound( const key_type& x )
272 {
273 return iterator( this->base().
274 upper_bound( const_cast<key_type*>(&x) ) );
275 }
276
277 const_iterator upper_bound( const key_type& x ) const
278 {
279 return const_iterator( this->base().
280 upper_bound( const_cast<key_type*>(&x) ) );
281 }
282
283 iterator_range<iterator> equal_range( const key_type& x )
284 {
285 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,
286 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator>
287 p = this->base().
288 equal_range( const_cast<key_type*>(&x) );
289 return make_iterator_range( iterator( p.first ),
290 iterator( p.second ) );
291 }
292
293 iterator_range<const_iterator> equal_range( const key_type& x ) const
294 {
295 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator,
296 BOOST_DEDUCED_TYPENAME base_type::ptr_const_iterator>
297 p = this->base().
298 equal_range( const_cast<key_type*>(&x) );
299 return make_iterator_range( const_iterator( p.first ),
300 const_iterator( p.second ) );
301 }
302
303 protected:
304 size_type bucket( const key_type& key ) const
305 {
306 return this->base().bucket( const_cast<key_type*>(&key) );
307 }
308 };
309
310} // ptr_container_detail
311
312 /////////////////////////////////////////////////////////////////////////
313 // ptr_set_adapter
314 /////////////////////////////////////////////////////////////////////////
315
316 template
317 <
318 class Key,
319 class VoidPtrSet,
320 class CloneAllocator = heap_clone_allocator,
321 bool Ordered = true
322 >
323 class ptr_set_adapter :
324 public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
325 {
326 typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrSet,CloneAllocator,Ordered>
327 base_type;
328
329 public: // typedefs
330
331 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
332 iterator;
333 typedef BOOST_DEDUCED_TYPENAME base_type::const_iterator
334 const_iterator;
335 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
336 size_type;
337 typedef Key key_type;
338 typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
339 auto_type;
340 typedef BOOST_DEDUCED_TYPENAME VoidPtrSet::allocator_type
341 allocator_type;
342 private:
343
344 template< typename II >
345 void set_basic_clone_and_insert( II first, II last ) // basic
346 {
347 while( first != last )
348 {
349 if( this->find( *first ) == this->end() )
b32b8144 350 insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
7c673cae
FG
351 ++first;
352 }
353 }
354
355 public:
356 ptr_set_adapter()
357 { }
358
359 template< class SizeType >
360 ptr_set_adapter( SizeType n,
361 ptr_container_detail::unordered_associative_container_tag tag )
362 : base_type( n, tag )
363 { }
364
365 template< class Comp >
366 explicit ptr_set_adapter( const Comp& comp,
367 const allocator_type& a )
368 : base_type( comp, a )
369 {
370 BOOST_ASSERT( this->empty() );
371 }
372
b32b8144
FG
373 template< class SizeType, class Hash, class Pred, class Allocator >
374 ptr_set_adapter( SizeType n,
375 const Hash& hash,
376 const Pred& pred,
377 const Allocator& a )
378 : base_type( n, hash, pred, a )
379 { }
380
7c673cae
FG
381 template< class Hash, class Pred, class Allocator >
382 ptr_set_adapter( const Hash& hash,
383 const Pred& pred,
384 const Allocator& a )
385 : base_type( hash, pred, a )
386 { }
387
388 template< class InputIterator >
389 ptr_set_adapter( InputIterator first, InputIterator last )
390 : base_type( first, last )
391 { }
392
393 template< class InputIterator, class Compare, class Allocator >
394 ptr_set_adapter( InputIterator first, InputIterator last,
395 const Compare& comp,
396 const Allocator a = Allocator() )
397 : base_type( comp, a )
398 {
399 BOOST_ASSERT( this->empty() );
400 set_basic_clone_and_insert( first, last );
401 }
402
403 template< class InputIterator, class Hash, class Pred, class Allocator >
404 ptr_set_adapter( InputIterator first, InputIterator last,
405 const Hash& hash,
406 const Pred& pred,
407 const Allocator& a )
408 : base_type( first, last, hash, pred, a )
409 { }
410
411 explicit ptr_set_adapter( const ptr_set_adapter& r )
412 : base_type( r )
413 { }
414
415 template< class U, class Set, class CA, bool b >
416 explicit ptr_set_adapter( const ptr_set_adapter<U,Set,CA,b>& r )
417 : base_type( r )
418 { }
419
11fdf7f2 420#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
421 template< class PtrContainer >
422 explicit ptr_set_adapter( std::auto_ptr<PtrContainer> clone )
423 : base_type( clone )
424 { }
11fdf7f2
TL
425#endif
426#ifndef BOOST_NO_CXX11_SMART_PTR
427 template< class PtrContainer >
428 explicit ptr_set_adapter( std::unique_ptr<PtrContainer> clone )
429 : base_type( std::move( clone ) )
430 { }
431#endif
7c673cae
FG
432
433 template< class U, class Set, class CA, bool b >
434 ptr_set_adapter& operator=( const ptr_set_adapter<U,Set,CA,b>& r )
435 {
436 base_type::operator=( r );
437 return *this;
438 }
439
11fdf7f2 440#ifndef BOOST_NO_AUTO_PTR
7c673cae 441 template< class T >
11fdf7f2 442 void operator=( std::auto_ptr<T> r )
7c673cae
FG
443 {
444 base_type::operator=( r );
445 }
11fdf7f2
TL
446#endif
447#ifndef BOOST_NO_CXX11_SMART_PTR
448 template< class T >
449 void operator=( std::unique_ptr<T> r )
450 {
451 base_type::operator=( std::move( r ) );
452 }
453#endif
7c673cae
FG
454
455 std::pair<iterator,bool> insert( key_type* x ) // strong
456 {
457 this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
458
b32b8144 459 auto_type ptr( x, *this );
7c673cae
FG
460 std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
461 res = this->base().insert( x );
462 if( res.second )
463 ptr.release();
464 return std::make_pair( iterator( res.first ), res.second );
465 }
466
11fdf7f2 467#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
468 template< class U >
469 std::pair<iterator,bool> insert( std::auto_ptr<U> x )
470 {
471 return insert( x.release() );
472 }
11fdf7f2
TL
473#endif
474#ifndef BOOST_NO_CXX11_SMART_PTR
475 template< class U >
476 std::pair<iterator,bool> insert( std::unique_ptr<U> x )
477 {
478 return insert( x.release() );
479 }
480#endif
7c673cae
FG
481
482
483 iterator insert( iterator where, key_type* x ) // strong
484 {
485 this->enforce_null_policy( x, "Null pointer in 'ptr_set::insert()'" );
486
b32b8144 487 auto_type ptr( x, *this );
7c673cae
FG
488 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
489 res = this->base().insert( where.base(), x );
490 if( *res == x )
491 ptr.release();
492 return iterator( res);
493 }
494
11fdf7f2 495#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
496 template< class U >
497 iterator insert( iterator where, std::auto_ptr<U> x )
498 {
499 return insert( where, x.release() );
500 }
11fdf7f2
TL
501#endif
502#ifndef BOOST_NO_CXX11_SMART_PTR
503 template< class U >
504 iterator insert( iterator where, std::unique_ptr<U> x )
505 {
506 return insert( where, x.release() );
507 }
508#endif
7c673cae
FG
509
510 template< typename InputIterator >
511 void insert( InputIterator first, InputIterator last ) // basic
512 {
513 set_basic_clone_and_insert( first, last );
514 }
515
516#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
517#else
518
519 template< class Range >
520 BOOST_DEDUCED_TYPENAME
521 boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
522 insert( const Range& r )
523 {
524 insert( boost::begin(r), boost::end(r) );
525 }
526
527#endif
528
529 template< class PtrSetAdapter >
530 bool transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
531 PtrSetAdapter& from ) // strong
532 {
533 return this->single_transfer( object, from );
534 }
535
536 template< class PtrSetAdapter >
537 size_type
538 transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
539 BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
540 PtrSetAdapter& from ) // basic
541 {
542 return this->single_transfer( first, last, from );
543 }
544
545#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
546#else
547
548 template< class PtrSetAdapter, class Range >
549 BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
550 BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator >,
551 size_type >::type
552 transfer( const Range& r, PtrSetAdapter& from ) // basic
553 {
554 return transfer( boost::begin(r), boost::end(r), from );
555 }
556
557#endif
558
559 template< class PtrSetAdapter >
560 size_type transfer( PtrSetAdapter& from ) // basic
561 {
562 return transfer( from.begin(), from.end(), from );
563 }
564
565 };
566
567 /////////////////////////////////////////////////////////////////////////
568 // ptr_multiset_adapter
569 /////////////////////////////////////////////////////////////////////////
570
571 template
572 <
573 class Key,
574 class VoidPtrMultiSet,
575 class CloneAllocator = heap_clone_allocator,
576 bool Ordered = true
577 >
578 class ptr_multiset_adapter :
579 public ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered>
580 {
581 typedef ptr_container_detail::ptr_set_adapter_base<Key,VoidPtrMultiSet,CloneAllocator,Ordered> base_type;
582
583 public: // typedefs
584
585 typedef BOOST_DEDUCED_TYPENAME base_type::iterator
586 iterator;
587 typedef BOOST_DEDUCED_TYPENAME base_type::size_type
588 size_type;
589 typedef Key key_type;
590 typedef BOOST_DEDUCED_TYPENAME base_type::auto_type
591 auto_type;
592 typedef BOOST_DEDUCED_TYPENAME VoidPtrMultiSet::allocator_type
593 allocator_type;
594 private:
595 template< typename II >
596 void set_basic_clone_and_insert( II first, II last ) // basic
597 {
598 while( first != last )
599 {
b32b8144 600 insert( this->null_policy_allocate_clone_from_iterator( first ) ); // strong, commit
7c673cae
FG
601 ++first;
602 }
603 }
604
605 public:
606 ptr_multiset_adapter()
607 { }
608
609 template< class SizeType >
610 ptr_multiset_adapter( SizeType n,
611 ptr_container_detail::unordered_associative_container_tag tag )
612 : base_type( n, tag )
613 { }
614
615 template< class Comp >
616 explicit ptr_multiset_adapter( const Comp& comp,
617 const allocator_type& a )
618 : base_type( comp, a )
619 { }
620
621 template< class Hash, class Pred, class Allocator >
622 ptr_multiset_adapter( const Hash& hash,
623 const Pred& pred,
624 const Allocator& a )
625 : base_type( hash, pred, a )
626 { }
627
628 template< class InputIterator >
629 ptr_multiset_adapter( InputIterator first, InputIterator last )
630 : base_type( first, last )
631 { }
632
633 template< class InputIterator, class Comp >
634 ptr_multiset_adapter( InputIterator first, InputIterator last,
635 const Comp& comp,
636 const allocator_type& a = allocator_type() )
637 : base_type( comp, a )
638 {
639 set_basic_clone_and_insert( first, last );
640 }
641
642 template< class InputIterator, class Hash, class Pred, class Allocator >
643 ptr_multiset_adapter( InputIterator first, InputIterator last,
644 const Hash& hash,
645 const Pred& pred,
646 const Allocator& a )
647 : base_type( first, last, hash, pred, a )
648 { }
649
650 template< class U, class Set, class CA, bool b >
651 explicit ptr_multiset_adapter( const ptr_multiset_adapter<U,Set,CA,b>& r )
652 : base_type( r )
653 { }
654
11fdf7f2 655#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
656 template< class PtrContainer >
657 explicit ptr_multiset_adapter( std::auto_ptr<PtrContainer> clone )
658 : base_type( clone )
659 { }
11fdf7f2
TL
660#endif
661#ifndef BOOST_NO_CXX11_SMART_PTR
662 template< class PtrContainer >
663 explicit ptr_multiset_adapter( std::unique_ptr<PtrContainer> clone )
664 : base_type( std::move( clone ) )
665 { }
666#endif
7c673cae
FG
667
668 template< class U, class Set, class CA, bool b >
669 ptr_multiset_adapter& operator=( const ptr_multiset_adapter<U,Set,CA,b>& r )
670 {
671 base_type::operator=( r );
672 return *this;
673 }
674
11fdf7f2 675#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
676 template< class T >
677 void operator=( std::auto_ptr<T> r )
678 {
679 base_type::operator=( r );
680 }
11fdf7f2
TL
681#endif
682#ifndef BOOST_NO_CXX11_SMART_PTR
683 template< class T >
684 void operator=( std::unique_ptr<T> r )
685 {
686 base_type::operator=( std::move( r ) );
687 }
688#endif
7c673cae
FG
689
690 iterator insert( iterator before, key_type* x ) // strong
691 {
692 return base_type::insert( before, x );
693 }
694
11fdf7f2 695#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
696 template< class U >
697 iterator insert( iterator before, std::auto_ptr<U> x )
698 {
699 return insert( before, x.release() );
700 }
11fdf7f2
TL
701#endif
702#ifndef BOOST_NO_CXX11_SMART_PTR
703 template< class U >
704 iterator insert( iterator before, std::unique_ptr<U> x )
705 {
706 return insert( before, x.release() );
707 }
708#endif
7c673cae
FG
709
710 iterator insert( key_type* x ) // strong
711 {
712 this->enforce_null_policy( x, "Null pointer in 'ptr_multiset::insert()'" );
713
b32b8144 714 auto_type ptr( x, *this );
7c673cae
FG
715 BOOST_DEDUCED_TYPENAME base_type::ptr_iterator
716 res = this->base().insert( x );
717 ptr.release();
718 return iterator( res );
719 }
720
11fdf7f2 721#ifndef BOOST_NO_AUTO_PTR
7c673cae
FG
722 template< class U >
723 iterator insert( std::auto_ptr<U> x )
724 {
725 return insert( x.release() );
726 }
11fdf7f2
TL
727#endif
728#ifndef BOOST_NO_CXX11_SMART_PTR
729 template< class U >
730 iterator insert( std::unique_ptr<U> x )
731 {
732 return insert( x.release() );
733 }
734#endif
7c673cae
FG
735
736 template< typename InputIterator >
737 void insert( InputIterator first, InputIterator last ) // basic
738 {
739 set_basic_clone_and_insert( first, last );
740 }
741
742#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
743#else
744
745 template< class Range >
746 BOOST_DEDUCED_TYPENAME
747 boost::disable_if< ptr_container_detail::is_pointer_or_integral<Range> >::type
748 insert( const Range& r )
749 {
750 insert( boost::begin(r), boost::end(r) );
751 }
752
753#endif
754
755 template< class PtrSetAdapter >
756 void transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator object,
757 PtrSetAdapter& from ) // strong
758 {
759 this->multi_transfer( object, from );
760 }
761
762 template< class PtrSetAdapter >
763 size_type transfer( BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator first,
764 BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator last,
765 PtrSetAdapter& from ) // basic
766 {
767 return this->multi_transfer( first, last, from );
768 }
769
770#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
771#else
772
773 template< class PtrSetAdapter, class Range >
774 BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_same< Range,
775 BOOST_DEDUCED_TYPENAME PtrSetAdapter::iterator >, size_type >::type
776 transfer( const Range& r, PtrSetAdapter& from ) // basic
777 {
778 return transfer( boost::begin(r), boost::end(r), from );
779 }
780
781#endif
782
783 template< class PtrSetAdapter >
784 void transfer( PtrSetAdapter& from ) // basic
785 {
786 transfer( from.begin(), from.end(), from );
787 BOOST_ASSERT( from.empty() );
788 }
789
790 };
791
792} // namespace 'boost'
793
11fdf7f2
TL
794#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
795#pragma GCC diagnostic pop
796#endif
797
7c673cae 798#endif