source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/unordered/unordered_set.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 29.6 KB
Line 
1
2// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
3// Copyright (C) 2005-2009 Daniel James.
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7//  See http://www.boost.org/libs/unordered for documentation
8
9#ifndef BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED
10#define BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED
11
12#if defined(_MSC_VER) && (_MSC_VER >= 1020)
13# pragma once
14#endif
15
16#include <boost/unordered/unordered_set_fwd.hpp>
17#include <boost/functional/hash.hpp>
18#include <boost/unordered/detail/allocator_helpers.hpp>
19#include <boost/unordered/detail/equivalent.hpp>
20#include <boost/unordered/detail/unique.hpp>
21
22#if defined(BOOST_NO_RVALUE_REFERENCES)
23#include <boost/unordered/detail/move.hpp>
24#endif
25
26#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
27#include <initializer_list>
28#endif
29
30#if defined(BOOST_MSVC)
31#pragma warning(push)
32#if BOOST_MSVC >= 1400
33#pragma warning(disable:4396) //the inline specifier cannot be used when a
34                              // friend declaration refers to a specialization
35                              // of a function template
36#endif
37#endif
38
39namespace boost
40{
41    template <class T, class H, class P, class A>
42    class unordered_set
43    {
44    public:
45
46        typedef T key_type;
47        typedef T value_type;
48        typedef H hasher;
49        typedef P key_equal;
50        typedef A allocator_type;
51
52#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
53    private:
54#endif
55
56        typedef BOOST_DEDUCED_TYPENAME
57            boost::unordered_detail::rebind_wrap<
58                allocator_type, value_type>::type
59            value_allocator;
60
61        typedef boost::unordered_detail::set<H, P,
62            value_allocator> types;
63        typedef BOOST_DEDUCED_TYPENAME types::impl table;
64
65        typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base;
66
67    public:
68
69        typedef BOOST_DEDUCED_TYPENAME
70            value_allocator::pointer pointer;
71        typedef BOOST_DEDUCED_TYPENAME
72            value_allocator::const_pointer const_pointer;
73        typedef BOOST_DEDUCED_TYPENAME
74            value_allocator::reference reference;
75        typedef BOOST_DEDUCED_TYPENAME
76            value_allocator::const_reference const_reference;
77
78        typedef std::size_t size_type;
79        typedef std::ptrdiff_t difference_type;
80
81        typedef boost::unordered_detail::hash_const_local_iterator<
82            value_allocator, boost::unordered_detail::ungrouped>
83                const_local_iterator;
84        typedef boost::unordered_detail::hash_const_iterator<
85            value_allocator, boost::unordered_detail::ungrouped>
86                const_iterator;
87        typedef const_local_iterator local_iterator;
88        typedef const_iterator iterator;
89
90#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
91    private:
92#endif
93
94        table table_;
95       
96        BOOST_DEDUCED_TYPENAME types::iterator_base const&
97            get(const_iterator const& it)
98        {
99            return boost::unordered_detail::iterator_access::get(it);
100        }
101
102    public:
103
104        // construct/destroy/copy
105
106        explicit unordered_set(
107                size_type n = boost::unordered_detail::default_bucket_count,
108                const hasher &hf = hasher(),
109                const key_equal &eql = key_equal(),
110                const allocator_type &a = allocator_type())
111          : table_(n, hf, eql, a)
112        {
113        }
114
115        explicit unordered_set(allocator_type const& a)
116          : table_(boost::unordered_detail::default_bucket_count,
117                hasher(), key_equal(), a)
118        {
119        }
120
121        unordered_set(unordered_set const& other, allocator_type const& a)
122          : table_(other.table_, a)
123        {
124        }
125
126        template <class InputIt>
127        unordered_set(InputIt f, InputIt l)
128          : table_(boost::unordered_detail::initial_size(f, l),
129            hasher(), key_equal(), allocator_type())
130        {
131            table_.insert_range(f, l);
132        }
133
134        template <class InputIt>
135        unordered_set(InputIt f, InputIt l, size_type n,
136                const hasher &hf = hasher(),
137                const key_equal &eql = key_equal())
138          : table_(boost::unordered_detail::initial_size(f, l, n),
139            hf, eql, allocator_type())
140        {
141            table_.insert_range(f, l);
142        }
143       
144        template <class InputIt>
145        unordered_set(InputIt f, InputIt l, size_type n,
146                const hasher &hf,
147                const key_equal &eql,
148                const allocator_type &a)
149          : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a)
150        {
151            table_.insert_range(f, l);
152        }
153       
154        ~unordered_set() {}
155
156#if !defined(BOOST_NO_RVALUE_REFERENCES)
157        unordered_set(unordered_set&& other)
158          : table_(other.table_, boost::unordered_detail::move_tag())
159        {
160        }
161
162        unordered_set(unordered_set&& other, allocator_type const& a)
163          : table_(other.table_, a, boost::unordered_detail::move_tag())
164        {
165        }
166
167        unordered_set& operator=(unordered_set&& x)
168        {
169            table_.move(x.table_);
170            return *this;
171        }
172#else
173        unordered_set(boost::unordered_detail::move_from<
174                unordered_set<T, H, P, A>
175            > other)
176          : table_(other.source.table_, boost::unordered_detail::move_tag())
177        {
178        }
179
180#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593)
181        unordered_set& operator=(unordered_set x)
182        {
183            table_.move(x.table_);
184            return *this;
185        }
186#endif
187#endif
188
189#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
190        unordered_set(std::initializer_list<value_type> list,
191                size_type n = boost::unordered_detail::default_bucket_count,
192                const hasher &hf = hasher(),
193                const key_equal &eql = key_equal(),
194                const allocator_type &a = allocator_type())
195          : table_(boost::unordered_detail::initial_size(
196                    list.begin(), list.end(), n),
197                hf, eql, a)
198        {
199            table_.insert_range(list.begin(), list.end());
200        }
201
202        unordered_set& operator=(std::initializer_list<value_type> list)
203        {
204            table_.clear();
205            table_.insert_range(list.begin(), list.end());
206            return *this;
207        }
208#endif
209
210        allocator_type get_allocator() const
211        {
212            return table_.node_alloc();
213        }
214
215        // size and capacity
216
217        bool empty() const
218        {
219            return table_.size_ == 0;
220        }
221
222        size_type size() const
223        {
224            return table_.size_;
225        }
226
227        size_type max_size() const
228        {
229            return table_.max_size();
230        }
231
232        // iterators
233
234        iterator begin()
235        {
236            return iterator(table_.begin());
237        }
238
239        const_iterator begin() const
240        {
241            return const_iterator(table_.begin());
242        }
243
244        iterator end()
245        {
246            return iterator(table_.end());
247        }
248
249        const_iterator end() const
250        {
251            return const_iterator(table_.end());
252        }
253
254        const_iterator cbegin() const
255        {
256            return const_iterator(table_.begin());
257        }
258
259        const_iterator cend() const
260        {
261            return const_iterator(table_.end());
262        }
263
264        // modifiers
265
266#if defined(BOOST_UNORDERED_STD_FORWARD)
267        template <class... Args>
268        std::pair<iterator, bool> emplace(Args&&... args)
269        {
270            return boost::unordered_detail::pair_cast<iterator, bool>(
271                table_.emplace(std::forward<Args>(args)...));
272        }
273
274        template <class... Args>
275        iterator emplace_hint(const_iterator, Args&&... args)
276        {
277            return iterator(table_.emplace(std::forward<Args>(args)...).first);
278        }
279#else
280
281        std::pair<iterator, bool> emplace(value_type const& v = value_type())
282        {
283            return boost::unordered_detail::pair_cast<iterator, bool>(
284                table_.emplace(v));
285        }
286
287        iterator emplace_hint(const_iterator,
288            value_type const& v = value_type())
289        {
290            return iterator(table_.emplace(v).first);
291        }
292
293#define BOOST_UNORDERED_EMPLACE(z, n, _)                                       \
294            template <                                                         \
295                BOOST_UNORDERED_TEMPLATE_ARGS(z, n)                            \
296            >                                                                  \
297            std::pair<iterator, bool> emplace(                                 \
298                BOOST_UNORDERED_FUNCTION_PARAMS(z, n)                          \
299            )                                                                  \
300            {                                                                  \
301                return boost::unordered_detail::pair_cast<iterator, bool>(     \
302                    table_.emplace(                                            \
303                        BOOST_UNORDERED_CALL_PARAMS(z, n)                      \
304                    ));                                                        \
305            }                                                                  \
306                                                                               \
307            template <                                                         \
308                BOOST_UNORDERED_TEMPLATE_ARGS(z, n)                            \
309            >                                                                  \
310            iterator emplace_hint(const_iterator,                              \
311                BOOST_UNORDERED_FUNCTION_PARAMS(z, n)                          \
312            )                                                                  \
313            {                                                                  \
314                return iterator(table_.emplace(                                \
315                    BOOST_UNORDERED_CALL_PARAMS(z, n)).first);                 \
316            }
317
318        BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
319            BOOST_UNORDERED_EMPLACE, _)
320
321#undef BOOST_UNORDERED_EMPLACE
322
323#endif
324
325        std::pair<iterator, bool> insert(const value_type& obj)
326        {
327            return boost::unordered_detail::pair_cast<iterator, bool>(
328                    table_.emplace(obj));
329        }
330
331        iterator insert(const_iterator, const value_type& obj)
332        {
333            return iterator(table_.emplace(obj).first);
334        }
335
336        template <class InputIt>
337            void insert(InputIt first, InputIt last)
338        {
339            table_.insert_range(first, last);
340        }
341
342#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
343        void insert(std::initializer_list<value_type> list)
344        {
345            table_.insert_range(list.begin(), list.end());
346        }
347#endif
348
349        iterator erase(const_iterator position)
350        {
351            return iterator(table_.erase_return_iterator(get(position)));
352        }
353
354        size_type erase(const key_type& k)
355        {
356            return table_.erase_key(k);
357        }
358
359        iterator erase(const_iterator first, const_iterator last)
360        {
361            return iterator(table_.erase_range(get(first), get(last)));
362        }
363
364        void quick_erase(const_iterator position)
365        {
366            table_.erase(get(position));
367        }
368
369        void erase_return_void(const_iterator position)
370        {
371            table_.erase(get(position));
372        }
373
374        void clear()
375        {
376            table_.clear();
377        }
378
379        void swap(unordered_set& other)
380        {
381            table_.swap(other.table_);
382        }
383
384        // observers
385
386        hasher hash_function() const
387        {
388            return table_.hash_function();
389        }
390
391        key_equal key_eq() const
392        {
393            return table_.key_eq();
394        }
395
396        // lookup
397
398        const_iterator find(const key_type& k) const
399        {
400            return const_iterator(table_.find(k));
401        }
402
403        template <class CompatibleKey, class CompatibleHash,
404            class CompatiblePredicate>
405        const_iterator find(
406            CompatibleKey const& k,
407            CompatibleHash const& hash,
408            CompatiblePredicate const& eq) const
409        {
410            return iterator(table_.find(k, hash, eq));
411        }
412        size_type count(const key_type& k) const
413        {
414            return table_.count(k);
415        }
416
417        std::pair<const_iterator, const_iterator>
418            equal_range(const key_type& k) const
419        {
420            return boost::unordered_detail::pair_cast<
421                const_iterator, const_iterator>(
422                    table_.equal_range(k));
423        }
424
425        // bucket interface
426
427        size_type bucket_count() const
428        {
429            return table_.bucket_count_;
430        }
431
432        size_type max_bucket_count() const
433        {
434            return table_.max_bucket_count();
435        }
436
437        size_type bucket_size(size_type n) const
438        {
439            return table_.bucket_size(n);
440        }
441
442        size_type bucket(const key_type& k) const
443        {
444            return table_.bucket_index(k);
445        }
446
447        local_iterator begin(size_type n)
448        {
449            return local_iterator(table_.bucket_begin(n));
450        }
451
452        const_local_iterator begin(size_type n) const
453        {
454            return const_local_iterator(table_.bucket_begin(n));
455        }
456
457        local_iterator end(size_type)
458        {
459            return local_iterator();
460        }
461
462        const_local_iterator end(size_type) const
463        {
464            return const_local_iterator();
465        }
466
467        const_local_iterator cbegin(size_type n) const
468        {
469            return const_local_iterator(table_.bucket_begin(n));
470        }
471
472        const_local_iterator cend(size_type) const
473        {
474            return const_local_iterator();
475        }
476
477        // hash policy
478
479        float load_factor() const
480        {
481            return table_.load_factor();
482        }
483
484        float max_load_factor() const
485        {
486            return table_.mlf_;
487        }
488
489        void max_load_factor(float m)
490        {
491            table_.max_load_factor(m);
492        }
493
494        void rehash(size_type n)
495        {
496            table_.rehash(n);
497        }
498
499#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
500        friend bool operator==<T, H, P, A>(
501            unordered_set const&, unordered_set const&);
502        friend bool operator!=<T, H, P, A>(
503            unordered_set const&, unordered_set const&);
504#endif
505    }; // class template unordered_set
506
507    template <class T, class H, class P, class A>
508    inline bool operator==(unordered_set<T, H, P, A> const& m1,
509        unordered_set<T, H, P, A> const& m2)
510    {
511#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
512        struct dummy { unordered_set<T,H,P,A> x; };
513#endif
514        return m1.table_.equals(m2.table_);
515    }
516
517    template <class T, class H, class P, class A>
518    inline bool operator!=(unordered_set<T, H, P, A> const& m1,
519        unordered_set<T, H, P, A> const& m2)
520    {
521#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
522        struct dummy { unordered_set<T,H,P,A> x; };
523#endif
524        return !m1.table_.equals(m2.table_);
525    }
526
527    template <class T, class H, class P, class A>
528    inline void swap(unordered_set<T, H, P, A> &m1,
529            unordered_set<T, H, P, A> &m2)
530    {
531#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
532        struct dummy { unordered_set<T,H,P,A> x; };
533#endif
534        m1.swap(m2);
535    }
536
537    template <class T, class H, class P, class A>
538    class unordered_multiset
539    {
540    public:
541
542        typedef T key_type;
543        typedef T value_type;
544        typedef H hasher;
545        typedef P key_equal;
546        typedef A allocator_type;
547
548#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
549    private:
550#endif
551
552        typedef BOOST_DEDUCED_TYPENAME
553            boost::unordered_detail::rebind_wrap<
554                allocator_type, value_type>::type
555            value_allocator;
556
557        typedef boost::unordered_detail::multiset<H, P,
558            value_allocator> types;
559        typedef BOOST_DEDUCED_TYPENAME types::impl table;
560
561        typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base;
562
563    public:
564
565        typedef BOOST_DEDUCED_TYPENAME
566            value_allocator::pointer pointer;
567        typedef BOOST_DEDUCED_TYPENAME
568            value_allocator::const_pointer const_pointer;
569        typedef BOOST_DEDUCED_TYPENAME
570            value_allocator::reference reference;
571        typedef BOOST_DEDUCED_TYPENAME
572            value_allocator::const_reference const_reference;
573
574        typedef std::size_t size_type;
575        typedef std::ptrdiff_t difference_type;
576
577        typedef boost::unordered_detail::hash_const_local_iterator<
578            value_allocator, boost::unordered_detail::grouped>
579                const_local_iterator;
580        typedef boost::unordered_detail::hash_const_iterator<
581            value_allocator, boost::unordered_detail::grouped>
582                const_iterator;
583        typedef const_local_iterator local_iterator;
584        typedef const_iterator iterator;
585
586#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
587    private:
588#endif
589
590        table table_;
591       
592        BOOST_DEDUCED_TYPENAME types::iterator_base const&
593            get(const_iterator const& it)
594        {
595            return boost::unordered_detail::iterator_access::get(it);
596        }
597
598    public:
599
600        // construct/destroy/copy
601
602        explicit unordered_multiset(
603                size_type n = boost::unordered_detail::default_bucket_count,
604                const hasher &hf = hasher(),
605                const key_equal &eql = key_equal(),
606                const allocator_type &a = allocator_type())
607          : table_(n, hf, eql, a)
608        {
609        }
610
611        explicit unordered_multiset(allocator_type const& a)
612          : table_(boost::unordered_detail::default_bucket_count,
613                hasher(), key_equal(), a)
614        {
615        }
616
617        unordered_multiset(unordered_multiset const& other,
618            allocator_type const& a)
619          : table_(other.table_, a)
620        {
621        }
622
623        template <class InputIt>
624        unordered_multiset(InputIt f, InputIt l)
625          : table_(boost::unordered_detail::initial_size(f, l),
626                hasher(), key_equal(), allocator_type())
627        {
628            table_.insert_range(f, l);
629        }
630
631        template <class InputIt>
632        unordered_multiset(InputIt f, InputIt l, size_type n,
633                const hasher &hf = hasher(),
634                const key_equal &eql = key_equal())
635          : table_(boost::unordered_detail::initial_size(f, l, n),
636                hf, eql, allocator_type())
637        {
638            table_.insert_range(f, l);
639        }
640
641        template <class InputIt>
642        unordered_multiset(InputIt f, InputIt l, size_type n,
643                const hasher &hf,
644                const key_equal &eql,
645                const allocator_type &a)
646          : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a)
647        {
648            table_.insert_range(f, l);
649        }
650
651        ~unordered_multiset() {}
652
653#if !defined(BOOST_NO_RVALUE_REFERENCES)
654        unordered_multiset(unordered_multiset&& other)
655          : table_(other.table_, boost::unordered_detail::move_tag())
656        {
657        }
658
659        unordered_multiset(unordered_multiset&& other, allocator_type const& a)
660          : table_(other.table_, a, boost::unordered_detail::move_tag())
661        {
662        }
663
664        unordered_multiset& operator=(unordered_multiset&& x)
665        {
666            table_.move(x.table_);
667            return *this;
668        }
669#else
670        unordered_multiset(boost::unordered_detail::move_from<
671                unordered_multiset<T, H, P, A>
672            > other)
673          : table_(other.source.table_, boost::unordered_detail::move_tag())
674        {
675        }
676
677#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593)
678        unordered_multiset& operator=(unordered_multiset x)
679        {
680            table_.move(x.table_);
681            return *this;
682        }
683#endif
684#endif
685
686#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
687        unordered_multiset(std::initializer_list<value_type> list,
688                size_type n = boost::unordered_detail::default_bucket_count,
689                const hasher &hf = hasher(),
690                const key_equal &eql = key_equal(),
691                const allocator_type &a = allocator_type())
692          : table_(boost::unordered_detail::initial_size(
693                    list.begin(), list.end(), n),
694                hf, eql, a)
695        {
696            table_.insert_range(list.begin(), list.end());
697        }
698
699        unordered_multiset& operator=(std::initializer_list<value_type> list)
700        {
701            table_.clear();
702            table_.insert_range(list.begin(), list.end());
703            return *this;
704        }
705#endif
706
707        allocator_type get_allocator() const
708        {
709            return table_.node_alloc();
710        }
711
712        // size and capacity
713
714        bool empty() const
715        {
716            return table_.size_ == 0;
717        }
718
719        size_type size() const
720        {
721            return table_.size_;
722        }
723
724        size_type max_size() const
725        {
726            return table_.max_size();
727        }
728
729        // iterators
730
731        iterator begin()
732        {
733            return iterator(table_.begin());
734        }
735
736        const_iterator begin() const
737        {
738            return const_iterator(table_.begin());
739        }
740
741        iterator end()
742        {
743            return iterator(table_.end());
744        }
745
746        const_iterator end() const
747        {
748            return const_iterator(table_.end());
749        }
750
751        const_iterator cbegin() const
752        {
753            return const_iterator(table_.begin());
754        }
755
756        const_iterator cend() const
757        {
758            return const_iterator(table_.end());
759        }
760
761        // modifiers
762
763#if defined(BOOST_UNORDERED_STD_FORWARD)
764        template <class... Args>
765        iterator emplace(Args&&... args)
766        {
767            return iterator(table_.emplace(std::forward<Args>(args)...));
768        }
769
770        template <class... Args>
771        iterator emplace_hint(const_iterator, Args&&... args)
772        {
773            return iterator(table_.emplace(std::forward<Args>(args)...));
774        }
775#else
776
777        iterator emplace(value_type const& v = value_type())
778        {
779            return iterator(table_.emplace(v));
780        }
781
782        iterator emplace_hint(const_iterator,
783            value_type const& v = value_type())
784        {
785            return iterator(table_.emplace(v));
786        }
787
788#define BOOST_UNORDERED_EMPLACE(z, n, _)                                       \
789            template <                                                         \
790                BOOST_UNORDERED_TEMPLATE_ARGS(z, n)                            \
791            >                                                                  \
792            iterator emplace(                                                  \
793                BOOST_UNORDERED_FUNCTION_PARAMS(z, n)                          \
794            )                                                                  \
795            {                                                                  \
796                return iterator(                                               \
797                    table_.emplace(BOOST_UNORDERED_CALL_PARAMS(z, n)));        \
798            }                                                                  \
799                                                                               \
800            template <                                                         \
801                BOOST_UNORDERED_TEMPLATE_ARGS(z, n)                            \
802            >                                                                  \
803            iterator emplace_hint(const_iterator,                              \
804                BOOST_UNORDERED_FUNCTION_PARAMS(z, n)                          \
805            )                                                                  \
806            {                                                                  \
807                return iterator(table_.emplace(                                \
808                        BOOST_UNORDERED_CALL_PARAMS(z, n)                      \
809                ));                                                            \
810            }
811
812        BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
813            BOOST_UNORDERED_EMPLACE, _)
814
815#undef BOOST_UNORDERED_EMPLACE
816
817#endif
818
819        iterator insert(const value_type& obj)
820        {
821            return iterator(table_.emplace(obj));
822        }
823
824        iterator insert(const_iterator, const value_type& obj)
825        {
826            return iterator(table_.emplace(obj));
827        }
828
829        template <class InputIt>
830            void insert(InputIt first, InputIt last)
831        {
832            table_.insert_range(first, last);
833        }
834
835#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
836        void insert(std::initializer_list<value_type> list)
837        {
838            table_.insert_range(list.begin(), list.end());
839        }
840#endif
841
842        iterator erase(const_iterator position)
843        {
844            return iterator(table_.erase_return_iterator(get(position)));
845        }
846
847        size_type erase(const key_type& k)
848        {
849            return table_.erase_key(k);
850        }
851
852        iterator erase(const_iterator first, const_iterator last)
853        {
854            return iterator(table_.erase_range(get(first), get(last)));
855        }
856
857        void quick_erase(const_iterator position)
858        {
859            table_.erase(get(position));
860        }
861
862        void erase_return_void(const_iterator position)
863        {
864            table_.erase(get(position));
865        }
866
867        void clear()
868        {
869            table_.clear();
870        }
871
872        void swap(unordered_multiset& other)
873        {
874            table_.swap(other.table_);
875        }
876
877        // observers
878
879        hasher hash_function() const
880        {
881            return table_.hash_function();
882        }
883
884        key_equal key_eq() const
885        {
886            return table_.key_eq();
887        }
888
889        // lookup
890
891        const_iterator find(const key_type& k) const
892        {
893            return const_iterator(table_.find(k));
894        }
895
896        template <class CompatibleKey, class CompatibleHash,
897            class CompatiblePredicate>
898        const_iterator find(
899            CompatibleKey const& k,
900            CompatibleHash const& hash,
901            CompatiblePredicate const& eq) const
902        {
903            return iterator(table_.find(k, hash, eq));
904        }
905
906        size_type count(const key_type& k) const
907        {
908            return table_.count(k);
909        }
910
911        std::pair<const_iterator, const_iterator>
912            equal_range(const key_type& k) const
913        {
914            return boost::unordered_detail::pair_cast<
915                const_iterator, const_iterator>(
916                    table_.equal_range(k));
917        }
918
919        // bucket interface
920
921        size_type bucket_count() const
922        {
923            return table_.bucket_count_;
924        }
925
926        size_type max_bucket_count() const
927        {
928            return table_.max_bucket_count();
929        }
930
931        size_type bucket_size(size_type n) const
932        {
933            return table_.bucket_size(n);
934        }
935
936        size_type bucket(const key_type& k) const
937        {
938            return table_.bucket_index(k);
939        }
940
941        local_iterator begin(size_type n)
942        {
943            return local_iterator(table_.bucket_begin(n));
944        }
945
946        const_local_iterator begin(size_type n) const
947        {
948            return const_local_iterator(table_.bucket_begin(n));
949        }
950
951        local_iterator end(size_type)
952        {
953            return local_iterator();
954        }
955
956        const_local_iterator end(size_type) const
957        {
958            return const_local_iterator();
959        }
960
961        const_local_iterator cbegin(size_type n) const
962        {
963            return const_local_iterator(table_.bucket_begin(n));
964        }
965
966        const_local_iterator cend(size_type) const
967        {
968            return const_local_iterator();
969        }
970
971        // hash policy
972
973        float load_factor() const
974        {
975            return table_.load_factor();
976        }
977
978        float max_load_factor() const
979        {
980            return table_.mlf_;
981        }
982
983        void max_load_factor(float m)
984        {
985            table_.max_load_factor(m);
986        }
987
988        void rehash(size_type n)
989        {
990            table_.rehash(n);
991        }
992
993#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
994        friend bool operator==<T, H, P, A>(
995            unordered_multiset const&, unordered_multiset const&);
996        friend bool operator!=<T, H, P, A>(
997            unordered_multiset const&, unordered_multiset const&);
998#endif
999    }; // class template unordered_multiset
1000
1001    template <class T, class H, class P, class A>
1002    inline bool operator==(unordered_multiset<T, H, P, A> const& m1,
1003        unordered_multiset<T, H, P, A> const& m2)
1004    {
1005#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
1006        struct dummy { unordered_multiset<T,H,P,A> x; };
1007#endif
1008        return m1.table_.equals(m2.table_);
1009    }
1010
1011    template <class T, class H, class P, class A>
1012    inline bool operator!=(unordered_multiset<T, H, P, A> const& m1,
1013        unordered_multiset<T, H, P, A> const& m2)
1014    {
1015#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
1016        struct dummy { unordered_multiset<T,H,P,A> x; };
1017#endif
1018        return !m1.table_.equals(m2.table_);
1019    }
1020
1021    template <class T, class H, class P, class A>
1022    inline void swap(unordered_multiset<T, H, P, A> &m1,
1023            unordered_multiset<T, H, P, A> &m2)
1024    {
1025#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
1026        struct dummy { unordered_multiset<T,H,P,A> x; };
1027#endif
1028        m1.swap(m2);
1029    }
1030
1031} // namespace boost
1032
1033#if defined(BOOST_MSVC)
1034#pragma warning(pop)
1035#endif
1036
1037#endif // BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.