xref: /freebsd/contrib/llvm-project/libcxx/include/__cxx03/unordered_set (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP___CXX03_UNORDERED_SET
11*700637cbSDimitry Andric#define _LIBCPP___CXX03_UNORDERED_SET
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric// clang-format off
14*700637cbSDimitry Andric
15*700637cbSDimitry Andric/*
16*700637cbSDimitry Andric
17*700637cbSDimitry Andric    unordered_set synopsis
18*700637cbSDimitry Andric
19*700637cbSDimitry Andric#include <__cxx03/initializer_list>
20*700637cbSDimitry Andric
21*700637cbSDimitry Andricnamespace std
22*700637cbSDimitry Andric{
23*700637cbSDimitry Andric
24*700637cbSDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
25*700637cbSDimitry Andric          class Alloc = allocator<Value>>
26*700637cbSDimitry Andricclass unordered_set
27*700637cbSDimitry Andric{
28*700637cbSDimitry Andricpublic:
29*700637cbSDimitry Andric    // types
30*700637cbSDimitry Andric    typedef Value                                                      key_type;
31*700637cbSDimitry Andric    typedef key_type                                                   value_type;
32*700637cbSDimitry Andric    typedef Hash                                                       hasher;
33*700637cbSDimitry Andric    typedef Pred                                                       key_equal;
34*700637cbSDimitry Andric    typedef Alloc                                                      allocator_type;
35*700637cbSDimitry Andric    typedef value_type&                                                reference;
36*700637cbSDimitry Andric    typedef const value_type&                                          const_reference;
37*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::pointer         pointer;
38*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
39*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::size_type       size_type;
40*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
41*700637cbSDimitry Andric
42*700637cbSDimitry Andric    typedef /unspecified/ iterator;
43*700637cbSDimitry Andric    typedef /unspecified/ const_iterator;
44*700637cbSDimitry Andric    typedef /unspecified/ local_iterator;
45*700637cbSDimitry Andric    typedef /unspecified/ const_local_iterator;
46*700637cbSDimitry Andric
47*700637cbSDimitry Andric    typedef unspecified node_type unspecified;                            // C++17
48*700637cbSDimitry Andric    typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type;   // C++17
49*700637cbSDimitry Andric
50*700637cbSDimitry Andric    unordered_set()
51*700637cbSDimitry Andric        noexcept(
52*700637cbSDimitry Andric            is_nothrow_default_constructible<hasher>::value &&
53*700637cbSDimitry Andric            is_nothrow_default_constructible<key_equal>::value &&
54*700637cbSDimitry Andric            is_nothrow_default_constructible<allocator_type>::value);
55*700637cbSDimitry Andric    explicit unordered_set(size_type n, const hasher& hf = hasher(),
56*700637cbSDimitry Andric                           const key_equal& eql = key_equal(),
57*700637cbSDimitry Andric                           const allocator_type& a = allocator_type());
58*700637cbSDimitry Andric    template <class InputIterator>
59*700637cbSDimitry Andric        unordered_set(InputIterator f, InputIterator l,
60*700637cbSDimitry Andric                      size_type n = 0, const hasher& hf = hasher(),
61*700637cbSDimitry Andric                      const key_equal& eql = key_equal(),
62*700637cbSDimitry Andric                      const allocator_type& a = allocator_type());
63*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
64*700637cbSDimitry Andric      unordered_set(from_range_t, R&& rg, size_type n = see below,
65*700637cbSDimitry Andric        const hasher& hf = hasher(), const key_equal& eql = key_equal(),
66*700637cbSDimitry Andric        const allocator_type& a = allocator_type()); // C++23
67*700637cbSDimitry Andric    explicit unordered_set(const allocator_type&);
68*700637cbSDimitry Andric    unordered_set(const unordered_set&);
69*700637cbSDimitry Andric    unordered_set(const unordered_set&, const Allocator&);
70*700637cbSDimitry Andric    unordered_set(unordered_set&&)
71*700637cbSDimitry Andric        noexcept(
72*700637cbSDimitry Andric            is_nothrow_move_constructible<hasher>::value &&
73*700637cbSDimitry Andric            is_nothrow_move_constructible<key_equal>::value &&
74*700637cbSDimitry Andric            is_nothrow_move_constructible<allocator_type>::value);
75*700637cbSDimitry Andric    unordered_set(unordered_set&&, const Allocator&);
76*700637cbSDimitry Andric    unordered_set(initializer_list<value_type>, size_type n = 0,
77*700637cbSDimitry Andric                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
78*700637cbSDimitry Andric                  const allocator_type& a = allocator_type());
79*700637cbSDimitry Andric    unordered_set(size_type n, const allocator_type& a); // C++14
80*700637cbSDimitry Andric    unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
81*700637cbSDimitry Andric    template <class InputIterator>
82*700637cbSDimitry Andric      unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
83*700637cbSDimitry Andric    template <class InputIterator>
84*700637cbSDimitry Andric      unordered_set(InputIterator f, InputIterator l, size_type n,
85*700637cbSDimitry Andric                    const hasher& hf,  const allocator_type& a); // C++14
86*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
87*700637cbSDimitry Andric      unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a)
88*700637cbSDimitry Andric        : unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
89*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
90*700637cbSDimitry Andric      unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
91*700637cbSDimitry Andric        : unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }       // C++23
92*700637cbSDimitry Andric    unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
93*700637cbSDimitry Andric    unordered_set(initializer_list<value_type> il, size_type n,
94*700637cbSDimitry Andric                  const hasher& hf,  const allocator_type& a); // C++14
95*700637cbSDimitry Andric    ~unordered_set();
96*700637cbSDimitry Andric    unordered_set& operator=(const unordered_set&);
97*700637cbSDimitry Andric    unordered_set& operator=(unordered_set&&)
98*700637cbSDimitry Andric        noexcept(
99*700637cbSDimitry Andric            allocator_type::propagate_on_container_move_assignment::value &&
100*700637cbSDimitry Andric            is_nothrow_move_assignable<allocator_type>::value &&
101*700637cbSDimitry Andric            is_nothrow_move_assignable<hasher>::value &&
102*700637cbSDimitry Andric            is_nothrow_move_assignable<key_equal>::value);
103*700637cbSDimitry Andric    unordered_set& operator=(initializer_list<value_type>);
104*700637cbSDimitry Andric
105*700637cbSDimitry Andric    allocator_type get_allocator() const noexcept;
106*700637cbSDimitry Andric
107*700637cbSDimitry Andric    bool      empty() const noexcept;
108*700637cbSDimitry Andric    size_type size() const noexcept;
109*700637cbSDimitry Andric    size_type max_size() const noexcept;
110*700637cbSDimitry Andric
111*700637cbSDimitry Andric    iterator       begin() noexcept;
112*700637cbSDimitry Andric    iterator       end() noexcept;
113*700637cbSDimitry Andric    const_iterator begin()  const noexcept;
114*700637cbSDimitry Andric    const_iterator end()    const noexcept;
115*700637cbSDimitry Andric    const_iterator cbegin() const noexcept;
116*700637cbSDimitry Andric    const_iterator cend()   const noexcept;
117*700637cbSDimitry Andric
118*700637cbSDimitry Andric    template <class... Args>
119*700637cbSDimitry Andric        pair<iterator, bool> emplace(Args&&... args);
120*700637cbSDimitry Andric    template <class... Args>
121*700637cbSDimitry Andric        iterator emplace_hint(const_iterator position, Args&&... args);
122*700637cbSDimitry Andric    pair<iterator, bool> insert(const value_type& obj);
123*700637cbSDimitry Andric    pair<iterator, bool> insert(value_type&& obj);
124*700637cbSDimitry Andric    iterator insert(const_iterator hint, const value_type& obj);
125*700637cbSDimitry Andric    iterator insert(const_iterator hint, value_type&& obj);
126*700637cbSDimitry Andric    template <class InputIterator>
127*700637cbSDimitry Andric        void insert(InputIterator first, InputIterator last);
128*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
129*700637cbSDimitry Andric      void insert_range(R&& rg);                                      // C++23
130*700637cbSDimitry Andric    void insert(initializer_list<value_type>);
131*700637cbSDimitry Andric
132*700637cbSDimitry Andric    node_type extract(const_iterator position);                       // C++17
133*700637cbSDimitry Andric    node_type extract(const key_type& x);                             // C++17
134*700637cbSDimitry Andric    insert_return_type insert(node_type&& nh);                        // C++17
135*700637cbSDimitry Andric    iterator           insert(const_iterator hint, node_type&& nh);   // C++17
136*700637cbSDimitry Andric
137*700637cbSDimitry Andric    iterator erase(const_iterator position);
138*700637cbSDimitry Andric    iterator erase(iterator position);  // C++14
139*700637cbSDimitry Andric    size_type erase(const key_type& k);
140*700637cbSDimitry Andric    iterator erase(const_iterator first, const_iterator last);
141*700637cbSDimitry Andric    void clear() noexcept;
142*700637cbSDimitry Andric
143*700637cbSDimitry Andric    template<class H2, class P2>
144*700637cbSDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>& source);         // C++17
145*700637cbSDimitry Andric    template<class H2, class P2>
146*700637cbSDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>&& source);        // C++17
147*700637cbSDimitry Andric    template<class H2, class P2>
148*700637cbSDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>& source);    // C++17
149*700637cbSDimitry Andric    template<class H2, class P2>
150*700637cbSDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>&& source);   // C++17
151*700637cbSDimitry Andric
152*700637cbSDimitry Andric    void swap(unordered_set&)
153*700637cbSDimitry Andric       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
154*700637cbSDimitry Andric                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
155*700637cbSDimitry Andric                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
156*700637cbSDimitry Andric
157*700637cbSDimitry Andric    hasher hash_function() const;
158*700637cbSDimitry Andric    key_equal key_eq() const;
159*700637cbSDimitry Andric
160*700637cbSDimitry Andric    iterator       find(const key_type& k);
161*700637cbSDimitry Andric    const_iterator find(const key_type& k) const;
162*700637cbSDimitry Andric    template<typename K>
163*700637cbSDimitry Andric        iterator find(const K& x);              // C++20
164*700637cbSDimitry Andric    template<typename K>
165*700637cbSDimitry Andric        const_iterator find(const K& x) const;  // C++20
166*700637cbSDimitry Andric    size_type count(const key_type& k) const;
167*700637cbSDimitry Andric    template<typename K>
168*700637cbSDimitry Andric        size_type count(const K& k) const; // C++20
169*700637cbSDimitry Andric    bool contains(const key_type& k) const; // C++20
170*700637cbSDimitry Andric    template<typename K>
171*700637cbSDimitry Andric        bool contains(const K& k) const; // C++20
172*700637cbSDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& k);
173*700637cbSDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
174*700637cbSDimitry Andric    template<typename K>
175*700637cbSDimitry Andric        pair<iterator, iterator>             equal_range(const K& k); // C++20
176*700637cbSDimitry Andric    template<typename K>
177*700637cbSDimitry Andric        pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
178*700637cbSDimitry Andric
179*700637cbSDimitry Andric    size_type bucket_count() const noexcept;
180*700637cbSDimitry Andric    size_type max_bucket_count() const noexcept;
181*700637cbSDimitry Andric
182*700637cbSDimitry Andric    size_type bucket_size(size_type n) const;
183*700637cbSDimitry Andric    size_type bucket(const key_type& k) const;
184*700637cbSDimitry Andric
185*700637cbSDimitry Andric    local_iterator       begin(size_type n);
186*700637cbSDimitry Andric    local_iterator       end(size_type n);
187*700637cbSDimitry Andric    const_local_iterator begin(size_type n) const;
188*700637cbSDimitry Andric    const_local_iterator end(size_type n) const;
189*700637cbSDimitry Andric    const_local_iterator cbegin(size_type n) const;
190*700637cbSDimitry Andric    const_local_iterator cend(size_type n) const;
191*700637cbSDimitry Andric
192*700637cbSDimitry Andric    float load_factor() const noexcept;
193*700637cbSDimitry Andric    float max_load_factor() const noexcept;
194*700637cbSDimitry Andric    void max_load_factor(float z);
195*700637cbSDimitry Andric    void rehash(size_type n);
196*700637cbSDimitry Andric    void reserve(size_type n);
197*700637cbSDimitry Andric};
198*700637cbSDimitry Andric
199*700637cbSDimitry Andrictemplate<class InputIterator,
200*700637cbSDimitry Andric    class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
201*700637cbSDimitry Andric    class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
202*700637cbSDimitry Andric    class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
203*700637cbSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
204*700637cbSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
205*700637cbSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type,
206*700637cbSDimitry Andric        Hash, Pred, Allocator>; // C++17
207*700637cbSDimitry Andric
208*700637cbSDimitry Andrictemplate<ranges::input_range R,
209*700637cbSDimitry Andric         class Hash = hash<ranges::range_value_t<R>>,
210*700637cbSDimitry Andric         class Pred = equal_to<ranges::range_value_t<R>>,
211*700637cbSDimitry Andric         class Allocator = allocator<ranges::range_value_t<R>>>
212*700637cbSDimitry Andric  unordered_set(from_range_t, R&&, typename see below::size_type = see below, Hash = Hash(), Pred = Pred(), Allocator = Allocator())
213*700637cbSDimitry Andric    -> unordered_set<ranges::range_value_t<R>, Hash, Pred, Allocator>; // C++23
214*700637cbSDimitry Andric
215*700637cbSDimitry Andrictemplate<class T, class Hash = hash<T>,
216*700637cbSDimitry Andric          class Pred = equal_to<T>, class Allocator = allocator<T>>
217*700637cbSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type = see below,
218*700637cbSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
219*700637cbSDimitry Andric  -> unordered_set<T, Hash, Pred, Allocator>; // C++17
220*700637cbSDimitry Andric
221*700637cbSDimitry Andrictemplate<class InputIterator,  class Allocator>
222*700637cbSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator)
223*700637cbSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type,
224*700637cbSDimitry Andric        hash<typename iterator_traits<InputIterator>::value_type>,
225*700637cbSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
226*700637cbSDimitry Andric        Allocator>; // C++17
227*700637cbSDimitry Andric
228*700637cbSDimitry Andrictemplate<class InputIterator, class Hash, class Allocator>
229*700637cbSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type,
230*700637cbSDimitry Andric    Hash, Allocator)
231*700637cbSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash,
232*700637cbSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
233*700637cbSDimitry Andric        Allocator>; // C++17
234*700637cbSDimitry Andric
235*700637cbSDimitry Andrictemplate<ranges::input_range R, class Allocator>
236*700637cbSDimitry Andric  unordered_set(from_range_t, R&&, typename see below::size_type, Allocator)
237*700637cbSDimitry Andric    -> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
238*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
239*700637cbSDimitry Andric
240*700637cbSDimitry Andrictemplate<ranges::input_range R, class Allocator>
241*700637cbSDimitry Andric  unordered_set(from_range_t, R&&, Allocator)
242*700637cbSDimitry Andric    -> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
243*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
244*700637cbSDimitry Andric
245*700637cbSDimitry Andrictemplate<ranges::input_range R, class Hash, class Allocator>
246*700637cbSDimitry Andric  unordered_set(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
247*700637cbSDimitry Andric    -> unordered_set<ranges::range_value_t<R>, Hash,
248*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
249*700637cbSDimitry Andric
250*700637cbSDimitry Andrictemplate<class T, class Allocator>
251*700637cbSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Allocator)
252*700637cbSDimitry Andric  -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17
253*700637cbSDimitry Andric
254*700637cbSDimitry Andrictemplate<class T, class Hash, class Allocator>
255*700637cbSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
256*700637cbSDimitry Andric  -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17
257*700637cbSDimitry Andric
258*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
259*700637cbSDimitry Andric    void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
260*700637cbSDimitry Andric              unordered_set<Value, Hash, Pred, Alloc>& y)
261*700637cbSDimitry Andric              noexcept(noexcept(x.swap(y)));
262*700637cbSDimitry Andric
263*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
264*700637cbSDimitry Andric    bool
265*700637cbSDimitry Andric    operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,
266*700637cbSDimitry Andric               const unordered_set<Value, Hash, Pred, Alloc>& y);
267*700637cbSDimitry Andric
268*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
269*700637cbSDimitry Andric    bool
270*700637cbSDimitry Andric    operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,
271*700637cbSDimitry Andric               const unordered_set<Value, Hash, Pred, Alloc>& y); // removed in C++20
272*700637cbSDimitry Andric
273*700637cbSDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
274*700637cbSDimitry Andric          class Alloc = allocator<Value>>
275*700637cbSDimitry Andricclass unordered_multiset
276*700637cbSDimitry Andric{
277*700637cbSDimitry Andricpublic:
278*700637cbSDimitry Andric    // types
279*700637cbSDimitry Andric    typedef Value                                                      key_type;
280*700637cbSDimitry Andric    typedef key_type                                                   value_type;
281*700637cbSDimitry Andric    typedef Hash                                                       hasher;
282*700637cbSDimitry Andric    typedef Pred                                                       key_equal;
283*700637cbSDimitry Andric    typedef Alloc                                                      allocator_type;
284*700637cbSDimitry Andric    typedef value_type&                                                reference;
285*700637cbSDimitry Andric    typedef const value_type&                                          const_reference;
286*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::pointer         pointer;
287*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
288*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::size_type       size_type;
289*700637cbSDimitry Andric    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
290*700637cbSDimitry Andric
291*700637cbSDimitry Andric    typedef /unspecified/ iterator;
292*700637cbSDimitry Andric    typedef /unspecified/ const_iterator;
293*700637cbSDimitry Andric    typedef /unspecified/ local_iterator;
294*700637cbSDimitry Andric    typedef /unspecified/ const_local_iterator;
295*700637cbSDimitry Andric
296*700637cbSDimitry Andric    typedef unspecified node_type unspecified;   // C++17
297*700637cbSDimitry Andric
298*700637cbSDimitry Andric    unordered_multiset()
299*700637cbSDimitry Andric        noexcept(
300*700637cbSDimitry Andric            is_nothrow_default_constructible<hasher>::value &&
301*700637cbSDimitry Andric            is_nothrow_default_constructible<key_equal>::value &&
302*700637cbSDimitry Andric            is_nothrow_default_constructible<allocator_type>::value);
303*700637cbSDimitry Andric    explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
304*700637cbSDimitry Andric                           const key_equal& eql = key_equal(),
305*700637cbSDimitry Andric                           const allocator_type& a = allocator_type());
306*700637cbSDimitry Andric    template <class InputIterator>
307*700637cbSDimitry Andric        unordered_multiset(InputIterator f, InputIterator l,
308*700637cbSDimitry Andric                      size_type n = 0, const hasher& hf = hasher(),
309*700637cbSDimitry Andric                      const key_equal& eql = key_equal(),
310*700637cbSDimitry Andric                      const allocator_type& a = allocator_type());
311*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
312*700637cbSDimitry Andric      unordered_multiset(from_range_t, R&& rg, size_type n = see below,
313*700637cbSDimitry Andric        const hasher& hf = hasher(), const key_equal& eql = key_equal(),
314*700637cbSDimitry Andric        const allocator_type& a = allocator_type()); // C++23
315*700637cbSDimitry Andric    explicit unordered_multiset(const allocator_type&);
316*700637cbSDimitry Andric    unordered_multiset(const unordered_multiset&);
317*700637cbSDimitry Andric    unordered_multiset(const unordered_multiset&, const Allocator&);
318*700637cbSDimitry Andric    unordered_multiset(unordered_multiset&&)
319*700637cbSDimitry Andric        noexcept(
320*700637cbSDimitry Andric            is_nothrow_move_constructible<hasher>::value &&
321*700637cbSDimitry Andric            is_nothrow_move_constructible<key_equal>::value &&
322*700637cbSDimitry Andric            is_nothrow_move_constructible<allocator_type>::value);
323*700637cbSDimitry Andric    unordered_multiset(unordered_multiset&&, const Allocator&);
324*700637cbSDimitry Andric    unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
325*700637cbSDimitry Andric                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
326*700637cbSDimitry Andric                  const allocator_type& a = allocator_type());
327*700637cbSDimitry Andric    unordered_multiset(size_type n, const allocator_type& a); // C++14
328*700637cbSDimitry Andric    unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
329*700637cbSDimitry Andric    template <class InputIterator>
330*700637cbSDimitry Andric      unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
331*700637cbSDimitry Andric    template <class InputIterator>
332*700637cbSDimitry Andric      unordered_multiset(InputIterator f, InputIterator l, size_type n,
333*700637cbSDimitry Andric                         const hasher& hf, const allocator_type& a); // C++14
334*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
335*700637cbSDimitry Andric      unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a)
336*700637cbSDimitry Andric        : unordered_multiset(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
337*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
338*700637cbSDimitry Andric      unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
339*700637cbSDimitry Andric        : unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }       // C++23
340*700637cbSDimitry Andric    unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
341*700637cbSDimitry Andric    unordered_multiset(initializer_list<value_type> il, size_type n,
342*700637cbSDimitry Andric                       const hasher& hf,  const allocator_type& a); // C++14
343*700637cbSDimitry Andric    ~unordered_multiset();
344*700637cbSDimitry Andric    unordered_multiset& operator=(const unordered_multiset&);
345*700637cbSDimitry Andric    unordered_multiset& operator=(unordered_multiset&&)
346*700637cbSDimitry Andric        noexcept(
347*700637cbSDimitry Andric            allocator_type::propagate_on_container_move_assignment::value &&
348*700637cbSDimitry Andric            is_nothrow_move_assignable<allocator_type>::value &&
349*700637cbSDimitry Andric            is_nothrow_move_assignable<hasher>::value &&
350*700637cbSDimitry Andric            is_nothrow_move_assignable<key_equal>::value);
351*700637cbSDimitry Andric    unordered_multiset& operator=(initializer_list<value_type>);
352*700637cbSDimitry Andric
353*700637cbSDimitry Andric    allocator_type get_allocator() const noexcept;
354*700637cbSDimitry Andric
355*700637cbSDimitry Andric    bool      empty() const noexcept;
356*700637cbSDimitry Andric    size_type size() const noexcept;
357*700637cbSDimitry Andric    size_type max_size() const noexcept;
358*700637cbSDimitry Andric
359*700637cbSDimitry Andric    iterator       begin() noexcept;
360*700637cbSDimitry Andric    iterator       end() noexcept;
361*700637cbSDimitry Andric    const_iterator begin()  const noexcept;
362*700637cbSDimitry Andric    const_iterator end()    const noexcept;
363*700637cbSDimitry Andric    const_iterator cbegin() const noexcept;
364*700637cbSDimitry Andric    const_iterator cend()   const noexcept;
365*700637cbSDimitry Andric
366*700637cbSDimitry Andric    template <class... Args>
367*700637cbSDimitry Andric        iterator emplace(Args&&... args);
368*700637cbSDimitry Andric    template <class... Args>
369*700637cbSDimitry Andric        iterator emplace_hint(const_iterator position, Args&&... args);
370*700637cbSDimitry Andric    iterator insert(const value_type& obj);
371*700637cbSDimitry Andric    iterator insert(value_type&& obj);
372*700637cbSDimitry Andric    iterator insert(const_iterator hint, const value_type& obj);
373*700637cbSDimitry Andric    iterator insert(const_iterator hint, value_type&& obj);
374*700637cbSDimitry Andric    template <class InputIterator>
375*700637cbSDimitry Andric        void insert(InputIterator first, InputIterator last);
376*700637cbSDimitry Andric    template<container-compatible-range<value_type> R>
377*700637cbSDimitry Andric      void insert_range(R&& rg);                            // C++23
378*700637cbSDimitry Andric    void insert(initializer_list<value_type>);
379*700637cbSDimitry Andric
380*700637cbSDimitry Andric    node_type extract(const_iterator position);             // C++17
381*700637cbSDimitry Andric    node_type extract(const key_type& x);                   // C++17
382*700637cbSDimitry Andric    iterator insert(node_type&& nh);                        // C++17
383*700637cbSDimitry Andric    iterator insert(const_iterator hint, node_type&& nh);   // C++17
384*700637cbSDimitry Andric
385*700637cbSDimitry Andric    iterator erase(const_iterator position);
386*700637cbSDimitry Andric    iterator erase(iterator position);  // C++14
387*700637cbSDimitry Andric    size_type erase(const key_type& k);
388*700637cbSDimitry Andric    iterator erase(const_iterator first, const_iterator last);
389*700637cbSDimitry Andric    void clear() noexcept;
390*700637cbSDimitry Andric
391*700637cbSDimitry Andric    template<class H2, class P2>
392*700637cbSDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>& source);    // C++17
393*700637cbSDimitry Andric    template<class H2, class P2>
394*700637cbSDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>&& source);   // C++17
395*700637cbSDimitry Andric    template<class H2, class P2>
396*700637cbSDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>& source);         // C++17
397*700637cbSDimitry Andric    template<class H2, class P2>
398*700637cbSDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>&& source);        // C++17
399*700637cbSDimitry Andric
400*700637cbSDimitry Andric    void swap(unordered_multiset&)
401*700637cbSDimitry Andric       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
402*700637cbSDimitry Andric                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
403*700637cbSDimitry Andric                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
404*700637cbSDimitry Andric
405*700637cbSDimitry Andric    hasher hash_function() const;
406*700637cbSDimitry Andric    key_equal key_eq() const;
407*700637cbSDimitry Andric
408*700637cbSDimitry Andric    iterator       find(const key_type& k);
409*700637cbSDimitry Andric    const_iterator find(const key_type& k) const;
410*700637cbSDimitry Andric    template<typename K>
411*700637cbSDimitry Andric        iterator find(const K& x);              // C++20
412*700637cbSDimitry Andric    template<typename K>
413*700637cbSDimitry Andric        const_iterator find(const K& x) const;  // C++20
414*700637cbSDimitry Andric    size_type count(const key_type& k) const;
415*700637cbSDimitry Andric    template<typename K>
416*700637cbSDimitry Andric        size_type count(const K& k) const; // C++20
417*700637cbSDimitry Andric    bool contains(const key_type& k) const; // C++20
418*700637cbSDimitry Andric    template<typename K>
419*700637cbSDimitry Andric        bool contains(const K& k) const; // C++20
420*700637cbSDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& k);
421*700637cbSDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
422*700637cbSDimitry Andric    template<typename K>
423*700637cbSDimitry Andric        pair<iterator, iterator>             equal_range(const K& k); // C++20
424*700637cbSDimitry Andric    template<typename K>
425*700637cbSDimitry Andric        pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
426*700637cbSDimitry Andric
427*700637cbSDimitry Andric    size_type bucket_count() const noexcept;
428*700637cbSDimitry Andric    size_type max_bucket_count() const noexcept;
429*700637cbSDimitry Andric
430*700637cbSDimitry Andric    size_type bucket_size(size_type n) const;
431*700637cbSDimitry Andric    size_type bucket(const key_type& k) const;
432*700637cbSDimitry Andric
433*700637cbSDimitry Andric    local_iterator       begin(size_type n);
434*700637cbSDimitry Andric    local_iterator       end(size_type n);
435*700637cbSDimitry Andric    const_local_iterator begin(size_type n) const;
436*700637cbSDimitry Andric    const_local_iterator end(size_type n) const;
437*700637cbSDimitry Andric    const_local_iterator cbegin(size_type n) const;
438*700637cbSDimitry Andric    const_local_iterator cend(size_type n) const;
439*700637cbSDimitry Andric
440*700637cbSDimitry Andric    float load_factor() const noexcept;
441*700637cbSDimitry Andric    float max_load_factor() const noexcept;
442*700637cbSDimitry Andric    void max_load_factor(float z);
443*700637cbSDimitry Andric    void rehash(size_type n);
444*700637cbSDimitry Andric    void reserve(size_type n);
445*700637cbSDimitry Andric};
446*700637cbSDimitry Andric
447*700637cbSDimitry Andrictemplate<class InputIterator,
448*700637cbSDimitry Andric    class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
449*700637cbSDimitry Andric    class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
450*700637cbSDimitry Andric    class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
451*700637cbSDimitry Andricunordered_multiset(InputIterator, InputIterator, see below::size_type = see below,
452*700637cbSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
453*700637cbSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
454*700637cbSDimitry Andric        Hash, Pred, Allocator>; // C++17
455*700637cbSDimitry Andric
456*700637cbSDimitry Andrictemplate<ranges::input_range R,
457*700637cbSDimitry Andric         class Hash = hash<ranges::range_value_t<R>>,
458*700637cbSDimitry Andric         class Pred = equal_to<ranges::range_value_t<R>>,
459*700637cbSDimitry Andric         class Allocator = allocator<ranges::range_value_t<R>>>
460*700637cbSDimitry Andric  unordered_multiset(from_range_t, R&&, typename see below::size_type = see below, Hash = Hash(), Pred = Pred(), Allocator = Allocator())
461*700637cbSDimitry Andric    -> unordered_multiset<ranges::range_value_t<R>, Hash, Pred, Allocator>; // C++23
462*700637cbSDimitry Andric
463*700637cbSDimitry Andrictemplate<class T, class Hash = hash<T>,
464*700637cbSDimitry Andric          class Pred = equal_to<T>, class Allocator = allocator<T>>
465*700637cbSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type = see below,
466*700637cbSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
467*700637cbSDimitry Andric  -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17
468*700637cbSDimitry Andric
469*700637cbSDimitry Andrictemplate<class InputIterator,  class Allocator>
470*700637cbSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator)
471*700637cbSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
472*700637cbSDimitry Andric        hash<typename iterator_traits<InputIterator>::value_type>,
473*700637cbSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
474*700637cbSDimitry Andric        Allocator>; // C++17
475*700637cbSDimitry Andric
476*700637cbSDimitry Andrictemplate<class InputIterator,  class Hash, class Allocator>
477*700637cbSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type,
478*700637cbSDimitry Andric    Hash, Allocator)
479*700637cbSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash,
480*700637cbSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17
481*700637cbSDimitry Andric
482*700637cbSDimitry Andrictemplate<ranges::input_range R, class Allocator>
483*700637cbSDimitry Andric  unordered_multiset(from_range_t, R&&, typename see below::size_type, Allocator)
484*700637cbSDimitry Andric    -> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
485*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
486*700637cbSDimitry Andric
487*700637cbSDimitry Andrictemplate<ranges::input_range R, class Allocator>
488*700637cbSDimitry Andric  unordered_multiset(from_range_t, R&&, Allocator)
489*700637cbSDimitry Andric    -> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
490*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
491*700637cbSDimitry Andric
492*700637cbSDimitry Andrictemplate<ranges::input_range R, class Hash, class Allocator>
493*700637cbSDimitry Andric  unordered_multiset(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
494*700637cbSDimitry Andric    -> unordered_multiset<ranges::range_value_t<R>, Hash,
495*700637cbSDimitry Andric                      equal_to<ranges::range_value_t<R>>, Allocator>; // C++23
496*700637cbSDimitry Andric
497*700637cbSDimitry Andrictemplate<class T, class Allocator>
498*700637cbSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
499*700637cbSDimitry Andric  -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17
500*700637cbSDimitry Andric
501*700637cbSDimitry Andrictemplate<class T, class Hash, class Allocator>
502*700637cbSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
503*700637cbSDimitry Andric  -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17
504*700637cbSDimitry Andric
505*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
506*700637cbSDimitry Andric    void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
507*700637cbSDimitry Andric              unordered_multiset<Value, Hash, Pred, Alloc>& y)
508*700637cbSDimitry Andric              noexcept(noexcept(x.swap(y)));
509*700637cbSDimitry Andric
510*700637cbSDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate>
511*700637cbSDimitry Andric    typename unordered_set<K, T, H, P, A>::size_type
512*700637cbSDimitry Andric    erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred);       // C++20
513*700637cbSDimitry Andric
514*700637cbSDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate>
515*700637cbSDimitry Andric    typename unordered_multiset<K, T, H, P, A>::size_type
516*700637cbSDimitry Andric    erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred);  // C++20
517*700637cbSDimitry Andric
518*700637cbSDimitry Andric
519*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
520*700637cbSDimitry Andric    bool
521*700637cbSDimitry Andric    operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
522*700637cbSDimitry Andric               const unordered_multiset<Value, Hash, Pred, Alloc>& y);
523*700637cbSDimitry Andric
524*700637cbSDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
525*700637cbSDimitry Andric    bool
526*700637cbSDimitry Andric    operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
527*700637cbSDimitry Andric               const unordered_multiset<Value, Hash, Pred, Alloc>& y); // removed in C++20
528*700637cbSDimitry Andric}  // std
529*700637cbSDimitry Andric
530*700637cbSDimitry Andric*/
531*700637cbSDimitry Andric
532*700637cbSDimitry Andric// clang-format on
533*700637cbSDimitry Andric
534*700637cbSDimitry Andric#include <__cxx03/__algorithm/is_permutation.h>
535*700637cbSDimitry Andric#include <__cxx03/__assert>
536*700637cbSDimitry Andric#include <__cxx03/__config>
537*700637cbSDimitry Andric#include <__cxx03/__functional/operations.h>
538*700637cbSDimitry Andric#include <__cxx03/__hash_table>
539*700637cbSDimitry Andric#include <__cxx03/__iterator/distance.h>
540*700637cbSDimitry Andric#include <__cxx03/__iterator/erase_if_container.h>
541*700637cbSDimitry Andric#include <__cxx03/__iterator/iterator_traits.h>
542*700637cbSDimitry Andric#include <__cxx03/__memory/addressof.h>
543*700637cbSDimitry Andric#include <__cxx03/__memory/allocator.h>
544*700637cbSDimitry Andric#include <__cxx03/__type_traits/is_allocator.h>
545*700637cbSDimitry Andric#include <__cxx03/__utility/forward.h>
546*700637cbSDimitry Andric#include <__cxx03/version>
547*700637cbSDimitry Andric
548*700637cbSDimitry Andric// standard-mandated includes
549*700637cbSDimitry Andric
550*700637cbSDimitry Andric// [iterator.range]
551*700637cbSDimitry Andric#include <__cxx03/__iterator/access.h>
552*700637cbSDimitry Andric
553*700637cbSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
554*700637cbSDimitry Andric#  pragma GCC system_header
555*700637cbSDimitry Andric#endif
556*700637cbSDimitry Andric
557*700637cbSDimitry Andric_LIBCPP_PUSH_MACROS
558*700637cbSDimitry Andric#include <__cxx03/__undef_macros>
559*700637cbSDimitry Andric
560*700637cbSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
561*700637cbSDimitry Andric
562*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
563*700637cbSDimitry Andricclass unordered_multiset;
564*700637cbSDimitry Andric
565*700637cbSDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
566*700637cbSDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_set {
567*700637cbSDimitry Andricpublic:
568*700637cbSDimitry Andric  // types
569*700637cbSDimitry Andric  typedef _Value key_type;
570*700637cbSDimitry Andric  typedef key_type value_type;
571*700637cbSDimitry Andric  typedef __type_identity_t<_Hash> hasher;
572*700637cbSDimitry Andric  typedef __type_identity_t<_Pred> key_equal;
573*700637cbSDimitry Andric  typedef __type_identity_t<_Alloc> allocator_type;
574*700637cbSDimitry Andric  typedef value_type& reference;
575*700637cbSDimitry Andric  typedef const value_type& const_reference;
576*700637cbSDimitry Andric  static_assert(__check_valid_allocator<allocator_type>::value, "");
577*700637cbSDimitry Andric  static_assert(is_same<value_type, typename allocator_type::value_type>::value,
578*700637cbSDimitry Andric                "Allocator::value_type must be same type as value_type");
579*700637cbSDimitry Andric
580*700637cbSDimitry Andricprivate:
581*700637cbSDimitry Andric  typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
582*700637cbSDimitry Andric
583*700637cbSDimitry Andric  __table __table_;
584*700637cbSDimitry Andric
585*700637cbSDimitry Andricpublic:
586*700637cbSDimitry Andric  typedef typename __table::pointer pointer;
587*700637cbSDimitry Andric  typedef typename __table::const_pointer const_pointer;
588*700637cbSDimitry Andric  typedef typename __table::size_type size_type;
589*700637cbSDimitry Andric  typedef typename __table::difference_type difference_type;
590*700637cbSDimitry Andric
591*700637cbSDimitry Andric  typedef typename __table::const_iterator iterator;
592*700637cbSDimitry Andric  typedef typename __table::const_iterator const_iterator;
593*700637cbSDimitry Andric  typedef typename __table::const_local_iterator local_iterator;
594*700637cbSDimitry Andric  typedef typename __table::const_local_iterator const_local_iterator;
595*700637cbSDimitry Andric
596*700637cbSDimitry Andric  template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
597*700637cbSDimitry Andric  friend class _LIBCPP_TEMPLATE_VIS unordered_set;
598*700637cbSDimitry Andric  template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
599*700637cbSDimitry Andric  friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
600*700637cbSDimitry Andric
601*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set() {}
602*700637cbSDimitry Andric  explicit _LIBCPP_HIDE_FROM_ABI
603*700637cbSDimitry Andric  unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
604*700637cbSDimitry Andric
605*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI
606*700637cbSDimitry Andric  unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
607*700637cbSDimitry Andric  template <class _InputIterator>
608*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set(_InputIterator __first, _InputIterator __last);
609*700637cbSDimitry Andric  template <class _InputIterator>
610*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI
611*700637cbSDimitry Andric  unordered_set(_InputIterator __first,
612*700637cbSDimitry Andric                _InputIterator __last,
613*700637cbSDimitry Andric                size_type __n,
614*700637cbSDimitry Andric                const hasher& __hf     = hasher(),
615*700637cbSDimitry Andric                const key_equal& __eql = key_equal());
616*700637cbSDimitry Andric  template <class _InputIterator>
617*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set(
618*700637cbSDimitry Andric      _InputIterator __first,
619*700637cbSDimitry Andric      _InputIterator __last,
620*700637cbSDimitry Andric      size_type __n,
621*700637cbSDimitry Andric      const hasher& __hf,
622*700637cbSDimitry Andric      const key_equal& __eql,
623*700637cbSDimitry Andric      const allocator_type& __a);
624*700637cbSDimitry Andric
625*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI explicit unordered_set(const allocator_type& __a);
626*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u);
627*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set(const unordered_set& __u, const allocator_type& __a);
628*700637cbSDimitry Andric
629*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ~unordered_set() {
630*700637cbSDimitry Andric    static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
631*700637cbSDimitry Andric  }
632*700637cbSDimitry Andric
633*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_set& operator=(const unordered_set& __u) {
634*700637cbSDimitry Andric    __table_ = __u.__table_;
635*700637cbSDimitry Andric    return *this;
636*700637cbSDimitry Andric  }
637*700637cbSDimitry Andric
638*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
639*700637cbSDimitry Andric    return allocator_type(__table_.__node_alloc());
640*700637cbSDimitry Andric  }
641*700637cbSDimitry Andric
642*700637cbSDimitry Andric  _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
643*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
644*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
645*700637cbSDimitry Andric
646*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
647*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
648*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
649*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
650*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
651*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
652*700637cbSDimitry Andric
653*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __x) { return __table_.__insert_unique(__x); }
654*700637cbSDimitry Andric
655*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) { return insert(__x).first; }
656*700637cbSDimitry Andric  template <class _InputIterator>
657*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
658*700637cbSDimitry Andric
659*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
660*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_unique(__k); }
661*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
662*700637cbSDimitry Andric    return __table_.erase(__first, __last);
663*700637cbSDimitry Andric  }
664*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
665*700637cbSDimitry Andric
666*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void swap(unordered_set& __u) { __table_.swap(__u.__table_); }
667*700637cbSDimitry Andric
668*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
669*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
670*700637cbSDimitry Andric
671*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
672*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
673*700637cbSDimitry Andric
674*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_unique(__k); }
675*700637cbSDimitry Andric
676*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
677*700637cbSDimitry Andric    return __table_.__equal_range_unique(__k);
678*700637cbSDimitry Andric  }
679*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
680*700637cbSDimitry Andric    return __table_.__equal_range_unique(__k);
681*700637cbSDimitry Andric  }
682*700637cbSDimitry Andric
683*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
684*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
685*700637cbSDimitry Andric
686*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
687*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
688*700637cbSDimitry Andric
689*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
690*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
691*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
692*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
693*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
694*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
695*700637cbSDimitry Andric
696*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
697*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
698*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
699*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_unique(__n); }
700*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_unique(__n); }
701*700637cbSDimitry Andric};
702*700637cbSDimitry Andric
703*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
704*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql)
705*700637cbSDimitry Andric    : __table_(__hf, __eql) {
706*700637cbSDimitry Andric  __table_.__rehash_unique(__n);
707*700637cbSDimitry Andric}
708*700637cbSDimitry Andric
709*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
710*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
711*700637cbSDimitry Andric    size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
712*700637cbSDimitry Andric    : __table_(__hf, __eql, __a) {
713*700637cbSDimitry Andric  __table_.__rehash_unique(__n);
714*700637cbSDimitry Andric}
715*700637cbSDimitry Andric
716*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
717*700637cbSDimitry Andrictemplate <class _InputIterator>
718*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(_InputIterator __first, _InputIterator __last) {
719*700637cbSDimitry Andric  insert(__first, __last);
720*700637cbSDimitry Andric}
721*700637cbSDimitry Andric
722*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
723*700637cbSDimitry Andrictemplate <class _InputIterator>
724*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
725*700637cbSDimitry Andric    _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
726*700637cbSDimitry Andric    : __table_(__hf, __eql) {
727*700637cbSDimitry Andric  __table_.__rehash_unique(__n);
728*700637cbSDimitry Andric  insert(__first, __last);
729*700637cbSDimitry Andric}
730*700637cbSDimitry Andric
731*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
732*700637cbSDimitry Andrictemplate <class _InputIterator>
733*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
734*700637cbSDimitry Andric    _InputIterator __first,
735*700637cbSDimitry Andric    _InputIterator __last,
736*700637cbSDimitry Andric    size_type __n,
737*700637cbSDimitry Andric    const hasher& __hf,
738*700637cbSDimitry Andric    const key_equal& __eql,
739*700637cbSDimitry Andric    const allocator_type& __a)
740*700637cbSDimitry Andric    : __table_(__hf, __eql, __a) {
741*700637cbSDimitry Andric  __table_.__rehash_unique(__n);
742*700637cbSDimitry Andric  insert(__first, __last);
743*700637cbSDimitry Andric}
744*700637cbSDimitry Andric
745*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
746*700637cbSDimitry Andricinline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const allocator_type& __a) : __table_(__a) {}
747*700637cbSDimitry Andric
748*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
749*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u) : __table_(__u.__table_) {
750*700637cbSDimitry Andric  __table_.__rehash_unique(__u.bucket_count());
751*700637cbSDimitry Andric  insert(__u.begin(), __u.end());
752*700637cbSDimitry Andric}
753*700637cbSDimitry Andric
754*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
755*700637cbSDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(const unordered_set& __u, const allocator_type& __a)
756*700637cbSDimitry Andric    : __table_(__u.__table_, __a) {
757*700637cbSDimitry Andric  __table_.__rehash_unique(__u.bucket_count());
758*700637cbSDimitry Andric  insert(__u.begin(), __u.end());
759*700637cbSDimitry Andric}
760*700637cbSDimitry Andric
761*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
762*700637cbSDimitry Andrictemplate <class _InputIterator>
763*700637cbSDimitry Andricinline void unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
764*700637cbSDimitry Andric  for (; __first != __last; ++__first)
765*700637cbSDimitry Andric    __table_.__insert_unique(*__first);
766*700637cbSDimitry Andric}
767*700637cbSDimitry Andric
768*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
769*700637cbSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI void
770*700637cbSDimitry Andricswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
771*700637cbSDimitry Andric  __x.swap(__y);
772*700637cbSDimitry Andric}
773*700637cbSDimitry Andric
774*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
775*700637cbSDimitry Andric_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
776*700637cbSDimitry Andric                                      const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
777*700637cbSDimitry Andric  if (__x.size() != __y.size())
778*700637cbSDimitry Andric    return false;
779*700637cbSDimitry Andric  typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
780*700637cbSDimitry Andric  for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) {
781*700637cbSDimitry Andric    const_iterator __j = __y.find(*__i);
782*700637cbSDimitry Andric    if (__j == __ey || !(*__i == *__j))
783*700637cbSDimitry Andric      return false;
784*700637cbSDimitry Andric  }
785*700637cbSDimitry Andric  return true;
786*700637cbSDimitry Andric}
787*700637cbSDimitry Andric
788*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
789*700637cbSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
790*700637cbSDimitry Andric                                             const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) {
791*700637cbSDimitry Andric  return !(__x == __y);
792*700637cbSDimitry Andric}
793*700637cbSDimitry Andric
794*700637cbSDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> >
795*700637cbSDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_multiset {
796*700637cbSDimitry Andricpublic:
797*700637cbSDimitry Andric  // types
798*700637cbSDimitry Andric  typedef _Value key_type;
799*700637cbSDimitry Andric  typedef key_type value_type;
800*700637cbSDimitry Andric  typedef __type_identity_t<_Hash> hasher;
801*700637cbSDimitry Andric  typedef __type_identity_t<_Pred> key_equal;
802*700637cbSDimitry Andric  typedef __type_identity_t<_Alloc> allocator_type;
803*700637cbSDimitry Andric  typedef value_type& reference;
804*700637cbSDimitry Andric  typedef const value_type& const_reference;
805*700637cbSDimitry Andric  static_assert(is_same<value_type, typename allocator_type::value_type>::value,
806*700637cbSDimitry Andric                "Allocator::value_type must be same type as value_type");
807*700637cbSDimitry Andric
808*700637cbSDimitry Andricprivate:
809*700637cbSDimitry Andric  typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
810*700637cbSDimitry Andric
811*700637cbSDimitry Andric  __table __table_;
812*700637cbSDimitry Andric
813*700637cbSDimitry Andricpublic:
814*700637cbSDimitry Andric  typedef typename __table::pointer pointer;
815*700637cbSDimitry Andric  typedef typename __table::const_pointer const_pointer;
816*700637cbSDimitry Andric  typedef typename __table::size_type size_type;
817*700637cbSDimitry Andric  typedef typename __table::difference_type difference_type;
818*700637cbSDimitry Andric
819*700637cbSDimitry Andric  typedef typename __table::const_iterator iterator;
820*700637cbSDimitry Andric  typedef typename __table::const_iterator const_iterator;
821*700637cbSDimitry Andric  typedef typename __table::const_local_iterator local_iterator;
822*700637cbSDimitry Andric  typedef typename __table::const_local_iterator const_local_iterator;
823*700637cbSDimitry Andric
824*700637cbSDimitry Andric  template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
825*700637cbSDimitry Andric  friend class _LIBCPP_TEMPLATE_VIS unordered_set;
826*700637cbSDimitry Andric  template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
827*700637cbSDimitry Andric  friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
828*700637cbSDimitry Andric
829*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset() {}
830*700637cbSDimitry Andric  explicit _LIBCPP_HIDE_FROM_ABI
831*700637cbSDimitry Andric  unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
832*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI
833*700637cbSDimitry Andric  unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
834*700637cbSDimitry Andric
835*700637cbSDimitry Andric  template <class _InputIterator>
836*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
837*700637cbSDimitry Andric  template <class _InputIterator>
838*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset(
839*700637cbSDimitry Andric      _InputIterator __first,
840*700637cbSDimitry Andric      _InputIterator __last,
841*700637cbSDimitry Andric      size_type __n,
842*700637cbSDimitry Andric      const hasher& __hf     = hasher(),
843*700637cbSDimitry Andric      const key_equal& __eql = key_equal());
844*700637cbSDimitry Andric  template <class _InputIterator>
845*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset(
846*700637cbSDimitry Andric      _InputIterator __first,
847*700637cbSDimitry Andric      _InputIterator __last,
848*700637cbSDimitry Andric      size_type __n,
849*700637cbSDimitry Andric      const hasher& __hf,
850*700637cbSDimitry Andric      const key_equal& __eql,
851*700637cbSDimitry Andric      const allocator_type& __a);
852*700637cbSDimitry Andric
853*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI explicit unordered_multiset(const allocator_type& __a);
854*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u);
855*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
856*700637cbSDimitry Andric
857*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() {
858*700637cbSDimitry Andric    static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
859*700637cbSDimitry Andric  }
860*700637cbSDimitry Andric
861*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI unordered_multiset& operator=(const unordered_multiset& __u) {
862*700637cbSDimitry Andric    __table_ = __u.__table_;
863*700637cbSDimitry Andric    return *this;
864*700637cbSDimitry Andric  }
865*700637cbSDimitry Andric
866*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
867*700637cbSDimitry Andric    return allocator_type(__table_.__node_alloc());
868*700637cbSDimitry Andric  }
869*700637cbSDimitry Andric
870*700637cbSDimitry Andric  _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; }
871*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); }
872*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); }
873*700637cbSDimitry Andric
874*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __table_.begin(); }
875*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __table_.end(); }
876*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __table_.begin(); }
877*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __table_.end(); }
878*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return __table_.begin(); }
879*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return __table_.end(); }
880*700637cbSDimitry Andric
881*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __x) { return __table_.__insert_multi(__x); }
882*700637cbSDimitry Andric
883*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
884*700637cbSDimitry Andric    return __table_.__insert_multi(__p, __x);
885*700637cbSDimitry Andric  }
886*700637cbSDimitry Andric
887*700637cbSDimitry Andric  template <class _InputIterator>
888*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last);
889*700637cbSDimitry Andric
890*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __table_.erase(__p); }
891*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __table_.__erase_multi(__k); }
892*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __first, const_iterator __last) {
893*700637cbSDimitry Andric    return __table_.erase(__first, __last);
894*700637cbSDimitry Andric  }
895*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
896*700637cbSDimitry Andric
897*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void swap(unordered_multiset& __u) { __table_.swap(__u.__table_); }
898*700637cbSDimitry Andric
899*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI hasher hash_function() const { return __table_.hash_function(); }
900*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI key_equal key_eq() const { return __table_.key_eq(); }
901*700637cbSDimitry Andric
902*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
903*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
904*700637cbSDimitry Andric
905*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __table_.__count_multi(__k); }
906*700637cbSDimitry Andric
907*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
908*700637cbSDimitry Andric    return __table_.__equal_range_multi(__k);
909*700637cbSDimitry Andric  }
910*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
911*700637cbSDimitry Andric    return __table_.__equal_range_multi(__k);
912*700637cbSDimitry Andric  }
913*700637cbSDimitry Andric
914*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __table_.bucket_count(); }
915*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return __table_.max_bucket_count(); }
916*700637cbSDimitry Andric
917*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const { return __table_.bucket_size(__n); }
918*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI size_type bucket(const key_type& __k) const { return __table_.bucket(__k); }
919*700637cbSDimitry Andric
920*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI local_iterator begin(size_type __n) { return __table_.begin(__n); }
921*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI local_iterator end(size_type __n) { return __table_.end(__n); }
922*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator begin(size_type __n) const { return __table_.cbegin(__n); }
923*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator end(size_type __n) const { return __table_.cend(__n); }
924*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator cbegin(size_type __n) const { return __table_.cbegin(__n); }
925*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI const_local_iterator cend(size_type __n) const { return __table_.cend(__n); }
926*700637cbSDimitry Andric
927*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI float load_factor() const _NOEXCEPT { return __table_.load_factor(); }
928*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __table_.max_load_factor(); }
929*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void max_load_factor(float __mlf) { __table_.max_load_factor(__mlf); }
930*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void rehash(size_type __n) { __table_.__rehash_multi(__n); }
931*700637cbSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n) { __table_.__reserve_multi(__n); }
932*700637cbSDimitry Andric};
933*700637cbSDimitry Andric
934*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
935*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
936*700637cbSDimitry Andric    size_type __n, const hasher& __hf, const key_equal& __eql)
937*700637cbSDimitry Andric    : __table_(__hf, __eql) {
938*700637cbSDimitry Andric  __table_.__rehash_multi(__n);
939*700637cbSDimitry Andric}
940*700637cbSDimitry Andric
941*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
942*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
943*700637cbSDimitry Andric    size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
944*700637cbSDimitry Andric    : __table_(__hf, __eql, __a) {
945*700637cbSDimitry Andric  __table_.__rehash_multi(__n);
946*700637cbSDimitry Andric}
947*700637cbSDimitry Andric
948*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
949*700637cbSDimitry Andrictemplate <class _InputIterator>
950*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(_InputIterator __first, _InputIterator __last) {
951*700637cbSDimitry Andric  insert(__first, __last);
952*700637cbSDimitry Andric}
953*700637cbSDimitry Andric
954*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
955*700637cbSDimitry Andrictemplate <class _InputIterator>
956*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
957*700637cbSDimitry Andric    _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql)
958*700637cbSDimitry Andric    : __table_(__hf, __eql) {
959*700637cbSDimitry Andric  __table_.__rehash_multi(__n);
960*700637cbSDimitry Andric  insert(__first, __last);
961*700637cbSDimitry Andric}
962*700637cbSDimitry Andric
963*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
964*700637cbSDimitry Andrictemplate <class _InputIterator>
965*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
966*700637cbSDimitry Andric    _InputIterator __first,
967*700637cbSDimitry Andric    _InputIterator __last,
968*700637cbSDimitry Andric    size_type __n,
969*700637cbSDimitry Andric    const hasher& __hf,
970*700637cbSDimitry Andric    const key_equal& __eql,
971*700637cbSDimitry Andric    const allocator_type& __a)
972*700637cbSDimitry Andric    : __table_(__hf, __eql, __a) {
973*700637cbSDimitry Andric  __table_.__rehash_multi(__n);
974*700637cbSDimitry Andric  insert(__first, __last);
975*700637cbSDimitry Andric}
976*700637cbSDimitry Andric
977*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
978*700637cbSDimitry Andricinline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const allocator_type& __a)
979*700637cbSDimitry Andric    : __table_(__a) {}
980*700637cbSDimitry Andric
981*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
982*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(const unordered_multiset& __u)
983*700637cbSDimitry Andric    : __table_(__u.__table_) {
984*700637cbSDimitry Andric  __table_.__rehash_multi(__u.bucket_count());
985*700637cbSDimitry Andric  insert(__u.begin(), __u.end());
986*700637cbSDimitry Andric}
987*700637cbSDimitry Andric
988*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
989*700637cbSDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
990*700637cbSDimitry Andric    const unordered_multiset& __u, const allocator_type& __a)
991*700637cbSDimitry Andric    : __table_(__u.__table_, __a) {
992*700637cbSDimitry Andric  __table_.__rehash_multi(__u.bucket_count());
993*700637cbSDimitry Andric  insert(__u.begin(), __u.end());
994*700637cbSDimitry Andric}
995*700637cbSDimitry Andric
996*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
997*700637cbSDimitry Andrictemplate <class _InputIterator>
998*700637cbSDimitry Andricinline void unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
999*700637cbSDimitry Andric  for (; __first != __last; ++__first)
1000*700637cbSDimitry Andric    __table_.__insert_multi(*__first);
1001*700637cbSDimitry Andric}
1002*700637cbSDimitry Andric
1003*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
1004*700637cbSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI void
1005*700637cbSDimitry Andricswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
1006*700637cbSDimitry Andric  __x.swap(__y);
1007*700637cbSDimitry Andric}
1008*700637cbSDimitry Andric
1009*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
1010*700637cbSDimitry Andric_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1011*700637cbSDimitry Andric                                      const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
1012*700637cbSDimitry Andric  if (__x.size() != __y.size())
1013*700637cbSDimitry Andric    return false;
1014*700637cbSDimitry Andric  typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator;
1015*700637cbSDimitry Andric  typedef pair<const_iterator, const_iterator> _EqRng;
1016*700637cbSDimitry Andric  for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) {
1017*700637cbSDimitry Andric    _EqRng __xeq = __x.equal_range(*__i);
1018*700637cbSDimitry Andric    _EqRng __yeq = __y.equal_range(*__i);
1019*700637cbSDimitry Andric    if (std::distance(__xeq.first, __xeq.second) != std::distance(__yeq.first, __yeq.second) ||
1020*700637cbSDimitry Andric        !std::is_permutation(__xeq.first, __xeq.second, __yeq.first))
1021*700637cbSDimitry Andric      return false;
1022*700637cbSDimitry Andric    __i = __xeq.second;
1023*700637cbSDimitry Andric  }
1024*700637cbSDimitry Andric  return true;
1025*700637cbSDimitry Andric}
1026*700637cbSDimitry Andric
1027*700637cbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
1028*700637cbSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1029*700637cbSDimitry Andric                                             const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) {
1030*700637cbSDimitry Andric  return !(__x == __y);
1031*700637cbSDimitry Andric}
1032*700637cbSDimitry Andric
1033*700637cbSDimitry Andric_LIBCPP_END_NAMESPACE_STD
1034*700637cbSDimitry Andric
1035*700637cbSDimitry Andric_LIBCPP_POP_MACROS
1036*700637cbSDimitry Andric
1037*700637cbSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
1038*700637cbSDimitry Andric#  include <__cxx03/cstdlib>
1039*700637cbSDimitry Andric#  include <__cxx03/functional>
1040*700637cbSDimitry Andric#  include <__cxx03/iterator>
1041*700637cbSDimitry Andric#  include <__cxx03/stdexcept>
1042*700637cbSDimitry Andric#  include <__cxx03/type_traits>
1043*700637cbSDimitry Andric#endif
1044*700637cbSDimitry Andric
1045*700637cbSDimitry Andric#endif // _LIBCPP___CXX03_UNORDERED_SET
1046