xref: /freebsd/contrib/llvm-project/libcxx/include/unordered_set (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
10b57cec5SDimitry Andric// -*- C++ -*-
2*349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
30b57cec5SDimitry Andric//
40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric//
80b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric
100b57cec5SDimitry Andric#ifndef _LIBCPP_UNORDERED_SET
110b57cec5SDimitry Andric#define _LIBCPP_UNORDERED_SET
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric/*
140b57cec5SDimitry Andric
150b57cec5SDimitry Andric    unordered_set synopsis
160b57cec5SDimitry Andric
170b57cec5SDimitry Andric#include <initializer_list>
180b57cec5SDimitry Andric
190b57cec5SDimitry Andricnamespace std
200b57cec5SDimitry Andric{
210b57cec5SDimitry Andric
220b57cec5SDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
230b57cec5SDimitry Andric          class Alloc = allocator<Value>>
240b57cec5SDimitry Andricclass unordered_set
250b57cec5SDimitry Andric{
260b57cec5SDimitry Andricpublic:
270b57cec5SDimitry Andric    // types
280b57cec5SDimitry Andric    typedef Value                                                      key_type;
290b57cec5SDimitry Andric    typedef key_type                                                   value_type;
300b57cec5SDimitry Andric    typedef Hash                                                       hasher;
310b57cec5SDimitry Andric    typedef Pred                                                       key_equal;
320b57cec5SDimitry Andric    typedef Alloc                                                      allocator_type;
330b57cec5SDimitry Andric    typedef value_type&                                                reference;
340b57cec5SDimitry Andric    typedef const value_type&                                          const_reference;
350b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::pointer         pointer;
360b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
370b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::size_type       size_type;
380b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
390b57cec5SDimitry Andric
400b57cec5SDimitry Andric    typedef /unspecified/ iterator;
410b57cec5SDimitry Andric    typedef /unspecified/ const_iterator;
420b57cec5SDimitry Andric    typedef /unspecified/ local_iterator;
430b57cec5SDimitry Andric    typedef /unspecified/ const_local_iterator;
440b57cec5SDimitry Andric
450b57cec5SDimitry Andric    typedef unspecified node_type unspecified;                            // C++17
460b57cec5SDimitry Andric    typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type;   // C++17
470b57cec5SDimitry Andric
480b57cec5SDimitry Andric    unordered_set()
490b57cec5SDimitry Andric        noexcept(
500b57cec5SDimitry Andric            is_nothrow_default_constructible<hasher>::value &&
510b57cec5SDimitry Andric            is_nothrow_default_constructible<key_equal>::value &&
520b57cec5SDimitry Andric            is_nothrow_default_constructible<allocator_type>::value);
530b57cec5SDimitry Andric    explicit unordered_set(size_type n, const hasher& hf = hasher(),
540b57cec5SDimitry Andric                           const key_equal& eql = key_equal(),
550b57cec5SDimitry Andric                           const allocator_type& a = allocator_type());
560b57cec5SDimitry Andric    template <class InputIterator>
570b57cec5SDimitry Andric        unordered_set(InputIterator f, InputIterator l,
580b57cec5SDimitry Andric                      size_type n = 0, const hasher& hf = hasher(),
590b57cec5SDimitry Andric                      const key_equal& eql = key_equal(),
600b57cec5SDimitry Andric                      const allocator_type& a = allocator_type());
610b57cec5SDimitry Andric    explicit unordered_set(const allocator_type&);
620b57cec5SDimitry Andric    unordered_set(const unordered_set&);
630b57cec5SDimitry Andric    unordered_set(const unordered_set&, const Allocator&);
640b57cec5SDimitry Andric    unordered_set(unordered_set&&)
650b57cec5SDimitry Andric        noexcept(
660b57cec5SDimitry Andric            is_nothrow_move_constructible<hasher>::value &&
670b57cec5SDimitry Andric            is_nothrow_move_constructible<key_equal>::value &&
680b57cec5SDimitry Andric            is_nothrow_move_constructible<allocator_type>::value);
690b57cec5SDimitry Andric    unordered_set(unordered_set&&, const Allocator&);
700b57cec5SDimitry Andric    unordered_set(initializer_list<value_type>, size_type n = 0,
710b57cec5SDimitry Andric                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
720b57cec5SDimitry Andric                  const allocator_type& a = allocator_type());
730b57cec5SDimitry Andric    unordered_set(size_type n, const allocator_type& a); // C++14
740b57cec5SDimitry Andric    unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
750b57cec5SDimitry Andric    template <class InputIterator>
760b57cec5SDimitry Andric      unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
770b57cec5SDimitry Andric    template <class InputIterator>
780b57cec5SDimitry Andric      unordered_set(InputIterator f, InputIterator l, size_type n,
790b57cec5SDimitry Andric                    const hasher& hf,  const allocator_type& a); // C++14
800b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
810b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> il, size_type n,
820b57cec5SDimitry Andric                  const hasher& hf,  const allocator_type& a); // C++14
830b57cec5SDimitry Andric    ~unordered_set();
840b57cec5SDimitry Andric    unordered_set& operator=(const unordered_set&);
850b57cec5SDimitry Andric    unordered_set& operator=(unordered_set&&)
860b57cec5SDimitry Andric        noexcept(
870b57cec5SDimitry Andric            allocator_type::propagate_on_container_move_assignment::value &&
880b57cec5SDimitry Andric            is_nothrow_move_assignable<allocator_type>::value &&
890b57cec5SDimitry Andric            is_nothrow_move_assignable<hasher>::value &&
900b57cec5SDimitry Andric            is_nothrow_move_assignable<key_equal>::value);
910b57cec5SDimitry Andric    unordered_set& operator=(initializer_list<value_type>);
920b57cec5SDimitry Andric
930b57cec5SDimitry Andric    allocator_type get_allocator() const noexcept;
940b57cec5SDimitry Andric
950b57cec5SDimitry Andric    bool      empty() const noexcept;
960b57cec5SDimitry Andric    size_type size() const noexcept;
970b57cec5SDimitry Andric    size_type max_size() const noexcept;
980b57cec5SDimitry Andric
990b57cec5SDimitry Andric    iterator       begin() noexcept;
1000b57cec5SDimitry Andric    iterator       end() noexcept;
1010b57cec5SDimitry Andric    const_iterator begin()  const noexcept;
1020b57cec5SDimitry Andric    const_iterator end()    const noexcept;
1030b57cec5SDimitry Andric    const_iterator cbegin() const noexcept;
1040b57cec5SDimitry Andric    const_iterator cend()   const noexcept;
1050b57cec5SDimitry Andric
1060b57cec5SDimitry Andric    template <class... Args>
1070b57cec5SDimitry Andric        pair<iterator, bool> emplace(Args&&... args);
1080b57cec5SDimitry Andric    template <class... Args>
1090b57cec5SDimitry Andric        iterator emplace_hint(const_iterator position, Args&&... args);
1100b57cec5SDimitry Andric    pair<iterator, bool> insert(const value_type& obj);
1110b57cec5SDimitry Andric    pair<iterator, bool> insert(value_type&& obj);
1120b57cec5SDimitry Andric    iterator insert(const_iterator hint, const value_type& obj);
1130b57cec5SDimitry Andric    iterator insert(const_iterator hint, value_type&& obj);
1140b57cec5SDimitry Andric    template <class InputIterator>
1150b57cec5SDimitry Andric        void insert(InputIterator first, InputIterator last);
1160b57cec5SDimitry Andric    void insert(initializer_list<value_type>);
1170b57cec5SDimitry Andric
1180b57cec5SDimitry Andric    node_type extract(const_iterator position);                       // C++17
1190b57cec5SDimitry Andric    node_type extract(const key_type& x);                             // C++17
1200b57cec5SDimitry Andric    insert_return_type insert(node_type&& nh);                        // C++17
1210b57cec5SDimitry Andric    iterator           insert(const_iterator hint, node_type&& nh);   // C++17
1220b57cec5SDimitry Andric
1230b57cec5SDimitry Andric    iterator erase(const_iterator position);
1240b57cec5SDimitry Andric    iterator erase(iterator position);  // C++14
1250b57cec5SDimitry Andric    size_type erase(const key_type& k);
1260b57cec5SDimitry Andric    iterator erase(const_iterator first, const_iterator last);
1270b57cec5SDimitry Andric    void clear() noexcept;
1280b57cec5SDimitry Andric
1290b57cec5SDimitry Andric    template<class H2, class P2>
1300b57cec5SDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>& source);         // C++17
1310b57cec5SDimitry Andric    template<class H2, class P2>
1320b57cec5SDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>&& source);        // C++17
1330b57cec5SDimitry Andric    template<class H2, class P2>
1340b57cec5SDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>& source);    // C++17
1350b57cec5SDimitry Andric    template<class H2, class P2>
1360b57cec5SDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>&& source);   // C++17
1370b57cec5SDimitry Andric
1380b57cec5SDimitry Andric    void swap(unordered_set&)
1390b57cec5SDimitry Andric       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
1400b57cec5SDimitry Andric                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
1410b57cec5SDimitry Andric                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
1420b57cec5SDimitry Andric
1430b57cec5SDimitry Andric    hasher hash_function() const;
1440b57cec5SDimitry Andric    key_equal key_eq() const;
1450b57cec5SDimitry Andric
1460b57cec5SDimitry Andric    iterator       find(const key_type& k);
1470b57cec5SDimitry Andric    const_iterator find(const key_type& k) const;
148e8d8bef9SDimitry Andric    template<typename K>
149e8d8bef9SDimitry Andric        iterator find(const K& x);              // C++20
150e8d8bef9SDimitry Andric    template<typename K>
151e8d8bef9SDimitry Andric        const_iterator find(const K& x) const;  // C++20
1520b57cec5SDimitry Andric    size_type count(const key_type& k) const;
153e8d8bef9SDimitry Andric    template<typename K>
154e8d8bef9SDimitry Andric        size_type count(const K& k) const; // C++20
1550b57cec5SDimitry Andric    bool contains(const key_type& k) const; // C++20
156e8d8bef9SDimitry Andric    template<typename K>
157e8d8bef9SDimitry Andric        bool contains(const K& k) const; // C++20
1580b57cec5SDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& k);
1590b57cec5SDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
160e8d8bef9SDimitry Andric    template<typename K>
161e8d8bef9SDimitry Andric        pair<iterator, iterator>             equal_range(const K& k); // C++20
162e8d8bef9SDimitry Andric    template<typename K>
163e8d8bef9SDimitry Andric        pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
1640b57cec5SDimitry Andric
1650b57cec5SDimitry Andric    size_type bucket_count() const noexcept;
1660b57cec5SDimitry Andric    size_type max_bucket_count() const noexcept;
1670b57cec5SDimitry Andric
1680b57cec5SDimitry Andric    size_type bucket_size(size_type n) const;
1690b57cec5SDimitry Andric    size_type bucket(const key_type& k) const;
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andric    local_iterator       begin(size_type n);
1720b57cec5SDimitry Andric    local_iterator       end(size_type n);
1730b57cec5SDimitry Andric    const_local_iterator begin(size_type n) const;
1740b57cec5SDimitry Andric    const_local_iterator end(size_type n) const;
1750b57cec5SDimitry Andric    const_local_iterator cbegin(size_type n) const;
1760b57cec5SDimitry Andric    const_local_iterator cend(size_type n) const;
1770b57cec5SDimitry Andric
1780b57cec5SDimitry Andric    float load_factor() const noexcept;
1790b57cec5SDimitry Andric    float max_load_factor() const noexcept;
1800b57cec5SDimitry Andric    void max_load_factor(float z);
1810b57cec5SDimitry Andric    void rehash(size_type n);
1820b57cec5SDimitry Andric    void reserve(size_type n);
1830b57cec5SDimitry Andric};
1840b57cec5SDimitry Andric
185*349cc55cSDimitry Andrictemplate<class InputIterator,
186*349cc55cSDimitry Andric    class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
187*349cc55cSDimitry Andric    class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
188*349cc55cSDimitry Andric    class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
189*349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
190*349cc55cSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
191*349cc55cSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type,
192*349cc55cSDimitry Andric        Hash, Pred, Allocator>; // C++17
193*349cc55cSDimitry Andric
194*349cc55cSDimitry Andrictemplate<class T, class Hash = hash<T>,
195*349cc55cSDimitry Andric          class Pred = equal_to<T>, class Allocator = allocator<T>>
196*349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type = see below,
197*349cc55cSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
198*349cc55cSDimitry Andric  -> unordered_set<T, Hash, Pred, Allocator>; // C++17
199*349cc55cSDimitry Andric
200*349cc55cSDimitry Andrictemplate<class InputIterator,  class Allocator>
201*349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator)
202*349cc55cSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type,
203*349cc55cSDimitry Andric        hash<typename iterator_traits<InputIterator>::value_type>,
204*349cc55cSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
205*349cc55cSDimitry Andric        Allocator>; // C++17
206*349cc55cSDimitry Andric
207*349cc55cSDimitry Andrictemplate<class InputIterator, class Hash, class Allocator>
208*349cc55cSDimitry Andricunordered_set(InputIterator, InputIterator, typename see below::size_type,
209*349cc55cSDimitry Andric    Hash, Allocator)
210*349cc55cSDimitry Andric  -> unordered_set<typename iterator_traits<InputIterator>::value_type, Hash,
211*349cc55cSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
212*349cc55cSDimitry Andric        Allocator>; // C++17
213*349cc55cSDimitry Andric
214*349cc55cSDimitry Andrictemplate<class T, class Allocator>
215*349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Allocator)
216*349cc55cSDimitry Andric  -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; // C++17
217*349cc55cSDimitry Andric
218*349cc55cSDimitry Andrictemplate<class T, class Hash, class Allocator>
219*349cc55cSDimitry Andricunordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
220*349cc55cSDimitry Andric  -> unordered_set<T, Hash, equal_to<T>, Allocator>; // C++17
221*349cc55cSDimitry Andric
2220b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
2230b57cec5SDimitry Andric    void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
2240b57cec5SDimitry Andric              unordered_set<Value, Hash, Pred, Alloc>& y)
2250b57cec5SDimitry Andric              noexcept(noexcept(x.swap(y)));
2260b57cec5SDimitry Andric
2270b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
2280b57cec5SDimitry Andric    bool
2290b57cec5SDimitry Andric    operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,
2300b57cec5SDimitry Andric               const unordered_set<Value, Hash, Pred, Alloc>& y);
2310b57cec5SDimitry Andric
2320b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
2330b57cec5SDimitry Andric    bool
2340b57cec5SDimitry Andric    operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,
2350b57cec5SDimitry Andric               const unordered_set<Value, Hash, Pred, Alloc>& y);
2360b57cec5SDimitry Andric
2370b57cec5SDimitry Andrictemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
2380b57cec5SDimitry Andric          class Alloc = allocator<Value>>
2390b57cec5SDimitry Andricclass unordered_multiset
2400b57cec5SDimitry Andric{
2410b57cec5SDimitry Andricpublic:
2420b57cec5SDimitry Andric    // types
2430b57cec5SDimitry Andric    typedef Value                                                      key_type;
2440b57cec5SDimitry Andric    typedef key_type                                                   value_type;
2450b57cec5SDimitry Andric    typedef Hash                                                       hasher;
2460b57cec5SDimitry Andric    typedef Pred                                                       key_equal;
2470b57cec5SDimitry Andric    typedef Alloc                                                      allocator_type;
2480b57cec5SDimitry Andric    typedef value_type&                                                reference;
2490b57cec5SDimitry Andric    typedef const value_type&                                          const_reference;
2500b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::pointer         pointer;
2510b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
2520b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::size_type       size_type;
2530b57cec5SDimitry Andric    typedef typename allocator_traits<allocator_type>::difference_type difference_type;
2540b57cec5SDimitry Andric
2550b57cec5SDimitry Andric    typedef /unspecified/ iterator;
2560b57cec5SDimitry Andric    typedef /unspecified/ const_iterator;
2570b57cec5SDimitry Andric    typedef /unspecified/ local_iterator;
2580b57cec5SDimitry Andric    typedef /unspecified/ const_local_iterator;
2590b57cec5SDimitry Andric
2600b57cec5SDimitry Andric    typedef unspecified node_type unspecified;   // C++17
2610b57cec5SDimitry Andric
2620b57cec5SDimitry Andric    unordered_multiset()
2630b57cec5SDimitry Andric        noexcept(
2640b57cec5SDimitry Andric            is_nothrow_default_constructible<hasher>::value &&
2650b57cec5SDimitry Andric            is_nothrow_default_constructible<key_equal>::value &&
2660b57cec5SDimitry Andric            is_nothrow_default_constructible<allocator_type>::value);
2670b57cec5SDimitry Andric    explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
2680b57cec5SDimitry Andric                           const key_equal& eql = key_equal(),
2690b57cec5SDimitry Andric                           const allocator_type& a = allocator_type());
2700b57cec5SDimitry Andric    template <class InputIterator>
2710b57cec5SDimitry Andric        unordered_multiset(InputIterator f, InputIterator l,
2720b57cec5SDimitry Andric                      size_type n = 0, const hasher& hf = hasher(),
2730b57cec5SDimitry Andric                      const key_equal& eql = key_equal(),
2740b57cec5SDimitry Andric                      const allocator_type& a = allocator_type());
2750b57cec5SDimitry Andric    explicit unordered_multiset(const allocator_type&);
2760b57cec5SDimitry Andric    unordered_multiset(const unordered_multiset&);
2770b57cec5SDimitry Andric    unordered_multiset(const unordered_multiset&, const Allocator&);
2780b57cec5SDimitry Andric    unordered_multiset(unordered_multiset&&)
2790b57cec5SDimitry Andric        noexcept(
2800b57cec5SDimitry Andric            is_nothrow_move_constructible<hasher>::value &&
2810b57cec5SDimitry Andric            is_nothrow_move_constructible<key_equal>::value &&
2820b57cec5SDimitry Andric            is_nothrow_move_constructible<allocator_type>::value);
2830b57cec5SDimitry Andric    unordered_multiset(unordered_multiset&&, const Allocator&);
2840b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
2850b57cec5SDimitry Andric                  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
2860b57cec5SDimitry Andric                  const allocator_type& a = allocator_type());
2870b57cec5SDimitry Andric    unordered_multiset(size_type n, const allocator_type& a); // C++14
2880b57cec5SDimitry Andric    unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
2890b57cec5SDimitry Andric    template <class InputIterator>
2900b57cec5SDimitry Andric      unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
2910b57cec5SDimitry Andric    template <class InputIterator>
2920b57cec5SDimitry Andric      unordered_multiset(InputIterator f, InputIterator l, size_type n,
2930b57cec5SDimitry Andric                         const hasher& hf, const allocator_type& a); // C++14
2940b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
2950b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> il, size_type n,
2960b57cec5SDimitry Andric                       const hasher& hf,  const allocator_type& a); // C++14
2970b57cec5SDimitry Andric    ~unordered_multiset();
2980b57cec5SDimitry Andric    unordered_multiset& operator=(const unordered_multiset&);
2990b57cec5SDimitry Andric    unordered_multiset& operator=(unordered_multiset&&)
3000b57cec5SDimitry Andric        noexcept(
3010b57cec5SDimitry Andric            allocator_type::propagate_on_container_move_assignment::value &&
3020b57cec5SDimitry Andric            is_nothrow_move_assignable<allocator_type>::value &&
3030b57cec5SDimitry Andric            is_nothrow_move_assignable<hasher>::value &&
3040b57cec5SDimitry Andric            is_nothrow_move_assignable<key_equal>::value);
3050b57cec5SDimitry Andric    unordered_multiset& operator=(initializer_list<value_type>);
3060b57cec5SDimitry Andric
3070b57cec5SDimitry Andric    allocator_type get_allocator() const noexcept;
3080b57cec5SDimitry Andric
3090b57cec5SDimitry Andric    bool      empty() const noexcept;
3100b57cec5SDimitry Andric    size_type size() const noexcept;
3110b57cec5SDimitry Andric    size_type max_size() const noexcept;
3120b57cec5SDimitry Andric
3130b57cec5SDimitry Andric    iterator       begin() noexcept;
3140b57cec5SDimitry Andric    iterator       end() noexcept;
3150b57cec5SDimitry Andric    const_iterator begin()  const noexcept;
3160b57cec5SDimitry Andric    const_iterator end()    const noexcept;
3170b57cec5SDimitry Andric    const_iterator cbegin() const noexcept;
3180b57cec5SDimitry Andric    const_iterator cend()   const noexcept;
3190b57cec5SDimitry Andric
3200b57cec5SDimitry Andric    template <class... Args>
3210b57cec5SDimitry Andric        iterator emplace(Args&&... args);
3220b57cec5SDimitry Andric    template <class... Args>
3230b57cec5SDimitry Andric        iterator emplace_hint(const_iterator position, Args&&... args);
3240b57cec5SDimitry Andric    iterator insert(const value_type& obj);
3250b57cec5SDimitry Andric    iterator insert(value_type&& obj);
3260b57cec5SDimitry Andric    iterator insert(const_iterator hint, const value_type& obj);
3270b57cec5SDimitry Andric    iterator insert(const_iterator hint, value_type&& obj);
3280b57cec5SDimitry Andric    template <class InputIterator>
3290b57cec5SDimitry Andric        void insert(InputIterator first, InputIterator last);
3300b57cec5SDimitry Andric    void insert(initializer_list<value_type>);
3310b57cec5SDimitry Andric
3320b57cec5SDimitry Andric    node_type extract(const_iterator position);             // C++17
3330b57cec5SDimitry Andric    node_type extract(const key_type& x);                   // C++17
3340b57cec5SDimitry Andric    iterator insert(node_type&& nh);                        // C++17
3350b57cec5SDimitry Andric    iterator insert(const_iterator hint, node_type&& nh);   // C++17
3360b57cec5SDimitry Andric
3370b57cec5SDimitry Andric    iterator erase(const_iterator position);
3380b57cec5SDimitry Andric    iterator erase(iterator position);  // C++14
3390b57cec5SDimitry Andric    size_type erase(const key_type& k);
3400b57cec5SDimitry Andric    iterator erase(const_iterator first, const_iterator last);
3410b57cec5SDimitry Andric    void clear() noexcept;
3420b57cec5SDimitry Andric
3430b57cec5SDimitry Andric    template<class H2, class P2>
3440b57cec5SDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>& source);    // C++17
3450b57cec5SDimitry Andric    template<class H2, class P2>
3460b57cec5SDimitry Andric      void merge(unordered_multiset<Key, H2, P2, Allocator>&& source);   // C++17
3470b57cec5SDimitry Andric    template<class H2, class P2>
3480b57cec5SDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>& source);         // C++17
3490b57cec5SDimitry Andric    template<class H2, class P2>
3500b57cec5SDimitry Andric      void merge(unordered_set<Key, H2, P2, Allocator>&& source);        // C++17
3510b57cec5SDimitry Andric
3520b57cec5SDimitry Andric    void swap(unordered_multiset&)
3530b57cec5SDimitry Andric       noexcept(allocator_traits<Allocator>::is_always_equal::value &&
3540b57cec5SDimitry Andric                 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
3550b57cec5SDimitry Andric                 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
3560b57cec5SDimitry Andric
3570b57cec5SDimitry Andric    hasher hash_function() const;
3580b57cec5SDimitry Andric    key_equal key_eq() const;
3590b57cec5SDimitry Andric
3600b57cec5SDimitry Andric    iterator       find(const key_type& k);
3610b57cec5SDimitry Andric    const_iterator find(const key_type& k) const;
362e8d8bef9SDimitry Andric    template<typename K>
363e8d8bef9SDimitry Andric        iterator find(const K& x);              // C++20
364e8d8bef9SDimitry Andric    template<typename K>
365e8d8bef9SDimitry Andric        const_iterator find(const K& x) const;  // C++20
3660b57cec5SDimitry Andric    size_type count(const key_type& k) const;
367e8d8bef9SDimitry Andric    template<typename K>
368e8d8bef9SDimitry Andric        size_type count(const K& k) const; // C++20
3690b57cec5SDimitry Andric    bool contains(const key_type& k) const; // C++20
370e8d8bef9SDimitry Andric    template<typename K>
371e8d8bef9SDimitry Andric        bool contains(const K& k) const; // C++20
3720b57cec5SDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& k);
3730b57cec5SDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
374e8d8bef9SDimitry Andric    template<typename K>
375e8d8bef9SDimitry Andric        pair<iterator, iterator>             equal_range(const K& k); // C++20
376e8d8bef9SDimitry Andric    template<typename K>
377e8d8bef9SDimitry Andric        pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
3780b57cec5SDimitry Andric
3790b57cec5SDimitry Andric    size_type bucket_count() const noexcept;
3800b57cec5SDimitry Andric    size_type max_bucket_count() const noexcept;
3810b57cec5SDimitry Andric
3820b57cec5SDimitry Andric    size_type bucket_size(size_type n) const;
3830b57cec5SDimitry Andric    size_type bucket(const key_type& k) const;
3840b57cec5SDimitry Andric
3850b57cec5SDimitry Andric    local_iterator       begin(size_type n);
3860b57cec5SDimitry Andric    local_iterator       end(size_type n);
3870b57cec5SDimitry Andric    const_local_iterator begin(size_type n) const;
3880b57cec5SDimitry Andric    const_local_iterator end(size_type n) const;
3890b57cec5SDimitry Andric    const_local_iterator cbegin(size_type n) const;
3900b57cec5SDimitry Andric    const_local_iterator cend(size_type n) const;
3910b57cec5SDimitry Andric
3920b57cec5SDimitry Andric    float load_factor() const noexcept;
3930b57cec5SDimitry Andric    float max_load_factor() const noexcept;
3940b57cec5SDimitry Andric    void max_load_factor(float z);
3950b57cec5SDimitry Andric    void rehash(size_type n);
3960b57cec5SDimitry Andric    void reserve(size_type n);
3970b57cec5SDimitry Andric};
3980b57cec5SDimitry Andric
399*349cc55cSDimitry Andrictemplate<class InputIterator,
400*349cc55cSDimitry Andric    class Hash = hash<typename iterator_traits<InputIterator>::value_type>,
401*349cc55cSDimitry Andric    class Pred = equal_to<typename iterator_traits<InputIterator>::value_type>,
402*349cc55cSDimitry Andric    class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
403*349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, see below::size_type = see below,
404*349cc55cSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
405*349cc55cSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
406*349cc55cSDimitry Andric        Hash, Pred, Allocator>; // C++17
407*349cc55cSDimitry Andric
408*349cc55cSDimitry Andrictemplate<class T, class Hash = hash<T>,
409*349cc55cSDimitry Andric          class Pred = equal_to<T>, class Allocator = allocator<T>>
410*349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type = see below,
411*349cc55cSDimitry Andric    Hash = Hash(), Pred = Pred(), Allocator = Allocator())
412*349cc55cSDimitry Andric  -> unordered_multiset<T, Hash, Pred, Allocator>; // C++17
413*349cc55cSDimitry Andric
414*349cc55cSDimitry Andrictemplate<class InputIterator,  class Allocator>
415*349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator)
416*349cc55cSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type,
417*349cc55cSDimitry Andric        hash<typename iterator_traits<InputIterator>::value_type>,
418*349cc55cSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>,
419*349cc55cSDimitry Andric        Allocator>; // C++17
420*349cc55cSDimitry Andric
421*349cc55cSDimitry Andrictemplate<class InputIterator,  class Hash, class Allocator>
422*349cc55cSDimitry Andricunordered_multiset(InputIterator, InputIterator, typename see below::size_type,
423*349cc55cSDimitry Andric    Hash, Allocator)
424*349cc55cSDimitry Andric  -> unordered_multiset<typename iterator_traits<InputIterator>::value_type, Hash,
425*349cc55cSDimitry Andric        equal_to<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17
426*349cc55cSDimitry Andric
427*349cc55cSDimitry Andrictemplate<class T, class Allocator>
428*349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
429*349cc55cSDimitry Andric  -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>; // C++17
430*349cc55cSDimitry Andric
431*349cc55cSDimitry Andrictemplate<class T, class Hash, class Allocator>
432*349cc55cSDimitry Andricunordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
433*349cc55cSDimitry Andric  -> unordered_multiset<T, Hash, equal_to<T>, Allocator>; // C++17
434*349cc55cSDimitry Andric
4350b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
4360b57cec5SDimitry Andric    void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
4370b57cec5SDimitry Andric              unordered_multiset<Value, Hash, Pred, Alloc>& y)
4380b57cec5SDimitry Andric              noexcept(noexcept(x.swap(y)));
4390b57cec5SDimitry Andric
4400b57cec5SDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate>
4415ffd83dbSDimitry Andric    typename unordered_set<K, T, H, P, A>::size_type
4425ffd83dbSDimitry Andric    erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred);       // C++20
4430b57cec5SDimitry Andric
4440b57cec5SDimitry Andrictemplate <class K, class T, class H, class P, class A, class Predicate>
4455ffd83dbSDimitry Andric    typename unordered_multiset<K, T, H, P, A>::size_type
4465ffd83dbSDimitry Andric    erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred);  // C++20
4470b57cec5SDimitry Andric
4480b57cec5SDimitry Andric
4490b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
4500b57cec5SDimitry Andric    bool
4510b57cec5SDimitry Andric    operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
4520b57cec5SDimitry Andric               const unordered_multiset<Value, Hash, Pred, Alloc>& y);
4530b57cec5SDimitry Andric
4540b57cec5SDimitry Andrictemplate <class Value, class Hash, class Pred, class Alloc>
4550b57cec5SDimitry Andric    bool
4560b57cec5SDimitry Andric    operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
4570b57cec5SDimitry Andric               const unordered_multiset<Value, Hash, Pred, Alloc>& y);
4580b57cec5SDimitry Andric}  // std
4590b57cec5SDimitry Andric
4600b57cec5SDimitry Andric*/
4610b57cec5SDimitry Andric
4620b57cec5SDimitry Andric#include <__config>
463fe6060f1SDimitry Andric#include <__debug>
464fe6060f1SDimitry Andric#include <__functional/is_transparent.h>
4650b57cec5SDimitry Andric#include <__hash_table>
4660b57cec5SDimitry Andric#include <__node_handle>
467fe6060f1SDimitry Andric#include <__utility/forward.h>
468fe6060f1SDimitry Andric#include <compare>
4690b57cec5SDimitry Andric#include <functional>
470fe6060f1SDimitry Andric#include <iterator> // __libcpp_erase_if_container
4710b57cec5SDimitry Andric#include <version>
4720b57cec5SDimitry Andric
4730b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4740b57cec5SDimitry Andric#pragma GCC system_header
4750b57cec5SDimitry Andric#endif
4760b57cec5SDimitry Andric
4770b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
4780b57cec5SDimitry Andric
4790b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
4800b57cec5SDimitry Andricclass unordered_multiset;
4810b57cec5SDimitry Andric
4820b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
4830b57cec5SDimitry Andric          class _Alloc = allocator<_Value> >
4840b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_set
4850b57cec5SDimitry Andric{
4860b57cec5SDimitry Andricpublic:
4870b57cec5SDimitry Andric    // types
4880b57cec5SDimitry Andric    typedef _Value                                                     key_type;
4890b57cec5SDimitry Andric    typedef key_type                                                   value_type;
490fe6060f1SDimitry Andric    typedef __identity_t<_Hash>                                        hasher;
491fe6060f1SDimitry Andric    typedef __identity_t<_Pred>                                        key_equal;
492fe6060f1SDimitry Andric    typedef __identity_t<_Alloc>                                       allocator_type;
4930b57cec5SDimitry Andric    typedef value_type&                                                reference;
4940b57cec5SDimitry Andric    typedef const value_type&                                          const_reference;
4950b57cec5SDimitry Andric    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
4960b57cec5SDimitry Andric                  "Invalid allocator::value_type");
4970b57cec5SDimitry Andric
4980b57cec5SDimitry Andricprivate:
4990b57cec5SDimitry Andric    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
5000b57cec5SDimitry Andric
5010b57cec5SDimitry Andric    __table __table_;
5020b57cec5SDimitry Andric
5030b57cec5SDimitry Andricpublic:
5040b57cec5SDimitry Andric    typedef typename __table::pointer         pointer;
5050b57cec5SDimitry Andric    typedef typename __table::const_pointer   const_pointer;
5060b57cec5SDimitry Andric    typedef typename __table::size_type       size_type;
5070b57cec5SDimitry Andric    typedef typename __table::difference_type difference_type;
5080b57cec5SDimitry Andric
5090b57cec5SDimitry Andric    typedef typename __table::const_iterator       iterator;
5100b57cec5SDimitry Andric    typedef typename __table::const_iterator       const_iterator;
5110b57cec5SDimitry Andric    typedef typename __table::const_local_iterator local_iterator;
5120b57cec5SDimitry Andric    typedef typename __table::const_local_iterator const_local_iterator;
5130b57cec5SDimitry Andric
5140b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14
5150b57cec5SDimitry Andric    typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
5160b57cec5SDimitry Andric    typedef __insert_return_type<iterator, node_type> insert_return_type;
5170b57cec5SDimitry Andric#endif
5180b57cec5SDimitry Andric
5190b57cec5SDimitry Andric    template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
5200b57cec5SDimitry Andric        friend class _LIBCPP_TEMPLATE_VIS unordered_set;
5210b57cec5SDimitry Andric    template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
5220b57cec5SDimitry Andric        friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
5230b57cec5SDimitry Andric
5240b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
5250b57cec5SDimitry Andric    unordered_set()
5260b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
5270b57cec5SDimitry Andric        {
528e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
5290b57cec5SDimitry Andric            __get_db()->__insert_c(this);
5300b57cec5SDimitry Andric#endif
5310b57cec5SDimitry Andric        }
5320b57cec5SDimitry Andric    explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
5330b57cec5SDimitry Andric                           const key_equal& __eql = key_equal());
5340b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
5350b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
5360b57cec5SDimitry Andric    unordered_set(size_type __n, const allocator_type& __a)
5370b57cec5SDimitry Andric        : unordered_set(__n, hasher(), key_equal(), __a) {}
5380b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
5390b57cec5SDimitry Andric    unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
5400b57cec5SDimitry Andric        : unordered_set(__n, __hf, key_equal(), __a) {}
5410b57cec5SDimitry Andric#endif
5420b57cec5SDimitry Andric    unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
5430b57cec5SDimitry Andric                  const allocator_type& __a);
5440b57cec5SDimitry Andric    template <class _InputIterator>
5450b57cec5SDimitry Andric        unordered_set(_InputIterator __first, _InputIterator __last);
5460b57cec5SDimitry Andric    template <class _InputIterator>
5470b57cec5SDimitry Andric        unordered_set(_InputIterator __first, _InputIterator __last,
5480b57cec5SDimitry Andric                      size_type __n, const hasher& __hf = hasher(),
5490b57cec5SDimitry Andric                      const key_equal& __eql = key_equal());
5500b57cec5SDimitry Andric    template <class _InputIterator>
5510b57cec5SDimitry Andric        unordered_set(_InputIterator __first, _InputIterator __last,
5520b57cec5SDimitry Andric                      size_type __n, const hasher& __hf, const key_equal& __eql,
5530b57cec5SDimitry Andric                      const allocator_type& __a);
5540b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
5550b57cec5SDimitry Andric    template <class _InputIterator>
5560b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
5570b57cec5SDimitry Andric        unordered_set(_InputIterator __first, _InputIterator __last,
5580b57cec5SDimitry Andric                    size_type __n, const allocator_type& __a)
5590b57cec5SDimitry Andric            : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
5600b57cec5SDimitry Andric    template <class _InputIterator>
5610b57cec5SDimitry Andric        unordered_set(_InputIterator __first, _InputIterator __last,
5620b57cec5SDimitry Andric                      size_type __n, const hasher& __hf, const allocator_type& __a)
5630b57cec5SDimitry Andric            : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
5640b57cec5SDimitry Andric#endif
5650b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
5660b57cec5SDimitry Andric    explicit unordered_set(const allocator_type& __a);
5670b57cec5SDimitry Andric    unordered_set(const unordered_set& __u);
5680b57cec5SDimitry Andric    unordered_set(const unordered_set& __u, const allocator_type& __a);
5690b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
5700b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
5710b57cec5SDimitry Andric    unordered_set(unordered_set&& __u)
5720b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
5730b57cec5SDimitry Andric    unordered_set(unordered_set&& __u, const allocator_type& __a);
5740b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> __il);
5750b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> __il, size_type __n,
5760b57cec5SDimitry Andric                  const hasher& __hf = hasher(),
5770b57cec5SDimitry Andric                  const key_equal& __eql = key_equal());
5780b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> __il, size_type __n,
5790b57cec5SDimitry Andric                  const hasher& __hf, const key_equal& __eql,
5800b57cec5SDimitry Andric                  const allocator_type& __a);
5810b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
5820b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
5830b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> __il, size_type __n,
5840b57cec5SDimitry Andric                                                      const allocator_type& __a)
5850b57cec5SDimitry Andric        : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
5860b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
5870b57cec5SDimitry Andric    unordered_set(initializer_list<value_type> __il, size_type __n,
5880b57cec5SDimitry Andric                                  const hasher& __hf, const allocator_type& __a)
5890b57cec5SDimitry Andric        : unordered_set(__il, __n, __hf, key_equal(), __a) {}
5900b57cec5SDimitry Andric#endif
5910b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
5920b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
5930b57cec5SDimitry Andric    ~unordered_set() {
5940b57cec5SDimitry Andric        static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
5950b57cec5SDimitry Andric    }
5960b57cec5SDimitry Andric
5970b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
5980b57cec5SDimitry Andric    unordered_set& operator=(const unordered_set& __u)
5990b57cec5SDimitry Andric    {
6000b57cec5SDimitry Andric        __table_ = __u.__table_;
6010b57cec5SDimitry Andric        return *this;
6020b57cec5SDimitry Andric    }
6030b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
6040b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6050b57cec5SDimitry Andric    unordered_set& operator=(unordered_set&& __u)
6060b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
6070b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6080b57cec5SDimitry Andric    unordered_set& operator=(initializer_list<value_type> __il);
6090b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
6100b57cec5SDimitry Andric
6110b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6120b57cec5SDimitry Andric    allocator_type get_allocator() const _NOEXCEPT
6130b57cec5SDimitry Andric        {return allocator_type(__table_.__node_alloc());}
6140b57cec5SDimitry Andric
6150b57cec5SDimitry Andric    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
6160b57cec5SDimitry Andric    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
6170b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6180b57cec5SDimitry Andric    size_type size() const _NOEXCEPT  {return __table_.size();}
6190b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6200b57cec5SDimitry Andric    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
6210b57cec5SDimitry Andric
6220b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6230b57cec5SDimitry Andric    iterator       begin() _NOEXCEPT        {return __table_.begin();}
6240b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6250b57cec5SDimitry Andric    iterator       end() _NOEXCEPT          {return __table_.end();}
6260b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6270b57cec5SDimitry Andric    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
6280b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6290b57cec5SDimitry Andric    const_iterator end()    const _NOEXCEPT {return __table_.end();}
6300b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6310b57cec5SDimitry Andric    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
6320b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6330b57cec5SDimitry Andric    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
6340b57cec5SDimitry Andric
6350b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
6360b57cec5SDimitry Andric    template <class... _Args>
6370b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
6380b57cec5SDimitry Andric        pair<iterator, bool> emplace(_Args&&... __args)
6390b57cec5SDimitry Andric            {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
6400b57cec5SDimitry Andric    template <class... _Args>
6410b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
642e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
6430b57cec5SDimitry Andric        iterator emplace_hint(const_iterator __p, _Args&&... __args)
6440b57cec5SDimitry Andric        {
6450b57cec5SDimitry Andric            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
6460b57cec5SDimitry Andric                "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"
6470b57cec5SDimitry Andric                " referring to this unordered_set");
6480b57cec5SDimitry Andric            return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
6490b57cec5SDimitry Andric        }
6500b57cec5SDimitry Andric#else
6510b57cec5SDimitry Andric        iterator emplace_hint(const_iterator, _Args&&... __args)
6520b57cec5SDimitry Andric            {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
6530b57cec5SDimitry Andric#endif
6540b57cec5SDimitry Andric
6550b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6560b57cec5SDimitry Andric    pair<iterator, bool> insert(value_type&& __x)
6570b57cec5SDimitry Andric        {return __table_.__insert_unique(_VSTD::move(__x));}
6580b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
659e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
6600b57cec5SDimitry Andric    iterator insert(const_iterator __p, value_type&& __x)
6610b57cec5SDimitry Andric        {
6620b57cec5SDimitry Andric            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
6630b57cec5SDimitry Andric                "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
6640b57cec5SDimitry Andric                " referring to this unordered_set");
6650b57cec5SDimitry Andric            return insert(_VSTD::move(__x)).first;
6660b57cec5SDimitry Andric        }
6670b57cec5SDimitry Andric#else
6680b57cec5SDimitry Andric    iterator insert(const_iterator, value_type&& __x)
6690b57cec5SDimitry Andric        {return insert(_VSTD::move(__x)).first;}
6700b57cec5SDimitry Andric#endif
6710b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6720b57cec5SDimitry Andric    void insert(initializer_list<value_type> __il)
6730b57cec5SDimitry Andric        {insert(__il.begin(), __il.end());}
6740b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
6750b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6760b57cec5SDimitry Andric    pair<iterator, bool> insert(const value_type& __x)
6770b57cec5SDimitry Andric        {return __table_.__insert_unique(__x);}
6780b57cec5SDimitry Andric
6790b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
680e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
6810b57cec5SDimitry Andric    iterator insert(const_iterator __p, const value_type& __x)
6820b57cec5SDimitry Andric        {
6830b57cec5SDimitry Andric            _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
6840b57cec5SDimitry Andric                "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
6850b57cec5SDimitry Andric                " referring to this unordered_set");
6860b57cec5SDimitry Andric            return insert(__x).first;
6870b57cec5SDimitry Andric        }
6880b57cec5SDimitry Andric#else
6890b57cec5SDimitry Andric    iterator insert(const_iterator, const value_type& __x)
6900b57cec5SDimitry Andric        {return insert(__x).first;}
6910b57cec5SDimitry Andric#endif
6920b57cec5SDimitry Andric    template <class _InputIterator>
6930b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
6940b57cec5SDimitry Andric        void insert(_InputIterator __first, _InputIterator __last);
6950b57cec5SDimitry Andric
6960b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6970b57cec5SDimitry Andric    iterator erase(const_iterator __p) {return __table_.erase(__p);}
6980b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
6990b57cec5SDimitry Andric    size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
7000b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7010b57cec5SDimitry Andric    iterator erase(const_iterator __first, const_iterator __last)
7020b57cec5SDimitry Andric        {return __table_.erase(__first, __last);}
7030b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7040b57cec5SDimitry Andric    void clear() _NOEXCEPT {__table_.clear();}
7050b57cec5SDimitry Andric
7060b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14
7070b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7080b57cec5SDimitry Andric    insert_return_type insert(node_type&& __nh)
7090b57cec5SDimitry Andric    {
7100b57cec5SDimitry Andric        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
7110b57cec5SDimitry Andric            "node_type with incompatible allocator passed to unordered_set::insert()");
7120b57cec5SDimitry Andric        return __table_.template __node_handle_insert_unique<
7130b57cec5SDimitry Andric            node_type, insert_return_type>(_VSTD::move(__nh));
7140b57cec5SDimitry Andric    }
7150b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7160b57cec5SDimitry Andric    iterator insert(const_iterator __h, node_type&& __nh)
7170b57cec5SDimitry Andric    {
7180b57cec5SDimitry Andric        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
7190b57cec5SDimitry Andric            "node_type with incompatible allocator passed to unordered_set::insert()");
7200b57cec5SDimitry Andric        return __table_.template __node_handle_insert_unique<node_type>(
7210b57cec5SDimitry Andric            __h, _VSTD::move(__nh));
7220b57cec5SDimitry Andric    }
7230b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7240b57cec5SDimitry Andric    node_type extract(key_type const& __key)
7250b57cec5SDimitry Andric    {
7260b57cec5SDimitry Andric        return __table_.template __node_handle_extract<node_type>(__key);
7270b57cec5SDimitry Andric    }
7280b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7290b57cec5SDimitry Andric    node_type extract(const_iterator __it)
7300b57cec5SDimitry Andric    {
7310b57cec5SDimitry Andric        return __table_.template __node_handle_extract<node_type>(__it);
7320b57cec5SDimitry Andric    }
7330b57cec5SDimitry Andric
7340b57cec5SDimitry Andric    template<class _H2, class _P2>
7350b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7360b57cec5SDimitry Andric    void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
7370b57cec5SDimitry Andric    {
7380b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
7390b57cec5SDimitry Andric                       "merging container with incompatible allocator");
7400b57cec5SDimitry Andric        __table_.__node_handle_merge_unique(__source.__table_);
7410b57cec5SDimitry Andric    }
7420b57cec5SDimitry Andric    template<class _H2, class _P2>
7430b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7440b57cec5SDimitry Andric    void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
7450b57cec5SDimitry Andric    {
7460b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
7470b57cec5SDimitry Andric                       "merging container with incompatible allocator");
7480b57cec5SDimitry Andric        __table_.__node_handle_merge_unique(__source.__table_);
7490b57cec5SDimitry Andric    }
7500b57cec5SDimitry Andric    template<class _H2, class _P2>
7510b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7520b57cec5SDimitry Andric    void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
7530b57cec5SDimitry Andric    {
7540b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
7550b57cec5SDimitry Andric                       "merging container with incompatible allocator");
7560b57cec5SDimitry Andric        __table_.__node_handle_merge_unique(__source.__table_);
7570b57cec5SDimitry Andric    }
7580b57cec5SDimitry Andric    template<class _H2, class _P2>
7590b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7600b57cec5SDimitry Andric    void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
7610b57cec5SDimitry Andric    {
7620b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
7630b57cec5SDimitry Andric                       "merging container with incompatible allocator");
7640b57cec5SDimitry Andric        __table_.__node_handle_merge_unique(__source.__table_);
7650b57cec5SDimitry Andric    }
7660b57cec5SDimitry Andric#endif
7670b57cec5SDimitry Andric
7680b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7690b57cec5SDimitry Andric    void swap(unordered_set& __u)
7700b57cec5SDimitry Andric        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
7710b57cec5SDimitry Andric        {__table_.swap(__u.__table_);}
7720b57cec5SDimitry Andric
7730b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7740b57cec5SDimitry Andric    hasher hash_function() const {return __table_.hash_function();}
7750b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7760b57cec5SDimitry Andric    key_equal key_eq() const {return __table_.key_eq();}
7770b57cec5SDimitry Andric
7780b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7790b57cec5SDimitry Andric    iterator       find(const key_type& __k)       {return __table_.find(__k);}
7800b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7810b57cec5SDimitry Andric    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
782e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
783*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
784e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
785*349cc55cSDimitry Andric    iterator       find(const _K2& __k)            {return __table_.find(__k);}
786*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
787e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
788*349cc55cSDimitry Andric    const_iterator find(const _K2& __k) const      {return __table_.find(__k);}
789e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
790*349cc55cSDimitry Andric
7910b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
7920b57cec5SDimitry Andric    size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
7930b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17
794*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
795e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
796*349cc55cSDimitry Andric    size_type count(const _K2& __k) const      {return __table_.__count_unique(__k);}
797e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
798*349cc55cSDimitry Andric
799e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
8000b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8010b57cec5SDimitry Andric    bool contains(const key_type& __k) const {return find(__k) != end();}
802e8d8bef9SDimitry Andric
803*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
804e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
805*349cc55cSDimitry Andric    bool contains(const _K2& __k) const      {return find(__k) != end();}
8060b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17
807*349cc55cSDimitry Andric
8080b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8090b57cec5SDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& __k)
8100b57cec5SDimitry Andric        {return __table_.__equal_range_unique(__k);}
8110b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8120b57cec5SDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
8130b57cec5SDimitry Andric        {return __table_.__equal_range_unique(__k);}
814e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
815*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
816e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
817*349cc55cSDimitry Andric    pair<iterator, iterator>             equal_range(const _K2& __k)
818*349cc55cSDimitry Andric        {return __table_.__equal_range_unique(__k);}
819*349cc55cSDimitry Andric    template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
820e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
821*349cc55cSDimitry Andric    pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
822*349cc55cSDimitry Andric        {return __table_.__equal_range_unique(__k);}
823e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
8240b57cec5SDimitry Andric
8250b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8260b57cec5SDimitry Andric    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
8270b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8280b57cec5SDimitry Andric    size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
8290b57cec5SDimitry Andric
8300b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8310b57cec5SDimitry Andric    size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
8320b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8330b57cec5SDimitry Andric    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
8340b57cec5SDimitry Andric
8350b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8360b57cec5SDimitry Andric    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
8370b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8380b57cec5SDimitry Andric    local_iterator       end(size_type __n)          {return __table_.end(__n);}
8390b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8400b57cec5SDimitry Andric    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
8410b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8420b57cec5SDimitry Andric    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
8430b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8440b57cec5SDimitry Andric    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
8450b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8460b57cec5SDimitry Andric    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
8470b57cec5SDimitry Andric
8480b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8490b57cec5SDimitry Andric    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
8500b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8510b57cec5SDimitry Andric    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
8520b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8530b57cec5SDimitry Andric    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
8540b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8550b57cec5SDimitry Andric    void rehash(size_type __n) {__table_.rehash(__n);}
8560b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
8570b57cec5SDimitry Andric    void reserve(size_type __n) {__table_.reserve(__n);}
8580b57cec5SDimitry Andric
859e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
8600b57cec5SDimitry Andric
8610b57cec5SDimitry Andric    bool __dereferenceable(const const_iterator* __i) const
8620b57cec5SDimitry Andric        {return __table_.__dereferenceable(__i);}
8630b57cec5SDimitry Andric    bool __decrementable(const const_iterator* __i) const
8640b57cec5SDimitry Andric        {return __table_.__decrementable(__i);}
8650b57cec5SDimitry Andric    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
8660b57cec5SDimitry Andric        {return __table_.__addable(__i, __n);}
8670b57cec5SDimitry Andric    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
8680b57cec5SDimitry Andric        {return __table_.__addable(__i, __n);}
8690b57cec5SDimitry Andric
870e8d8bef9SDimitry Andric#endif // _LIBCPP_DEBUG_LEVEL == 2
8710b57cec5SDimitry Andric
8720b57cec5SDimitry Andric};
8730b57cec5SDimitry Andric
874*349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17
8750b57cec5SDimitry Andrictemplate<class _InputIterator,
8760b57cec5SDimitry Andric         class _Hash = hash<__iter_value_type<_InputIterator>>,
8770b57cec5SDimitry Andric         class _Pred = equal_to<__iter_value_type<_InputIterator>>,
8780b57cec5SDimitry Andric         class _Allocator = allocator<__iter_value_type<_InputIterator>>,
879*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
880*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
881*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
882*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Pred>::value>,
883*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
8840b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
8850b57cec5SDimitry Andric              _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
8860b57cec5SDimitry Andric  -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
8870b57cec5SDimitry Andric
8880b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>,
8890b57cec5SDimitry Andric         class _Pred = equal_to<_Tp>,
8900b57cec5SDimitry Andric         class _Allocator = allocator<_Tp>,
891*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
892*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
893*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Pred>::value>,
894*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
8950b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
8960b57cec5SDimitry Andric              _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
8970b57cec5SDimitry Andric  -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
8980b57cec5SDimitry Andric
8990b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator,
900*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
901*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
9020b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator,
9030b57cec5SDimitry Andric              typename allocator_traits<_Allocator>::size_type, _Allocator)
9040b57cec5SDimitry Andric  -> unordered_set<__iter_value_type<_InputIterator>,
9050b57cec5SDimitry Andric                   hash<__iter_value_type<_InputIterator>>,
9060b57cec5SDimitry Andric                   equal_to<__iter_value_type<_InputIterator>>,
9070b57cec5SDimitry Andric                   _Allocator>;
9080b57cec5SDimitry Andric
9090b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator,
910*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
911*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
912*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
913*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
9140b57cec5SDimitry Andricunordered_set(_InputIterator, _InputIterator,
9150b57cec5SDimitry Andric              typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
9160b57cec5SDimitry Andric  -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
9170b57cec5SDimitry Andric                   equal_to<__iter_value_type<_InputIterator>>,
9180b57cec5SDimitry Andric                   _Allocator>;
9190b57cec5SDimitry Andric
9200b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator,
921*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
9220b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
9230b57cec5SDimitry Andric  -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
9240b57cec5SDimitry Andric
9250b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator,
926*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
927*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
928*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
9290b57cec5SDimitry Andricunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
9300b57cec5SDimitry Andric  -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
9310b57cec5SDimitry Andric#endif
9320b57cec5SDimitry Andric
9330b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9340b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
9350b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql)
9360b57cec5SDimitry Andric    : __table_(__hf, __eql)
9370b57cec5SDimitry Andric{
938e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
9390b57cec5SDimitry Andric    __get_db()->__insert_c(this);
9400b57cec5SDimitry Andric#endif
9410b57cec5SDimitry Andric    __table_.rehash(__n);
9420b57cec5SDimitry Andric}
9430b57cec5SDimitry Andric
9440b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9450b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
9460b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
9470b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
9480b57cec5SDimitry Andric{
949e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
9500b57cec5SDimitry Andric    __get_db()->__insert_c(this);
9510b57cec5SDimitry Andric#endif
9520b57cec5SDimitry Andric    __table_.rehash(__n);
9530b57cec5SDimitry Andric}
9540b57cec5SDimitry Andric
9550b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9560b57cec5SDimitry Andrictemplate <class _InputIterator>
9570b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
9580b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last)
9590b57cec5SDimitry Andric{
960e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
9610b57cec5SDimitry Andric    __get_db()->__insert_c(this);
9620b57cec5SDimitry Andric#endif
9630b57cec5SDimitry Andric    insert(__first, __last);
9640b57cec5SDimitry Andric}
9650b57cec5SDimitry Andric
9660b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9670b57cec5SDimitry Andrictemplate <class _InputIterator>
9680b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
9690b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last, size_type __n,
9700b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql)
9710b57cec5SDimitry Andric    : __table_(__hf, __eql)
9720b57cec5SDimitry Andric{
973e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
9740b57cec5SDimitry Andric    __get_db()->__insert_c(this);
9750b57cec5SDimitry Andric#endif
9760b57cec5SDimitry Andric    __table_.rehash(__n);
9770b57cec5SDimitry Andric    insert(__first, __last);
9780b57cec5SDimitry Andric}
9790b57cec5SDimitry Andric
9800b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9810b57cec5SDimitry Andrictemplate <class _InputIterator>
9820b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
9830b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last, size_type __n,
9840b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
9850b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
9860b57cec5SDimitry Andric{
987e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
9880b57cec5SDimitry Andric    __get_db()->__insert_c(this);
9890b57cec5SDimitry Andric#endif
9900b57cec5SDimitry Andric    __table_.rehash(__n);
9910b57cec5SDimitry Andric    insert(__first, __last);
9920b57cec5SDimitry Andric}
9930b57cec5SDimitry Andric
9940b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
9950b57cec5SDimitry Andricinline
9960b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
9970b57cec5SDimitry Andric        const allocator_type& __a)
9980b57cec5SDimitry Andric    : __table_(__a)
9990b57cec5SDimitry Andric{
1000e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10010b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10020b57cec5SDimitry Andric#endif
10030b57cec5SDimitry Andric}
10040b57cec5SDimitry Andric
10050b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10060b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10070b57cec5SDimitry Andric        const unordered_set& __u)
10080b57cec5SDimitry Andric    : __table_(__u.__table_)
10090b57cec5SDimitry Andric{
1010e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10110b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10120b57cec5SDimitry Andric#endif
10130b57cec5SDimitry Andric    __table_.rehash(__u.bucket_count());
10140b57cec5SDimitry Andric    insert(__u.begin(), __u.end());
10150b57cec5SDimitry Andric}
10160b57cec5SDimitry Andric
10170b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10180b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10190b57cec5SDimitry Andric        const unordered_set& __u, const allocator_type& __a)
10200b57cec5SDimitry Andric    : __table_(__u.__table_, __a)
10210b57cec5SDimitry Andric{
1022e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10230b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10240b57cec5SDimitry Andric#endif
10250b57cec5SDimitry Andric    __table_.rehash(__u.bucket_count());
10260b57cec5SDimitry Andric    insert(__u.begin(), __u.end());
10270b57cec5SDimitry Andric}
10280b57cec5SDimitry Andric
10290b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
10300b57cec5SDimitry Andric
10310b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10320b57cec5SDimitry Andricinline
10330b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10340b57cec5SDimitry Andric        unordered_set&& __u)
10350b57cec5SDimitry Andric    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
10360b57cec5SDimitry Andric    : __table_(_VSTD::move(__u.__table_))
10370b57cec5SDimitry Andric{
1038e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10390b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10400b57cec5SDimitry Andric    __get_db()->swap(this, &__u);
10410b57cec5SDimitry Andric#endif
10420b57cec5SDimitry Andric}
10430b57cec5SDimitry Andric
10440b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10450b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10460b57cec5SDimitry Andric        unordered_set&& __u, const allocator_type& __a)
10470b57cec5SDimitry Andric    : __table_(_VSTD::move(__u.__table_), __a)
10480b57cec5SDimitry Andric{
1049e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10500b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10510b57cec5SDimitry Andric#endif
10520b57cec5SDimitry Andric    if (__a != __u.get_allocator())
10530b57cec5SDimitry Andric    {
10540b57cec5SDimitry Andric        iterator __i = __u.begin();
10550b57cec5SDimitry Andric        while (__u.size() != 0)
10560b57cec5SDimitry Andric            __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
10570b57cec5SDimitry Andric    }
1058e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10590b57cec5SDimitry Andric    else
10600b57cec5SDimitry Andric        __get_db()->swap(this, &__u);
10610b57cec5SDimitry Andric#endif
10620b57cec5SDimitry Andric}
10630b57cec5SDimitry Andric
10640b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10650b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10660b57cec5SDimitry Andric        initializer_list<value_type> __il)
10670b57cec5SDimitry Andric{
1068e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10690b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10700b57cec5SDimitry Andric#endif
10710b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
10720b57cec5SDimitry Andric}
10730b57cec5SDimitry Andric
10740b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10750b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10760b57cec5SDimitry Andric        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
10770b57cec5SDimitry Andric        const key_equal& __eql)
10780b57cec5SDimitry Andric    : __table_(__hf, __eql)
10790b57cec5SDimitry Andric{
1080e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10810b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10820b57cec5SDimitry Andric#endif
10830b57cec5SDimitry Andric    __table_.rehash(__n);
10840b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
10850b57cec5SDimitry Andric}
10860b57cec5SDimitry Andric
10870b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
10880b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
10890b57cec5SDimitry Andric        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
10900b57cec5SDimitry Andric        const key_equal& __eql, const allocator_type& __a)
10910b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
10920b57cec5SDimitry Andric{
1093e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
10940b57cec5SDimitry Andric    __get_db()->__insert_c(this);
10950b57cec5SDimitry Andric#endif
10960b57cec5SDimitry Andric    __table_.rehash(__n);
10970b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
10980b57cec5SDimitry Andric}
10990b57cec5SDimitry Andric
11000b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11010b57cec5SDimitry Andricinline
11020b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>&
11030b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
11040b57cec5SDimitry Andric    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
11050b57cec5SDimitry Andric{
11060b57cec5SDimitry Andric    __table_ = _VSTD::move(__u.__table_);
11070b57cec5SDimitry Andric    return *this;
11080b57cec5SDimitry Andric}
11090b57cec5SDimitry Andric
11100b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11110b57cec5SDimitry Andricinline
11120b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>&
11130b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
11140b57cec5SDimitry Andric        initializer_list<value_type> __il)
11150b57cec5SDimitry Andric{
11160b57cec5SDimitry Andric    __table_.__assign_unique(__il.begin(), __il.end());
11170b57cec5SDimitry Andric    return *this;
11180b57cec5SDimitry Andric}
11190b57cec5SDimitry Andric
11200b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
11210b57cec5SDimitry Andric
11220b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11230b57cec5SDimitry Andrictemplate <class _InputIterator>
11240b57cec5SDimitry Andricinline
11250b57cec5SDimitry Andricvoid
11260b57cec5SDimitry Andricunordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
11270b57cec5SDimitry Andric                                                    _InputIterator __last)
11280b57cec5SDimitry Andric{
11290b57cec5SDimitry Andric    for (; __first != __last; ++__first)
11300b57cec5SDimitry Andric        __table_.__insert_unique(*__first);
11310b57cec5SDimitry Andric}
11320b57cec5SDimitry Andric
11330b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11340b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
11350b57cec5SDimitry Andricvoid
11360b57cec5SDimitry Andricswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
11370b57cec5SDimitry Andric     unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
11380b57cec5SDimitry Andric    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
11390b57cec5SDimitry Andric{
11400b57cec5SDimitry Andric    __x.swap(__y);
11410b57cec5SDimitry Andric}
11420b57cec5SDimitry Andric
11430b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17
11445ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc,
11455ffd83dbSDimitry Andric          class _Predicate>
11460b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
11475ffd83dbSDimitry Andric    typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type
11485ffd83dbSDimitry Andric    erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c,
11495ffd83dbSDimitry Andric             _Predicate __pred) {
1150fe6060f1SDimitry Andric  return _VSTD::__libcpp_erase_if_container(__c, __pred);
11515ffd83dbSDimitry Andric}
11520b57cec5SDimitry Andric#endif
11530b57cec5SDimitry Andric
11540b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11550b57cec5SDimitry Andricbool
11560b57cec5SDimitry Andricoperator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
11570b57cec5SDimitry Andric           const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
11580b57cec5SDimitry Andric{
11590b57cec5SDimitry Andric    if (__x.size() != __y.size())
11600b57cec5SDimitry Andric        return false;
11610b57cec5SDimitry Andric    typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
11620b57cec5SDimitry Andric                                                                 const_iterator;
11630b57cec5SDimitry Andric    for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
11640b57cec5SDimitry Andric            __i != __ex; ++__i)
11650b57cec5SDimitry Andric    {
11660b57cec5SDimitry Andric        const_iterator __j = __y.find(*__i);
11670b57cec5SDimitry Andric        if (__j == __ey || !(*__i == *__j))
11680b57cec5SDimitry Andric            return false;
11690b57cec5SDimitry Andric    }
11700b57cec5SDimitry Andric    return true;
11710b57cec5SDimitry Andric}
11720b57cec5SDimitry Andric
11730b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
11740b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
11750b57cec5SDimitry Andricbool
11760b57cec5SDimitry Andricoperator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
11770b57cec5SDimitry Andric           const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
11780b57cec5SDimitry Andric{
11790b57cec5SDimitry Andric    return !(__x == __y);
11800b57cec5SDimitry Andric}
11810b57cec5SDimitry Andric
11820b57cec5SDimitry Andrictemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
11830b57cec5SDimitry Andric          class _Alloc = allocator<_Value> >
11840b57cec5SDimitry Andricclass _LIBCPP_TEMPLATE_VIS unordered_multiset
11850b57cec5SDimitry Andric{
11860b57cec5SDimitry Andricpublic:
11870b57cec5SDimitry Andric    // types
11880b57cec5SDimitry Andric    typedef _Value                                                     key_type;
11890b57cec5SDimitry Andric    typedef key_type                                                   value_type;
1190fe6060f1SDimitry Andric    typedef __identity_t<_Hash>                                        hasher;
1191fe6060f1SDimitry Andric    typedef __identity_t<_Pred>                                        key_equal;
1192fe6060f1SDimitry Andric    typedef __identity_t<_Alloc>                                       allocator_type;
11930b57cec5SDimitry Andric    typedef value_type&                                                reference;
11940b57cec5SDimitry Andric    typedef const value_type&                                          const_reference;
11950b57cec5SDimitry Andric    static_assert((is_same<value_type, typename allocator_type::value_type>::value),
11960b57cec5SDimitry Andric                  "Invalid allocator::value_type");
11970b57cec5SDimitry Andric
11980b57cec5SDimitry Andricprivate:
11990b57cec5SDimitry Andric    typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
12000b57cec5SDimitry Andric
12010b57cec5SDimitry Andric    __table __table_;
12020b57cec5SDimitry Andric
12030b57cec5SDimitry Andricpublic:
12040b57cec5SDimitry Andric    typedef typename __table::pointer         pointer;
12050b57cec5SDimitry Andric    typedef typename __table::const_pointer   const_pointer;
12060b57cec5SDimitry Andric    typedef typename __table::size_type       size_type;
12070b57cec5SDimitry Andric    typedef typename __table::difference_type difference_type;
12080b57cec5SDimitry Andric
12090b57cec5SDimitry Andric    typedef typename __table::const_iterator       iterator;
12100b57cec5SDimitry Andric    typedef typename __table::const_iterator       const_iterator;
12110b57cec5SDimitry Andric    typedef typename __table::const_local_iterator local_iterator;
12120b57cec5SDimitry Andric    typedef typename __table::const_local_iterator const_local_iterator;
12130b57cec5SDimitry Andric
12140b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14
12150b57cec5SDimitry Andric    typedef __set_node_handle<typename __table::__node, allocator_type> node_type;
12160b57cec5SDimitry Andric#endif
12170b57cec5SDimitry Andric
12180b57cec5SDimitry Andric    template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
12190b57cec5SDimitry Andric        friend class _LIBCPP_TEMPLATE_VIS unordered_set;
12200b57cec5SDimitry Andric    template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>
12210b57cec5SDimitry Andric        friend class _LIBCPP_TEMPLATE_VIS unordered_multiset;
12220b57cec5SDimitry Andric
12230b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
12240b57cec5SDimitry Andric    unordered_multiset()
12250b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
12260b57cec5SDimitry Andric        {
1227e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
12280b57cec5SDimitry Andric            __get_db()->__insert_c(this);
12290b57cec5SDimitry Andric#endif
12300b57cec5SDimitry Andric        }
12310b57cec5SDimitry Andric    explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
12320b57cec5SDimitry Andric                                const key_equal& __eql = key_equal());
12330b57cec5SDimitry Andric    unordered_multiset(size_type __n, const hasher& __hf,
12340b57cec5SDimitry Andric                       const key_equal& __eql, const allocator_type& __a);
12350b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
12360b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12370b57cec5SDimitry Andric    unordered_multiset(size_type __n, const allocator_type& __a)
12380b57cec5SDimitry Andric        : unordered_multiset(__n, hasher(), key_equal(), __a) {}
12390b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12400b57cec5SDimitry Andric    unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
12410b57cec5SDimitry Andric        : unordered_multiset(__n, __hf, key_equal(), __a) {}
12420b57cec5SDimitry Andric#endif
12430b57cec5SDimitry Andric    template <class _InputIterator>
12440b57cec5SDimitry Andric        unordered_multiset(_InputIterator __first, _InputIterator __last);
12450b57cec5SDimitry Andric    template <class _InputIterator>
12460b57cec5SDimitry Andric        unordered_multiset(_InputIterator __first, _InputIterator __last,
12470b57cec5SDimitry Andric                      size_type __n, const hasher& __hf = hasher(),
12480b57cec5SDimitry Andric                      const key_equal& __eql = key_equal());
12490b57cec5SDimitry Andric    template <class _InputIterator>
12500b57cec5SDimitry Andric        unordered_multiset(_InputIterator __first, _InputIterator __last,
12510b57cec5SDimitry Andric                      size_type __n , const hasher& __hf,
12520b57cec5SDimitry Andric                      const key_equal& __eql, const allocator_type& __a);
12530b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
12540b57cec5SDimitry Andric    template <class _InputIterator>
12550b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12560b57cec5SDimitry Andric    unordered_multiset(_InputIterator __first, _InputIterator __last,
12570b57cec5SDimitry Andric                       size_type __n, const allocator_type& __a)
12580b57cec5SDimitry Andric        : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
12590b57cec5SDimitry Andric    template <class _InputIterator>
12600b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12610b57cec5SDimitry Andric    unordered_multiset(_InputIterator __first, _InputIterator __last,
12620b57cec5SDimitry Andric                       size_type __n, const hasher& __hf, const allocator_type& __a)
12630b57cec5SDimitry Andric        : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
12640b57cec5SDimitry Andric#endif
12650b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
12660b57cec5SDimitry Andric    explicit unordered_multiset(const allocator_type& __a);
12670b57cec5SDimitry Andric    unordered_multiset(const unordered_multiset& __u);
12680b57cec5SDimitry Andric    unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
12690b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
12700b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
12710b57cec5SDimitry Andric    unordered_multiset(unordered_multiset&& __u)
12720b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
12730b57cec5SDimitry Andric    unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
12740b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> __il);
12750b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> __il, size_type __n,
12760b57cec5SDimitry Andric                       const hasher& __hf = hasher(),
12770b57cec5SDimitry Andric                       const key_equal& __eql = key_equal());
12780b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> __il, size_type __n,
12790b57cec5SDimitry Andric                       const hasher& __hf, const key_equal& __eql,
12800b57cec5SDimitry Andric                       const allocator_type& __a);
12810b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 11
12820b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12830b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
12840b57cec5SDimitry Andric      : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
12850b57cec5SDimitry Andric    inline _LIBCPP_INLINE_VISIBILITY
12860b57cec5SDimitry Andric    unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
12870b57cec5SDimitry Andric      : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
12880b57cec5SDimitry Andric#endif
12890b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
12900b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
12910b57cec5SDimitry Andric    ~unordered_multiset() {
12920b57cec5SDimitry Andric        static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
12930b57cec5SDimitry Andric    }
12940b57cec5SDimitry Andric
12950b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
12960b57cec5SDimitry Andric    unordered_multiset& operator=(const unordered_multiset& __u)
12970b57cec5SDimitry Andric    {
12980b57cec5SDimitry Andric        __table_ = __u.__table_;
12990b57cec5SDimitry Andric        return *this;
13000b57cec5SDimitry Andric    }
13010b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
13020b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13030b57cec5SDimitry Andric    unordered_multiset& operator=(unordered_multiset&& __u)
13040b57cec5SDimitry Andric        _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
13050b57cec5SDimitry Andric    unordered_multiset& operator=(initializer_list<value_type> __il);
13060b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
13070b57cec5SDimitry Andric
13080b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13090b57cec5SDimitry Andric    allocator_type get_allocator() const _NOEXCEPT
13100b57cec5SDimitry Andric        {return allocator_type(__table_.__node_alloc());}
13110b57cec5SDimitry Andric
13120b57cec5SDimitry Andric    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
13130b57cec5SDimitry Andric    bool      empty() const _NOEXCEPT {return __table_.size() == 0;}
13140b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13150b57cec5SDimitry Andric    size_type size() const _NOEXCEPT  {return __table_.size();}
13160b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13170b57cec5SDimitry Andric    size_type max_size() const _NOEXCEPT {return __table_.max_size();}
13180b57cec5SDimitry Andric
13190b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13200b57cec5SDimitry Andric    iterator       begin() _NOEXCEPT        {return __table_.begin();}
13210b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13220b57cec5SDimitry Andric    iterator       end() _NOEXCEPT          {return __table_.end();}
13230b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13240b57cec5SDimitry Andric    const_iterator begin()  const _NOEXCEPT {return __table_.begin();}
13250b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13260b57cec5SDimitry Andric    const_iterator end()    const _NOEXCEPT {return __table_.end();}
13270b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13280b57cec5SDimitry Andric    const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
13290b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13300b57cec5SDimitry Andric    const_iterator cend()   const _NOEXCEPT {return __table_.end();}
13310b57cec5SDimitry Andric
13320b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
13330b57cec5SDimitry Andric    template <class... _Args>
13340b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
13350b57cec5SDimitry Andric        iterator emplace(_Args&&... __args)
13360b57cec5SDimitry Andric            {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
13370b57cec5SDimitry Andric    template <class... _Args>
13380b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
13390b57cec5SDimitry Andric        iterator emplace_hint(const_iterator __p, _Args&&... __args)
13400b57cec5SDimitry Andric            {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
13410b57cec5SDimitry Andric
13420b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13430b57cec5SDimitry Andric    iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
13440b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13450b57cec5SDimitry Andric    iterator insert(const_iterator __p, value_type&& __x)
13460b57cec5SDimitry Andric        {return __table_.__insert_multi(__p, _VSTD::move(__x));}
13470b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13480b57cec5SDimitry Andric    void insert(initializer_list<value_type> __il)
13490b57cec5SDimitry Andric        {insert(__il.begin(), __il.end());}
13500b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
13510b57cec5SDimitry Andric
13520b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13530b57cec5SDimitry Andric    iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
13540b57cec5SDimitry Andric
13550b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13560b57cec5SDimitry Andric    iterator insert(const_iterator __p, const value_type& __x)
13570b57cec5SDimitry Andric        {return __table_.__insert_multi(__p, __x);}
13580b57cec5SDimitry Andric
13590b57cec5SDimitry Andric    template <class _InputIterator>
13600b57cec5SDimitry Andric        _LIBCPP_INLINE_VISIBILITY
13610b57cec5SDimitry Andric        void insert(_InputIterator __first, _InputIterator __last);
13620b57cec5SDimitry Andric
13630b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 14
13640b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13650b57cec5SDimitry Andric    iterator insert(node_type&& __nh)
13660b57cec5SDimitry Andric    {
13670b57cec5SDimitry Andric        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
13680b57cec5SDimitry Andric            "node_type with incompatible allocator passed to unordered_multiset::insert()");
13690b57cec5SDimitry Andric        return __table_.template __node_handle_insert_multi<node_type>(
13700b57cec5SDimitry Andric            _VSTD::move(__nh));
13710b57cec5SDimitry Andric    }
13720b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13730b57cec5SDimitry Andric    iterator insert(const_iterator __hint, node_type&& __nh)
13740b57cec5SDimitry Andric    {
13750b57cec5SDimitry Andric        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
13760b57cec5SDimitry Andric            "node_type with incompatible allocator passed to unordered_multiset::insert()");
13770b57cec5SDimitry Andric        return __table_.template __node_handle_insert_multi<node_type>(
13780b57cec5SDimitry Andric            __hint, _VSTD::move(__nh));
13790b57cec5SDimitry Andric    }
13800b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13810b57cec5SDimitry Andric    node_type extract(const_iterator __position)
13820b57cec5SDimitry Andric    {
13830b57cec5SDimitry Andric        return __table_.template __node_handle_extract<node_type>(
13840b57cec5SDimitry Andric            __position);
13850b57cec5SDimitry Andric    }
13860b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13870b57cec5SDimitry Andric    node_type extract(key_type const& __key)
13880b57cec5SDimitry Andric    {
13890b57cec5SDimitry Andric        return __table_.template __node_handle_extract<node_type>(__key);
13900b57cec5SDimitry Andric    }
13910b57cec5SDimitry Andric
13920b57cec5SDimitry Andric    template <class _H2, class _P2>
13930b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
13940b57cec5SDimitry Andric    void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)
13950b57cec5SDimitry Andric    {
13960b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
13970b57cec5SDimitry Andric                       "merging container with incompatible allocator");
13980b57cec5SDimitry Andric        return __table_.__node_handle_merge_multi(__source.__table_);
13990b57cec5SDimitry Andric    }
14000b57cec5SDimitry Andric    template <class _H2, class _P2>
14010b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14020b57cec5SDimitry Andric    void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)
14030b57cec5SDimitry Andric    {
14040b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
14050b57cec5SDimitry Andric                       "merging container with incompatible allocator");
14060b57cec5SDimitry Andric        return __table_.__node_handle_merge_multi(__source.__table_);
14070b57cec5SDimitry Andric    }
14080b57cec5SDimitry Andric    template <class _H2, class _P2>
14090b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14100b57cec5SDimitry Andric    void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)
14110b57cec5SDimitry Andric    {
14120b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
14130b57cec5SDimitry Andric                       "merging container with incompatible allocator");
14140b57cec5SDimitry Andric        return __table_.__node_handle_merge_multi(__source.__table_);
14150b57cec5SDimitry Andric    }
14160b57cec5SDimitry Andric    template <class _H2, class _P2>
14170b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14180b57cec5SDimitry Andric    void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)
14190b57cec5SDimitry Andric    {
14200b57cec5SDimitry Andric        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
14210b57cec5SDimitry Andric                       "merging container with incompatible allocator");
14220b57cec5SDimitry Andric        return __table_.__node_handle_merge_multi(__source.__table_);
14230b57cec5SDimitry Andric    }
14240b57cec5SDimitry Andric#endif
14250b57cec5SDimitry Andric
14260b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14270b57cec5SDimitry Andric    iterator erase(const_iterator __p) {return __table_.erase(__p);}
14280b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14290b57cec5SDimitry Andric    size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
14300b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14310b57cec5SDimitry Andric    iterator erase(const_iterator __first, const_iterator __last)
14320b57cec5SDimitry Andric        {return __table_.erase(__first, __last);}
14330b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14340b57cec5SDimitry Andric    void clear() _NOEXCEPT {__table_.clear();}
14350b57cec5SDimitry Andric
14360b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14370b57cec5SDimitry Andric    void swap(unordered_multiset& __u)
14380b57cec5SDimitry Andric        _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
14390b57cec5SDimitry Andric        {__table_.swap(__u.__table_);}
14400b57cec5SDimitry Andric
14410b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14420b57cec5SDimitry Andric    hasher hash_function() const {return __table_.hash_function();}
14430b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14440b57cec5SDimitry Andric    key_equal key_eq() const {return __table_.key_eq();}
14450b57cec5SDimitry Andric
14460b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14470b57cec5SDimitry Andric    iterator       find(const key_type& __k)       {return __table_.find(__k);}
14480b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14490b57cec5SDimitry Andric    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
1450e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
1451*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1452e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1453*349cc55cSDimitry Andric    iterator       find(const _K2& __k)            {return __table_.find(__k);}
1454*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1455e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1456*349cc55cSDimitry Andric    const_iterator find(const _K2& __k) const      {return __table_.find(__k);}
1457e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
1458*349cc55cSDimitry Andric
14590b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14600b57cec5SDimitry Andric    size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
14610b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17
1462*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1463e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1464*349cc55cSDimitry Andric    size_type count(const _K2& __k) const      {return __table_.__count_multi(__k);}
1465e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
1466*349cc55cSDimitry Andric
1467e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
14680b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14690b57cec5SDimitry Andric    bool contains(const key_type& __k) const {return find(__k) != end();}
1470e8d8bef9SDimitry Andric
1471*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1472e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1473*349cc55cSDimitry Andric    bool contains(const _K2& __k) const      {return find(__k) != end();}
14740b57cec5SDimitry Andric#endif // _LIBCPP_STD_VER > 17
1475*349cc55cSDimitry Andric
14760b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14770b57cec5SDimitry Andric    pair<iterator, iterator>             equal_range(const key_type& __k)
14780b57cec5SDimitry Andric        {return __table_.__equal_range_multi(__k);}
14790b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14800b57cec5SDimitry Andric    pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
14810b57cec5SDimitry Andric        {return __table_.__equal_range_multi(__k);}
1482e8d8bef9SDimitry Andric#if _LIBCPP_STD_VER > 17
1483*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1484e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1485*349cc55cSDimitry Andric    pair<iterator, iterator>             equal_range(const _K2& __k)
1486*349cc55cSDimitry Andric        {return __table_.__equal_range_multi(__k);}
1487*349cc55cSDimitry Andric    template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
1488e8d8bef9SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
1489*349cc55cSDimitry Andric    pair<const_iterator, const_iterator> equal_range(const _K2& __k) const
1490*349cc55cSDimitry Andric        {return __table_.__equal_range_multi(__k);}
1491e8d8bef9SDimitry Andric#endif // _LIBCPP_STD_VER > 17
14920b57cec5SDimitry Andric
14930b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14940b57cec5SDimitry Andric    size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
14950b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14960b57cec5SDimitry Andric    size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
14970b57cec5SDimitry Andric
14980b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
14990b57cec5SDimitry Andric    size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
15000b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15010b57cec5SDimitry Andric    size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
15020b57cec5SDimitry Andric
15030b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15040b57cec5SDimitry Andric    local_iterator       begin(size_type __n)        {return __table_.begin(__n);}
15050b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15060b57cec5SDimitry Andric    local_iterator       end(size_type __n)          {return __table_.end(__n);}
15070b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15080b57cec5SDimitry Andric    const_local_iterator begin(size_type __n) const  {return __table_.cbegin(__n);}
15090b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15100b57cec5SDimitry Andric    const_local_iterator end(size_type __n) const    {return __table_.cend(__n);}
15110b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15120b57cec5SDimitry Andric    const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
15130b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15140b57cec5SDimitry Andric    const_local_iterator cend(size_type __n) const   {return __table_.cend(__n);}
15150b57cec5SDimitry Andric
15160b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15170b57cec5SDimitry Andric    float load_factor() const _NOEXCEPT {return __table_.load_factor();}
15180b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15190b57cec5SDimitry Andric    float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
15200b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15210b57cec5SDimitry Andric    void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
15220b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15230b57cec5SDimitry Andric    void rehash(size_type __n) {__table_.rehash(__n);}
15240b57cec5SDimitry Andric    _LIBCPP_INLINE_VISIBILITY
15250b57cec5SDimitry Andric    void reserve(size_type __n) {__table_.reserve(__n);}
15260b57cec5SDimitry Andric
1527e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
15280b57cec5SDimitry Andric
15290b57cec5SDimitry Andric    bool __dereferenceable(const const_iterator* __i) const
15300b57cec5SDimitry Andric        {return __table_.__dereferenceable(__i);}
15310b57cec5SDimitry Andric    bool __decrementable(const const_iterator* __i) const
15320b57cec5SDimitry Andric        {return __table_.__decrementable(__i);}
15330b57cec5SDimitry Andric    bool __addable(const const_iterator* __i, ptrdiff_t __n) const
15340b57cec5SDimitry Andric        {return __table_.__addable(__i, __n);}
15350b57cec5SDimitry Andric    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
15360b57cec5SDimitry Andric        {return __table_.__addable(__i, __n);}
15370b57cec5SDimitry Andric
1538e8d8bef9SDimitry Andric#endif // _LIBCPP_DEBUG_LEVEL == 2
15390b57cec5SDimitry Andric
15400b57cec5SDimitry Andric};
15410b57cec5SDimitry Andric
1542*349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17
15430b57cec5SDimitry Andrictemplate<class _InputIterator,
15440b57cec5SDimitry Andric         class _Hash = hash<__iter_value_type<_InputIterator>>,
15450b57cec5SDimitry Andric         class _Pred = equal_to<__iter_value_type<_InputIterator>>,
15460b57cec5SDimitry Andric         class _Allocator = allocator<__iter_value_type<_InputIterator>>,
1547*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
1548*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
1549*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
1550*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Pred>::value>,
1551*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15520b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
15530b57cec5SDimitry Andric              _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
15540b57cec5SDimitry Andric  -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
15550b57cec5SDimitry Andric
15560b57cec5SDimitry Andrictemplate<class _Tp, class _Hash = hash<_Tp>,
15570b57cec5SDimitry Andric         class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
1558*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
1559*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
1560*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Pred>::value>,
1561*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15620b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
15630b57cec5SDimitry Andric              _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
15640b57cec5SDimitry Andric  -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
15650b57cec5SDimitry Andric
15660b57cec5SDimitry Andrictemplate<class _InputIterator, class _Allocator,
1567*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
1568*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15690b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
15700b57cec5SDimitry Andric  -> unordered_multiset<__iter_value_type<_InputIterator>,
15710b57cec5SDimitry Andric                   hash<__iter_value_type<_InputIterator>>,
15720b57cec5SDimitry Andric                   equal_to<__iter_value_type<_InputIterator>>,
15730b57cec5SDimitry Andric                   _Allocator>;
15740b57cec5SDimitry Andric
15750b57cec5SDimitry Andrictemplate<class _InputIterator, class _Hash, class _Allocator,
1576*349cc55cSDimitry Andric         class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
1577*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
1578*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
1579*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15800b57cec5SDimitry Andricunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
15810b57cec5SDimitry Andric              _Hash, _Allocator)
15820b57cec5SDimitry Andric  -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
15830b57cec5SDimitry Andric                   equal_to<__iter_value_type<_InputIterator>>,
15840b57cec5SDimitry Andric                   _Allocator>;
15850b57cec5SDimitry Andric
15860b57cec5SDimitry Andrictemplate<class _Tp, class _Allocator,
1587*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15880b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
15890b57cec5SDimitry Andric  -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
15900b57cec5SDimitry Andric
15910b57cec5SDimitry Andrictemplate<class _Tp, class _Hash, class _Allocator,
1592*349cc55cSDimitry Andric         class = enable_if_t<!__is_allocator<_Hash>::value>,
1593*349cc55cSDimitry Andric         class = enable_if_t<!is_integral<_Hash>::value>,
1594*349cc55cSDimitry Andric         class = enable_if_t<__is_allocator<_Allocator>::value>>
15950b57cec5SDimitry Andricunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
15960b57cec5SDimitry Andric  -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
15970b57cec5SDimitry Andric#endif
15980b57cec5SDimitry Andric
15990b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16000b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16010b57cec5SDimitry Andric        size_type __n, const hasher& __hf, const key_equal& __eql)
16020b57cec5SDimitry Andric    : __table_(__hf, __eql)
16030b57cec5SDimitry Andric{
1604e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16050b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16060b57cec5SDimitry Andric#endif
16070b57cec5SDimitry Andric    __table_.rehash(__n);
16080b57cec5SDimitry Andric}
16090b57cec5SDimitry Andric
16100b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16110b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16120b57cec5SDimitry Andric        size_type __n, const hasher& __hf, const key_equal& __eql,
16130b57cec5SDimitry Andric        const allocator_type& __a)
16140b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
16150b57cec5SDimitry Andric{
1616e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16170b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16180b57cec5SDimitry Andric#endif
16190b57cec5SDimitry Andric    __table_.rehash(__n);
16200b57cec5SDimitry Andric}
16210b57cec5SDimitry Andric
16220b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16230b57cec5SDimitry Andrictemplate <class _InputIterator>
16240b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16250b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last)
16260b57cec5SDimitry Andric{
1627e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16280b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16290b57cec5SDimitry Andric#endif
16300b57cec5SDimitry Andric    insert(__first, __last);
16310b57cec5SDimitry Andric}
16320b57cec5SDimitry Andric
16330b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16340b57cec5SDimitry Andrictemplate <class _InputIterator>
16350b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16360b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last, size_type __n,
16370b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql)
16380b57cec5SDimitry Andric    : __table_(__hf, __eql)
16390b57cec5SDimitry Andric{
1640e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16410b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16420b57cec5SDimitry Andric#endif
16430b57cec5SDimitry Andric    __table_.rehash(__n);
16440b57cec5SDimitry Andric    insert(__first, __last);
16450b57cec5SDimitry Andric}
16460b57cec5SDimitry Andric
16470b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16480b57cec5SDimitry Andrictemplate <class _InputIterator>
16490b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16500b57cec5SDimitry Andric        _InputIterator __first, _InputIterator __last, size_type __n,
16510b57cec5SDimitry Andric        const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
16520b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
16530b57cec5SDimitry Andric{
1654e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16550b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16560b57cec5SDimitry Andric#endif
16570b57cec5SDimitry Andric    __table_.rehash(__n);
16580b57cec5SDimitry Andric    insert(__first, __last);
16590b57cec5SDimitry Andric}
16600b57cec5SDimitry Andric
16610b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16620b57cec5SDimitry Andricinline
16630b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16640b57cec5SDimitry Andric        const allocator_type& __a)
16650b57cec5SDimitry Andric    : __table_(__a)
16660b57cec5SDimitry Andric{
1667e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16680b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16690b57cec5SDimitry Andric#endif
16700b57cec5SDimitry Andric}
16710b57cec5SDimitry Andric
16720b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16730b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16740b57cec5SDimitry Andric        const unordered_multiset& __u)
16750b57cec5SDimitry Andric    : __table_(__u.__table_)
16760b57cec5SDimitry Andric{
1677e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16780b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16790b57cec5SDimitry Andric#endif
16800b57cec5SDimitry Andric    __table_.rehash(__u.bucket_count());
16810b57cec5SDimitry Andric    insert(__u.begin(), __u.end());
16820b57cec5SDimitry Andric}
16830b57cec5SDimitry Andric
16840b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16850b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
16860b57cec5SDimitry Andric        const unordered_multiset& __u, const allocator_type& __a)
16870b57cec5SDimitry Andric    : __table_(__u.__table_, __a)
16880b57cec5SDimitry Andric{
1689e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
16900b57cec5SDimitry Andric    __get_db()->__insert_c(this);
16910b57cec5SDimitry Andric#endif
16920b57cec5SDimitry Andric    __table_.rehash(__u.bucket_count());
16930b57cec5SDimitry Andric    insert(__u.begin(), __u.end());
16940b57cec5SDimitry Andric}
16950b57cec5SDimitry Andric
16960b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
16970b57cec5SDimitry Andric
16980b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
16990b57cec5SDimitry Andricinline
17000b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17010b57cec5SDimitry Andric        unordered_multiset&& __u)
17020b57cec5SDimitry Andric    _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
17030b57cec5SDimitry Andric    : __table_(_VSTD::move(__u.__table_))
17040b57cec5SDimitry Andric{
1705e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17060b57cec5SDimitry Andric    __get_db()->__insert_c(this);
17070b57cec5SDimitry Andric    __get_db()->swap(this, &__u);
17080b57cec5SDimitry Andric#endif
17090b57cec5SDimitry Andric}
17100b57cec5SDimitry Andric
17110b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17120b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17130b57cec5SDimitry Andric        unordered_multiset&& __u, const allocator_type& __a)
17140b57cec5SDimitry Andric    : __table_(_VSTD::move(__u.__table_), __a)
17150b57cec5SDimitry Andric{
1716e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17170b57cec5SDimitry Andric    __get_db()->__insert_c(this);
17180b57cec5SDimitry Andric#endif
17190b57cec5SDimitry Andric    if (__a != __u.get_allocator())
17200b57cec5SDimitry Andric    {
17210b57cec5SDimitry Andric        iterator __i = __u.begin();
17220b57cec5SDimitry Andric        while (__u.size() != 0)
17230b57cec5SDimitry Andric            __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
17240b57cec5SDimitry Andric    }
1725e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17260b57cec5SDimitry Andric    else
17270b57cec5SDimitry Andric        __get_db()->swap(this, &__u);
17280b57cec5SDimitry Andric#endif
17290b57cec5SDimitry Andric}
17300b57cec5SDimitry Andric
17310b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17320b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17330b57cec5SDimitry Andric        initializer_list<value_type> __il)
17340b57cec5SDimitry Andric{
1735e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17360b57cec5SDimitry Andric    __get_db()->__insert_c(this);
17370b57cec5SDimitry Andric#endif
17380b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
17390b57cec5SDimitry Andric}
17400b57cec5SDimitry Andric
17410b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17420b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17430b57cec5SDimitry Andric        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
17440b57cec5SDimitry Andric        const key_equal& __eql)
17450b57cec5SDimitry Andric    : __table_(__hf, __eql)
17460b57cec5SDimitry Andric{
1747e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17480b57cec5SDimitry Andric    __get_db()->__insert_c(this);
17490b57cec5SDimitry Andric#endif
17500b57cec5SDimitry Andric    __table_.rehash(__n);
17510b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
17520b57cec5SDimitry Andric}
17530b57cec5SDimitry Andric
17540b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17550b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
17560b57cec5SDimitry Andric        initializer_list<value_type> __il, size_type __n, const hasher& __hf,
17570b57cec5SDimitry Andric        const key_equal& __eql, const allocator_type& __a)
17580b57cec5SDimitry Andric    : __table_(__hf, __eql, __a)
17590b57cec5SDimitry Andric{
1760e8d8bef9SDimitry Andric#if _LIBCPP_DEBUG_LEVEL == 2
17610b57cec5SDimitry Andric    __get_db()->__insert_c(this);
17620b57cec5SDimitry Andric#endif
17630b57cec5SDimitry Andric    __table_.rehash(__n);
17640b57cec5SDimitry Andric    insert(__il.begin(), __il.end());
17650b57cec5SDimitry Andric}
17660b57cec5SDimitry Andric
17670b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17680b57cec5SDimitry Andricinline
17690b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>&
17700b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
17710b57cec5SDimitry Andric        unordered_multiset&& __u)
17720b57cec5SDimitry Andric    _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
17730b57cec5SDimitry Andric{
17740b57cec5SDimitry Andric    __table_ = _VSTD::move(__u.__table_);
17750b57cec5SDimitry Andric    return *this;
17760b57cec5SDimitry Andric}
17770b57cec5SDimitry Andric
17780b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17790b57cec5SDimitry Andricinline
17800b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>&
17810b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
17820b57cec5SDimitry Andric        initializer_list<value_type> __il)
17830b57cec5SDimitry Andric{
17840b57cec5SDimitry Andric    __table_.__assign_multi(__il.begin(), __il.end());
17850b57cec5SDimitry Andric    return *this;
17860b57cec5SDimitry Andric}
17870b57cec5SDimitry Andric
17880b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
17890b57cec5SDimitry Andric
17900b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
17910b57cec5SDimitry Andrictemplate <class _InputIterator>
17920b57cec5SDimitry Andricinline
17930b57cec5SDimitry Andricvoid
17940b57cec5SDimitry Andricunordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
17950b57cec5SDimitry Andric                                                         _InputIterator __last)
17960b57cec5SDimitry Andric{
17970b57cec5SDimitry Andric    for (; __first != __last; ++__first)
17980b57cec5SDimitry Andric        __table_.__insert_multi(*__first);
17990b57cec5SDimitry Andric}
18000b57cec5SDimitry Andric
18010b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
18020b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
18030b57cec5SDimitry Andricvoid
18040b57cec5SDimitry Andricswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
18050b57cec5SDimitry Andric     unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
18060b57cec5SDimitry Andric    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
18070b57cec5SDimitry Andric{
18080b57cec5SDimitry Andric    __x.swap(__y);
18090b57cec5SDimitry Andric}
18100b57cec5SDimitry Andric
18110b57cec5SDimitry Andric#if _LIBCPP_STD_VER > 17
18125ffd83dbSDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc,
18135ffd83dbSDimitry Andric          class _Predicate>
18140b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
18155ffd83dbSDimitry Andric    typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type
18165ffd83dbSDimitry Andric    erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c,
18175ffd83dbSDimitry Andric             _Predicate __pred) {
1818fe6060f1SDimitry Andric  return _VSTD::__libcpp_erase_if_container(__c, __pred);
18195ffd83dbSDimitry Andric}
18200b57cec5SDimitry Andric#endif
18210b57cec5SDimitry Andric
18220b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
18230b57cec5SDimitry Andricbool
18240b57cec5SDimitry Andricoperator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
18250b57cec5SDimitry Andric           const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
18260b57cec5SDimitry Andric{
18270b57cec5SDimitry Andric    if (__x.size() != __y.size())
18280b57cec5SDimitry Andric        return false;
18290b57cec5SDimitry Andric    typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
18300b57cec5SDimitry Andric                                                                 const_iterator;
18310b57cec5SDimitry Andric    typedef pair<const_iterator, const_iterator> _EqRng;
18320b57cec5SDimitry Andric    for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
18330b57cec5SDimitry Andric    {
18340b57cec5SDimitry Andric        _EqRng __xeq = __x.equal_range(*__i);
18350b57cec5SDimitry Andric        _EqRng __yeq = __y.equal_range(*__i);
18360b57cec5SDimitry Andric        if (_VSTD::distance(__xeq.first, __xeq.second) !=
18370b57cec5SDimitry Andric            _VSTD::distance(__yeq.first, __yeq.second) ||
18380b57cec5SDimitry Andric                  !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
18390b57cec5SDimitry Andric            return false;
18400b57cec5SDimitry Andric        __i = __xeq.second;
18410b57cec5SDimitry Andric    }
18420b57cec5SDimitry Andric    return true;
18430b57cec5SDimitry Andric}
18440b57cec5SDimitry Andric
18450b57cec5SDimitry Andrictemplate <class _Value, class _Hash, class _Pred, class _Alloc>
18460b57cec5SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY
18470b57cec5SDimitry Andricbool
18480b57cec5SDimitry Andricoperator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
18490b57cec5SDimitry Andric           const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
18500b57cec5SDimitry Andric{
18510b57cec5SDimitry Andric    return !(__x == __y);
18520b57cec5SDimitry Andric}
18530b57cec5SDimitry Andric
18540b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD
18550b57cec5SDimitry Andric
18560b57cec5SDimitry Andric#endif // _LIBCPP_UNORDERED_SET
1857