1*4d6fc14bSjoerg// -*- C++ -*- 2*4d6fc14bSjoerg//===-------------------------- unordered_set -----------------------------===// 3*4d6fc14bSjoerg// 4*4d6fc14bSjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*4d6fc14bSjoerg// See https://llvm.org/LICENSE.txt for license information. 6*4d6fc14bSjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*4d6fc14bSjoerg// 8*4d6fc14bSjoerg//===----------------------------------------------------------------------===// 9*4d6fc14bSjoerg 10*4d6fc14bSjoerg#ifndef _LIBCPP_UNORDERED_SET 11*4d6fc14bSjoerg#define _LIBCPP_UNORDERED_SET 12*4d6fc14bSjoerg 13*4d6fc14bSjoerg/* 14*4d6fc14bSjoerg 15*4d6fc14bSjoerg unordered_set synopsis 16*4d6fc14bSjoerg 17*4d6fc14bSjoerg#include <initializer_list> 18*4d6fc14bSjoerg 19*4d6fc14bSjoergnamespace std 20*4d6fc14bSjoerg{ 21*4d6fc14bSjoerg 22*4d6fc14bSjoergtemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 23*4d6fc14bSjoerg class Alloc = allocator<Value>> 24*4d6fc14bSjoergclass unordered_set 25*4d6fc14bSjoerg{ 26*4d6fc14bSjoergpublic: 27*4d6fc14bSjoerg // types 28*4d6fc14bSjoerg typedef Value key_type; 29*4d6fc14bSjoerg typedef key_type value_type; 30*4d6fc14bSjoerg typedef Hash hasher; 31*4d6fc14bSjoerg typedef Pred key_equal; 32*4d6fc14bSjoerg typedef Alloc allocator_type; 33*4d6fc14bSjoerg typedef value_type& reference; 34*4d6fc14bSjoerg typedef const value_type& const_reference; 35*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::pointer pointer; 36*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 37*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::size_type size_type; 38*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::difference_type difference_type; 39*4d6fc14bSjoerg 40*4d6fc14bSjoerg typedef /unspecified/ iterator; 41*4d6fc14bSjoerg typedef /unspecified/ const_iterator; 42*4d6fc14bSjoerg typedef /unspecified/ local_iterator; 43*4d6fc14bSjoerg typedef /unspecified/ const_local_iterator; 44*4d6fc14bSjoerg 45*4d6fc14bSjoerg typedef unspecified node_type unspecified; // C++17 46*4d6fc14bSjoerg typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 47*4d6fc14bSjoerg 48*4d6fc14bSjoerg unordered_set() 49*4d6fc14bSjoerg noexcept( 50*4d6fc14bSjoerg is_nothrow_default_constructible<hasher>::value && 51*4d6fc14bSjoerg is_nothrow_default_constructible<key_equal>::value && 52*4d6fc14bSjoerg is_nothrow_default_constructible<allocator_type>::value); 53*4d6fc14bSjoerg explicit unordered_set(size_type n, const hasher& hf = hasher(), 54*4d6fc14bSjoerg const key_equal& eql = key_equal(), 55*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 56*4d6fc14bSjoerg template <class InputIterator> 57*4d6fc14bSjoerg unordered_set(InputIterator f, InputIterator l, 58*4d6fc14bSjoerg size_type n = 0, const hasher& hf = hasher(), 59*4d6fc14bSjoerg const key_equal& eql = key_equal(), 60*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 61*4d6fc14bSjoerg explicit unordered_set(const allocator_type&); 62*4d6fc14bSjoerg unordered_set(const unordered_set&); 63*4d6fc14bSjoerg unordered_set(const unordered_set&, const Allocator&); 64*4d6fc14bSjoerg unordered_set(unordered_set&&) 65*4d6fc14bSjoerg noexcept( 66*4d6fc14bSjoerg is_nothrow_move_constructible<hasher>::value && 67*4d6fc14bSjoerg is_nothrow_move_constructible<key_equal>::value && 68*4d6fc14bSjoerg is_nothrow_move_constructible<allocator_type>::value); 69*4d6fc14bSjoerg unordered_set(unordered_set&&, const Allocator&); 70*4d6fc14bSjoerg unordered_set(initializer_list<value_type>, size_type n = 0, 71*4d6fc14bSjoerg const hasher& hf = hasher(), const key_equal& eql = key_equal(), 72*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 73*4d6fc14bSjoerg unordered_set(size_type n, const allocator_type& a); // C++14 74*4d6fc14bSjoerg unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14 75*4d6fc14bSjoerg template <class InputIterator> 76*4d6fc14bSjoerg unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 77*4d6fc14bSjoerg template <class InputIterator> 78*4d6fc14bSjoerg unordered_set(InputIterator f, InputIterator l, size_type n, 79*4d6fc14bSjoerg const hasher& hf, const allocator_type& a); // C++14 80*4d6fc14bSjoerg unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 81*4d6fc14bSjoerg unordered_set(initializer_list<value_type> il, size_type n, 82*4d6fc14bSjoerg const hasher& hf, const allocator_type& a); // C++14 83*4d6fc14bSjoerg ~unordered_set(); 84*4d6fc14bSjoerg unordered_set& operator=(const unordered_set&); 85*4d6fc14bSjoerg unordered_set& operator=(unordered_set&&) 86*4d6fc14bSjoerg noexcept( 87*4d6fc14bSjoerg allocator_type::propagate_on_container_move_assignment::value && 88*4d6fc14bSjoerg is_nothrow_move_assignable<allocator_type>::value && 89*4d6fc14bSjoerg is_nothrow_move_assignable<hasher>::value && 90*4d6fc14bSjoerg is_nothrow_move_assignable<key_equal>::value); 91*4d6fc14bSjoerg unordered_set& operator=(initializer_list<value_type>); 92*4d6fc14bSjoerg 93*4d6fc14bSjoerg allocator_type get_allocator() const noexcept; 94*4d6fc14bSjoerg 95*4d6fc14bSjoerg bool empty() const noexcept; 96*4d6fc14bSjoerg size_type size() const noexcept; 97*4d6fc14bSjoerg size_type max_size() const noexcept; 98*4d6fc14bSjoerg 99*4d6fc14bSjoerg iterator begin() noexcept; 100*4d6fc14bSjoerg iterator end() noexcept; 101*4d6fc14bSjoerg const_iterator begin() const noexcept; 102*4d6fc14bSjoerg const_iterator end() const noexcept; 103*4d6fc14bSjoerg const_iterator cbegin() const noexcept; 104*4d6fc14bSjoerg const_iterator cend() const noexcept; 105*4d6fc14bSjoerg 106*4d6fc14bSjoerg template <class... Args> 107*4d6fc14bSjoerg pair<iterator, bool> emplace(Args&&... args); 108*4d6fc14bSjoerg template <class... Args> 109*4d6fc14bSjoerg iterator emplace_hint(const_iterator position, Args&&... args); 110*4d6fc14bSjoerg pair<iterator, bool> insert(const value_type& obj); 111*4d6fc14bSjoerg pair<iterator, bool> insert(value_type&& obj); 112*4d6fc14bSjoerg iterator insert(const_iterator hint, const value_type& obj); 113*4d6fc14bSjoerg iterator insert(const_iterator hint, value_type&& obj); 114*4d6fc14bSjoerg template <class InputIterator> 115*4d6fc14bSjoerg void insert(InputIterator first, InputIterator last); 116*4d6fc14bSjoerg void insert(initializer_list<value_type>); 117*4d6fc14bSjoerg 118*4d6fc14bSjoerg node_type extract(const_iterator position); // C++17 119*4d6fc14bSjoerg node_type extract(const key_type& x); // C++17 120*4d6fc14bSjoerg insert_return_type insert(node_type&& nh); // C++17 121*4d6fc14bSjoerg iterator insert(const_iterator hint, node_type&& nh); // C++17 122*4d6fc14bSjoerg 123*4d6fc14bSjoerg iterator erase(const_iterator position); 124*4d6fc14bSjoerg iterator erase(iterator position); // C++14 125*4d6fc14bSjoerg size_type erase(const key_type& k); 126*4d6fc14bSjoerg iterator erase(const_iterator first, const_iterator last); 127*4d6fc14bSjoerg void clear() noexcept; 128*4d6fc14bSjoerg 129*4d6fc14bSjoerg template<class H2, class P2> 130*4d6fc14bSjoerg void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 131*4d6fc14bSjoerg template<class H2, class P2> 132*4d6fc14bSjoerg void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 133*4d6fc14bSjoerg template<class H2, class P2> 134*4d6fc14bSjoerg void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 135*4d6fc14bSjoerg template<class H2, class P2> 136*4d6fc14bSjoerg void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 137*4d6fc14bSjoerg 138*4d6fc14bSjoerg void swap(unordered_set&) 139*4d6fc14bSjoerg noexcept(allocator_traits<Allocator>::is_always_equal::value && 140*4d6fc14bSjoerg noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 141*4d6fc14bSjoerg noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 142*4d6fc14bSjoerg 143*4d6fc14bSjoerg hasher hash_function() const; 144*4d6fc14bSjoerg key_equal key_eq() const; 145*4d6fc14bSjoerg 146*4d6fc14bSjoerg iterator find(const key_type& k); 147*4d6fc14bSjoerg const_iterator find(const key_type& k) const; 148*4d6fc14bSjoerg template<typename K> 149*4d6fc14bSjoerg iterator find(const K& x); // C++20 150*4d6fc14bSjoerg template<typename K> 151*4d6fc14bSjoerg const_iterator find(const K& x) const; // C++20 152*4d6fc14bSjoerg size_type count(const key_type& k) const; 153*4d6fc14bSjoerg template<typename K> 154*4d6fc14bSjoerg size_type count(const K& k) const; // C++20 155*4d6fc14bSjoerg bool contains(const key_type& k) const; // C++20 156*4d6fc14bSjoerg template<typename K> 157*4d6fc14bSjoerg bool contains(const K& k) const; // C++20 158*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const key_type& k); 159*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 160*4d6fc14bSjoerg template<typename K> 161*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const K& k); // C++20 162*4d6fc14bSjoerg template<typename K> 163*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 164*4d6fc14bSjoerg 165*4d6fc14bSjoerg size_type bucket_count() const noexcept; 166*4d6fc14bSjoerg size_type max_bucket_count() const noexcept; 167*4d6fc14bSjoerg 168*4d6fc14bSjoerg size_type bucket_size(size_type n) const; 169*4d6fc14bSjoerg size_type bucket(const key_type& k) const; 170*4d6fc14bSjoerg 171*4d6fc14bSjoerg local_iterator begin(size_type n); 172*4d6fc14bSjoerg local_iterator end(size_type n); 173*4d6fc14bSjoerg const_local_iterator begin(size_type n) const; 174*4d6fc14bSjoerg const_local_iterator end(size_type n) const; 175*4d6fc14bSjoerg const_local_iterator cbegin(size_type n) const; 176*4d6fc14bSjoerg const_local_iterator cend(size_type n) const; 177*4d6fc14bSjoerg 178*4d6fc14bSjoerg float load_factor() const noexcept; 179*4d6fc14bSjoerg float max_load_factor() const noexcept; 180*4d6fc14bSjoerg void max_load_factor(float z); 181*4d6fc14bSjoerg void rehash(size_type n); 182*4d6fc14bSjoerg void reserve(size_type n); 183*4d6fc14bSjoerg}; 184*4d6fc14bSjoerg 185*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 186*4d6fc14bSjoerg void swap(unordered_set<Value, Hash, Pred, Alloc>& x, 187*4d6fc14bSjoerg unordered_set<Value, Hash, Pred, Alloc>& y) 188*4d6fc14bSjoerg noexcept(noexcept(x.swap(y))); 189*4d6fc14bSjoerg 190*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 191*4d6fc14bSjoerg bool 192*4d6fc14bSjoerg operator==(const unordered_set<Value, Hash, Pred, Alloc>& x, 193*4d6fc14bSjoerg const unordered_set<Value, Hash, Pred, Alloc>& y); 194*4d6fc14bSjoerg 195*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 196*4d6fc14bSjoerg bool 197*4d6fc14bSjoerg operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x, 198*4d6fc14bSjoerg const unordered_set<Value, Hash, Pred, Alloc>& y); 199*4d6fc14bSjoerg 200*4d6fc14bSjoergtemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 201*4d6fc14bSjoerg class Alloc = allocator<Value>> 202*4d6fc14bSjoergclass unordered_multiset 203*4d6fc14bSjoerg{ 204*4d6fc14bSjoergpublic: 205*4d6fc14bSjoerg // types 206*4d6fc14bSjoerg typedef Value key_type; 207*4d6fc14bSjoerg typedef key_type value_type; 208*4d6fc14bSjoerg typedef Hash hasher; 209*4d6fc14bSjoerg typedef Pred key_equal; 210*4d6fc14bSjoerg typedef Alloc allocator_type; 211*4d6fc14bSjoerg typedef value_type& reference; 212*4d6fc14bSjoerg typedef const value_type& const_reference; 213*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::pointer pointer; 214*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 215*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::size_type size_type; 216*4d6fc14bSjoerg typedef typename allocator_traits<allocator_type>::difference_type difference_type; 217*4d6fc14bSjoerg 218*4d6fc14bSjoerg typedef /unspecified/ iterator; 219*4d6fc14bSjoerg typedef /unspecified/ const_iterator; 220*4d6fc14bSjoerg typedef /unspecified/ local_iterator; 221*4d6fc14bSjoerg typedef /unspecified/ const_local_iterator; 222*4d6fc14bSjoerg 223*4d6fc14bSjoerg typedef unspecified node_type unspecified; // C++17 224*4d6fc14bSjoerg 225*4d6fc14bSjoerg unordered_multiset() 226*4d6fc14bSjoerg noexcept( 227*4d6fc14bSjoerg is_nothrow_default_constructible<hasher>::value && 228*4d6fc14bSjoerg is_nothrow_default_constructible<key_equal>::value && 229*4d6fc14bSjoerg is_nothrow_default_constructible<allocator_type>::value); 230*4d6fc14bSjoerg explicit unordered_multiset(size_type n, const hasher& hf = hasher(), 231*4d6fc14bSjoerg const key_equal& eql = key_equal(), 232*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 233*4d6fc14bSjoerg template <class InputIterator> 234*4d6fc14bSjoerg unordered_multiset(InputIterator f, InputIterator l, 235*4d6fc14bSjoerg size_type n = 0, const hasher& hf = hasher(), 236*4d6fc14bSjoerg const key_equal& eql = key_equal(), 237*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 238*4d6fc14bSjoerg explicit unordered_multiset(const allocator_type&); 239*4d6fc14bSjoerg unordered_multiset(const unordered_multiset&); 240*4d6fc14bSjoerg unordered_multiset(const unordered_multiset&, const Allocator&); 241*4d6fc14bSjoerg unordered_multiset(unordered_multiset&&) 242*4d6fc14bSjoerg noexcept( 243*4d6fc14bSjoerg is_nothrow_move_constructible<hasher>::value && 244*4d6fc14bSjoerg is_nothrow_move_constructible<key_equal>::value && 245*4d6fc14bSjoerg is_nothrow_move_constructible<allocator_type>::value); 246*4d6fc14bSjoerg unordered_multiset(unordered_multiset&&, const Allocator&); 247*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type>, size_type n = /see below/, 248*4d6fc14bSjoerg const hasher& hf = hasher(), const key_equal& eql = key_equal(), 249*4d6fc14bSjoerg const allocator_type& a = allocator_type()); 250*4d6fc14bSjoerg unordered_multiset(size_type n, const allocator_type& a); // C++14 251*4d6fc14bSjoerg unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14 252*4d6fc14bSjoerg template <class InputIterator> 253*4d6fc14bSjoerg unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14 254*4d6fc14bSjoerg template <class InputIterator> 255*4d6fc14bSjoerg unordered_multiset(InputIterator f, InputIterator l, size_type n, 256*4d6fc14bSjoerg const hasher& hf, const allocator_type& a); // C++14 257*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14 258*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> il, size_type n, 259*4d6fc14bSjoerg const hasher& hf, const allocator_type& a); // C++14 260*4d6fc14bSjoerg ~unordered_multiset(); 261*4d6fc14bSjoerg unordered_multiset& operator=(const unordered_multiset&); 262*4d6fc14bSjoerg unordered_multiset& operator=(unordered_multiset&&) 263*4d6fc14bSjoerg noexcept( 264*4d6fc14bSjoerg allocator_type::propagate_on_container_move_assignment::value && 265*4d6fc14bSjoerg is_nothrow_move_assignable<allocator_type>::value && 266*4d6fc14bSjoerg is_nothrow_move_assignable<hasher>::value && 267*4d6fc14bSjoerg is_nothrow_move_assignable<key_equal>::value); 268*4d6fc14bSjoerg unordered_multiset& operator=(initializer_list<value_type>); 269*4d6fc14bSjoerg 270*4d6fc14bSjoerg allocator_type get_allocator() const noexcept; 271*4d6fc14bSjoerg 272*4d6fc14bSjoerg bool empty() const noexcept; 273*4d6fc14bSjoerg size_type size() const noexcept; 274*4d6fc14bSjoerg size_type max_size() const noexcept; 275*4d6fc14bSjoerg 276*4d6fc14bSjoerg iterator begin() noexcept; 277*4d6fc14bSjoerg iterator end() noexcept; 278*4d6fc14bSjoerg const_iterator begin() const noexcept; 279*4d6fc14bSjoerg const_iterator end() const noexcept; 280*4d6fc14bSjoerg const_iterator cbegin() const noexcept; 281*4d6fc14bSjoerg const_iterator cend() const noexcept; 282*4d6fc14bSjoerg 283*4d6fc14bSjoerg template <class... Args> 284*4d6fc14bSjoerg iterator emplace(Args&&... args); 285*4d6fc14bSjoerg template <class... Args> 286*4d6fc14bSjoerg iterator emplace_hint(const_iterator position, Args&&... args); 287*4d6fc14bSjoerg iterator insert(const value_type& obj); 288*4d6fc14bSjoerg iterator insert(value_type&& obj); 289*4d6fc14bSjoerg iterator insert(const_iterator hint, const value_type& obj); 290*4d6fc14bSjoerg iterator insert(const_iterator hint, value_type&& obj); 291*4d6fc14bSjoerg template <class InputIterator> 292*4d6fc14bSjoerg void insert(InputIterator first, InputIterator last); 293*4d6fc14bSjoerg void insert(initializer_list<value_type>); 294*4d6fc14bSjoerg 295*4d6fc14bSjoerg node_type extract(const_iterator position); // C++17 296*4d6fc14bSjoerg node_type extract(const key_type& x); // C++17 297*4d6fc14bSjoerg iterator insert(node_type&& nh); // C++17 298*4d6fc14bSjoerg iterator insert(const_iterator hint, node_type&& nh); // C++17 299*4d6fc14bSjoerg 300*4d6fc14bSjoerg iterator erase(const_iterator position); 301*4d6fc14bSjoerg iterator erase(iterator position); // C++14 302*4d6fc14bSjoerg size_type erase(const key_type& k); 303*4d6fc14bSjoerg iterator erase(const_iterator first, const_iterator last); 304*4d6fc14bSjoerg void clear() noexcept; 305*4d6fc14bSjoerg 306*4d6fc14bSjoerg template<class H2, class P2> 307*4d6fc14bSjoerg void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17 308*4d6fc14bSjoerg template<class H2, class P2> 309*4d6fc14bSjoerg void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17 310*4d6fc14bSjoerg template<class H2, class P2> 311*4d6fc14bSjoerg void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17 312*4d6fc14bSjoerg template<class H2, class P2> 313*4d6fc14bSjoerg void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17 314*4d6fc14bSjoerg 315*4d6fc14bSjoerg void swap(unordered_multiset&) 316*4d6fc14bSjoerg noexcept(allocator_traits<Allocator>::is_always_equal::value && 317*4d6fc14bSjoerg noexcept(swap(declval<hasher&>(), declval<hasher&>())) && 318*4d6fc14bSjoerg noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17 319*4d6fc14bSjoerg 320*4d6fc14bSjoerg hasher hash_function() const; 321*4d6fc14bSjoerg key_equal key_eq() const; 322*4d6fc14bSjoerg 323*4d6fc14bSjoerg iterator find(const key_type& k); 324*4d6fc14bSjoerg const_iterator find(const key_type& k) const; 325*4d6fc14bSjoerg template<typename K> 326*4d6fc14bSjoerg iterator find(const K& x); // C++20 327*4d6fc14bSjoerg template<typename K> 328*4d6fc14bSjoerg const_iterator find(const K& x) const; // C++20 329*4d6fc14bSjoerg size_type count(const key_type& k) const; 330*4d6fc14bSjoerg template<typename K> 331*4d6fc14bSjoerg size_type count(const K& k) const; // C++20 332*4d6fc14bSjoerg bool contains(const key_type& k) const; // C++20 333*4d6fc14bSjoerg template<typename K> 334*4d6fc14bSjoerg bool contains(const K& k) const; // C++20 335*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const key_type& k); 336*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 337*4d6fc14bSjoerg template<typename K> 338*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const K& k); // C++20 339*4d6fc14bSjoerg template<typename K> 340*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 341*4d6fc14bSjoerg 342*4d6fc14bSjoerg size_type bucket_count() const noexcept; 343*4d6fc14bSjoerg size_type max_bucket_count() const noexcept; 344*4d6fc14bSjoerg 345*4d6fc14bSjoerg size_type bucket_size(size_type n) const; 346*4d6fc14bSjoerg size_type bucket(const key_type& k) const; 347*4d6fc14bSjoerg 348*4d6fc14bSjoerg local_iterator begin(size_type n); 349*4d6fc14bSjoerg local_iterator end(size_type n); 350*4d6fc14bSjoerg const_local_iterator begin(size_type n) const; 351*4d6fc14bSjoerg const_local_iterator end(size_type n) const; 352*4d6fc14bSjoerg const_local_iterator cbegin(size_type n) const; 353*4d6fc14bSjoerg const_local_iterator cend(size_type n) const; 354*4d6fc14bSjoerg 355*4d6fc14bSjoerg float load_factor() const noexcept; 356*4d6fc14bSjoerg float max_load_factor() const noexcept; 357*4d6fc14bSjoerg void max_load_factor(float z); 358*4d6fc14bSjoerg void rehash(size_type n); 359*4d6fc14bSjoerg void reserve(size_type n); 360*4d6fc14bSjoerg}; 361*4d6fc14bSjoerg 362*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 363*4d6fc14bSjoerg void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, 364*4d6fc14bSjoerg unordered_multiset<Value, Hash, Pred, Alloc>& y) 365*4d6fc14bSjoerg noexcept(noexcept(x.swap(y))); 366*4d6fc14bSjoerg 367*4d6fc14bSjoergtemplate <class K, class T, class H, class P, class A, class Predicate> 368*4d6fc14bSjoerg typename unordered_set<K, T, H, P, A>::size_type 369*4d6fc14bSjoerg erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20 370*4d6fc14bSjoerg 371*4d6fc14bSjoergtemplate <class K, class T, class H, class P, class A, class Predicate> 372*4d6fc14bSjoerg typename unordered_multiset<K, T, H, P, A>::size_type 373*4d6fc14bSjoerg erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20 374*4d6fc14bSjoerg 375*4d6fc14bSjoerg 376*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 377*4d6fc14bSjoerg bool 378*4d6fc14bSjoerg operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 379*4d6fc14bSjoerg const unordered_multiset<Value, Hash, Pred, Alloc>& y); 380*4d6fc14bSjoerg 381*4d6fc14bSjoergtemplate <class Value, class Hash, class Pred, class Alloc> 382*4d6fc14bSjoerg bool 383*4d6fc14bSjoerg operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x, 384*4d6fc14bSjoerg const unordered_multiset<Value, Hash, Pred, Alloc>& y); 385*4d6fc14bSjoerg} // std 386*4d6fc14bSjoerg 387*4d6fc14bSjoerg*/ 388*4d6fc14bSjoerg 389*4d6fc14bSjoerg#include <__config> 390*4d6fc14bSjoerg#include <__hash_table> 391*4d6fc14bSjoerg#include <__node_handle> 392*4d6fc14bSjoerg#include <compare> 393*4d6fc14bSjoerg#include <functional> 394*4d6fc14bSjoerg#include <iterator> // __libcpp_erase_if_container 395*4d6fc14bSjoerg#include <version> 396*4d6fc14bSjoerg 397*4d6fc14bSjoerg#include <__debug> 398*4d6fc14bSjoerg 399*4d6fc14bSjoerg#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 400*4d6fc14bSjoerg#pragma GCC system_header 401*4d6fc14bSjoerg#endif 402*4d6fc14bSjoerg 403*4d6fc14bSjoerg_LIBCPP_BEGIN_NAMESPACE_STD 404*4d6fc14bSjoerg 405*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 406*4d6fc14bSjoergclass unordered_multiset; 407*4d6fc14bSjoerg 408*4d6fc14bSjoergtemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 409*4d6fc14bSjoerg class _Alloc = allocator<_Value> > 410*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS unordered_set 411*4d6fc14bSjoerg{ 412*4d6fc14bSjoergpublic: 413*4d6fc14bSjoerg // types 414*4d6fc14bSjoerg typedef _Value key_type; 415*4d6fc14bSjoerg typedef key_type value_type; 416*4d6fc14bSjoerg typedef __identity_t<_Hash> hasher; 417*4d6fc14bSjoerg typedef __identity_t<_Pred> key_equal; 418*4d6fc14bSjoerg typedef __identity_t<_Alloc> allocator_type; 419*4d6fc14bSjoerg typedef value_type& reference; 420*4d6fc14bSjoerg typedef const value_type& const_reference; 421*4d6fc14bSjoerg static_assert((is_same<value_type, typename allocator_type::value_type>::value), 422*4d6fc14bSjoerg "Invalid allocator::value_type"); 423*4d6fc14bSjoerg 424*4d6fc14bSjoergprivate: 425*4d6fc14bSjoerg typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 426*4d6fc14bSjoerg 427*4d6fc14bSjoerg __table __table_; 428*4d6fc14bSjoerg 429*4d6fc14bSjoergpublic: 430*4d6fc14bSjoerg typedef typename __table::pointer pointer; 431*4d6fc14bSjoerg typedef typename __table::const_pointer const_pointer; 432*4d6fc14bSjoerg typedef typename __table::size_type size_type; 433*4d6fc14bSjoerg typedef typename __table::difference_type difference_type; 434*4d6fc14bSjoerg 435*4d6fc14bSjoerg typedef typename __table::const_iterator iterator; 436*4d6fc14bSjoerg typedef typename __table::const_iterator const_iterator; 437*4d6fc14bSjoerg typedef typename __table::const_local_iterator local_iterator; 438*4d6fc14bSjoerg typedef typename __table::const_local_iterator const_local_iterator; 439*4d6fc14bSjoerg 440*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 441*4d6fc14bSjoerg typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 442*4d6fc14bSjoerg typedef __insert_return_type<iterator, node_type> insert_return_type; 443*4d6fc14bSjoerg#endif 444*4d6fc14bSjoerg 445*4d6fc14bSjoerg template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 446*4d6fc14bSjoerg friend class _LIBCPP_TEMPLATE_VIS unordered_set; 447*4d6fc14bSjoerg template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 448*4d6fc14bSjoerg friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 449*4d6fc14bSjoerg 450*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 451*4d6fc14bSjoerg unordered_set() 452*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 453*4d6fc14bSjoerg { 454*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 455*4d6fc14bSjoerg __get_db()->__insert_c(this); 456*4d6fc14bSjoerg#endif 457*4d6fc14bSjoerg } 458*4d6fc14bSjoerg explicit unordered_set(size_type __n, const hasher& __hf = hasher(), 459*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 460*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 461*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 462*4d6fc14bSjoerg unordered_set(size_type __n, const allocator_type& __a) 463*4d6fc14bSjoerg : unordered_set(__n, hasher(), key_equal(), __a) {} 464*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 465*4d6fc14bSjoerg unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) 466*4d6fc14bSjoerg : unordered_set(__n, __hf, key_equal(), __a) {} 467*4d6fc14bSjoerg#endif 468*4d6fc14bSjoerg unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, 469*4d6fc14bSjoerg const allocator_type& __a); 470*4d6fc14bSjoerg template <class _InputIterator> 471*4d6fc14bSjoerg unordered_set(_InputIterator __first, _InputIterator __last); 472*4d6fc14bSjoerg template <class _InputIterator> 473*4d6fc14bSjoerg unordered_set(_InputIterator __first, _InputIterator __last, 474*4d6fc14bSjoerg size_type __n, const hasher& __hf = hasher(), 475*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 476*4d6fc14bSjoerg template <class _InputIterator> 477*4d6fc14bSjoerg unordered_set(_InputIterator __first, _InputIterator __last, 478*4d6fc14bSjoerg size_type __n, const hasher& __hf, const key_equal& __eql, 479*4d6fc14bSjoerg const allocator_type& __a); 480*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 481*4d6fc14bSjoerg template <class _InputIterator> 482*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 483*4d6fc14bSjoerg unordered_set(_InputIterator __first, _InputIterator __last, 484*4d6fc14bSjoerg size_type __n, const allocator_type& __a) 485*4d6fc14bSjoerg : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} 486*4d6fc14bSjoerg template <class _InputIterator> 487*4d6fc14bSjoerg unordered_set(_InputIterator __first, _InputIterator __last, 488*4d6fc14bSjoerg size_type __n, const hasher& __hf, const allocator_type& __a) 489*4d6fc14bSjoerg : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} 490*4d6fc14bSjoerg#endif 491*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 492*4d6fc14bSjoerg explicit unordered_set(const allocator_type& __a); 493*4d6fc14bSjoerg unordered_set(const unordered_set& __u); 494*4d6fc14bSjoerg unordered_set(const unordered_set& __u, const allocator_type& __a); 495*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 496*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 497*4d6fc14bSjoerg unordered_set(unordered_set&& __u) 498*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 499*4d6fc14bSjoerg unordered_set(unordered_set&& __u, const allocator_type& __a); 500*4d6fc14bSjoerg unordered_set(initializer_list<value_type> __il); 501*4d6fc14bSjoerg unordered_set(initializer_list<value_type> __il, size_type __n, 502*4d6fc14bSjoerg const hasher& __hf = hasher(), 503*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 504*4d6fc14bSjoerg unordered_set(initializer_list<value_type> __il, size_type __n, 505*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql, 506*4d6fc14bSjoerg const allocator_type& __a); 507*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 508*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 509*4d6fc14bSjoerg unordered_set(initializer_list<value_type> __il, size_type __n, 510*4d6fc14bSjoerg const allocator_type& __a) 511*4d6fc14bSjoerg : unordered_set(__il, __n, hasher(), key_equal(), __a) {} 512*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 513*4d6fc14bSjoerg unordered_set(initializer_list<value_type> __il, size_type __n, 514*4d6fc14bSjoerg const hasher& __hf, const allocator_type& __a) 515*4d6fc14bSjoerg : unordered_set(__il, __n, __hf, key_equal(), __a) {} 516*4d6fc14bSjoerg#endif 517*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 518*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 519*4d6fc14bSjoerg ~unordered_set() { 520*4d6fc14bSjoerg static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 521*4d6fc14bSjoerg } 522*4d6fc14bSjoerg 523*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 524*4d6fc14bSjoerg unordered_set& operator=(const unordered_set& __u) 525*4d6fc14bSjoerg { 526*4d6fc14bSjoerg __table_ = __u.__table_; 527*4d6fc14bSjoerg return *this; 528*4d6fc14bSjoerg } 529*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 530*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 531*4d6fc14bSjoerg unordered_set& operator=(unordered_set&& __u) 532*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 533*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 534*4d6fc14bSjoerg unordered_set& operator=(initializer_list<value_type> __il); 535*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 536*4d6fc14bSjoerg 537*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 538*4d6fc14bSjoerg allocator_type get_allocator() const _NOEXCEPT 539*4d6fc14bSjoerg {return allocator_type(__table_.__node_alloc());} 540*4d6fc14bSjoerg 541*4d6fc14bSjoerg _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 542*4d6fc14bSjoerg bool empty() const _NOEXCEPT {return __table_.size() == 0;} 543*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 544*4d6fc14bSjoerg size_type size() const _NOEXCEPT {return __table_.size();} 545*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 546*4d6fc14bSjoerg size_type max_size() const _NOEXCEPT {return __table_.max_size();} 547*4d6fc14bSjoerg 548*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 549*4d6fc14bSjoerg iterator begin() _NOEXCEPT {return __table_.begin();} 550*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 551*4d6fc14bSjoerg iterator end() _NOEXCEPT {return __table_.end();} 552*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 553*4d6fc14bSjoerg const_iterator begin() const _NOEXCEPT {return __table_.begin();} 554*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 555*4d6fc14bSjoerg const_iterator end() const _NOEXCEPT {return __table_.end();} 556*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 557*4d6fc14bSjoerg const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 558*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 559*4d6fc14bSjoerg const_iterator cend() const _NOEXCEPT {return __table_.end();} 560*4d6fc14bSjoerg 561*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 562*4d6fc14bSjoerg template <class... _Args> 563*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 564*4d6fc14bSjoerg pair<iterator, bool> emplace(_Args&&... __args) 565*4d6fc14bSjoerg {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} 566*4d6fc14bSjoerg template <class... _Args> 567*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 568*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 569*4d6fc14bSjoerg iterator emplace_hint(const_iterator __p, _Args&&... __args) 570*4d6fc14bSjoerg { 571*4d6fc14bSjoerg _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 572*4d6fc14bSjoerg "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" 573*4d6fc14bSjoerg " referring to this unordered_set"); 574*4d6fc14bSjoerg return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; 575*4d6fc14bSjoerg } 576*4d6fc14bSjoerg#else 577*4d6fc14bSjoerg iterator emplace_hint(const_iterator, _Args&&... __args) 578*4d6fc14bSjoerg {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} 579*4d6fc14bSjoerg#endif 580*4d6fc14bSjoerg 581*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 582*4d6fc14bSjoerg pair<iterator, bool> insert(value_type&& __x) 583*4d6fc14bSjoerg {return __table_.__insert_unique(_VSTD::move(__x));} 584*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 585*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 586*4d6fc14bSjoerg iterator insert(const_iterator __p, value_type&& __x) 587*4d6fc14bSjoerg { 588*4d6fc14bSjoerg _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 589*4d6fc14bSjoerg "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" 590*4d6fc14bSjoerg " referring to this unordered_set"); 591*4d6fc14bSjoerg return insert(_VSTD::move(__x)).first; 592*4d6fc14bSjoerg } 593*4d6fc14bSjoerg#else 594*4d6fc14bSjoerg iterator insert(const_iterator, value_type&& __x) 595*4d6fc14bSjoerg {return insert(_VSTD::move(__x)).first;} 596*4d6fc14bSjoerg#endif 597*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 598*4d6fc14bSjoerg void insert(initializer_list<value_type> __il) 599*4d6fc14bSjoerg {insert(__il.begin(), __il.end());} 600*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 601*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 602*4d6fc14bSjoerg pair<iterator, bool> insert(const value_type& __x) 603*4d6fc14bSjoerg {return __table_.__insert_unique(__x);} 604*4d6fc14bSjoerg 605*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 606*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 607*4d6fc14bSjoerg iterator insert(const_iterator __p, const value_type& __x) 608*4d6fc14bSjoerg { 609*4d6fc14bSjoerg _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 610*4d6fc14bSjoerg "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" 611*4d6fc14bSjoerg " referring to this unordered_set"); 612*4d6fc14bSjoerg return insert(__x).first; 613*4d6fc14bSjoerg } 614*4d6fc14bSjoerg#else 615*4d6fc14bSjoerg iterator insert(const_iterator, const value_type& __x) 616*4d6fc14bSjoerg {return insert(__x).first;} 617*4d6fc14bSjoerg#endif 618*4d6fc14bSjoerg template <class _InputIterator> 619*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 620*4d6fc14bSjoerg void insert(_InputIterator __first, _InputIterator __last); 621*4d6fc14bSjoerg 622*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 623*4d6fc14bSjoerg iterator erase(const_iterator __p) {return __table_.erase(__p);} 624*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 625*4d6fc14bSjoerg size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 626*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 627*4d6fc14bSjoerg iterator erase(const_iterator __first, const_iterator __last) 628*4d6fc14bSjoerg {return __table_.erase(__first, __last);} 629*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 630*4d6fc14bSjoerg void clear() _NOEXCEPT {__table_.clear();} 631*4d6fc14bSjoerg 632*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 633*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 634*4d6fc14bSjoerg insert_return_type insert(node_type&& __nh) 635*4d6fc14bSjoerg { 636*4d6fc14bSjoerg _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 637*4d6fc14bSjoerg "node_type with incompatible allocator passed to unordered_set::insert()"); 638*4d6fc14bSjoerg return __table_.template __node_handle_insert_unique< 639*4d6fc14bSjoerg node_type, insert_return_type>(_VSTD::move(__nh)); 640*4d6fc14bSjoerg } 641*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 642*4d6fc14bSjoerg iterator insert(const_iterator __h, node_type&& __nh) 643*4d6fc14bSjoerg { 644*4d6fc14bSjoerg _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 645*4d6fc14bSjoerg "node_type with incompatible allocator passed to unordered_set::insert()"); 646*4d6fc14bSjoerg return __table_.template __node_handle_insert_unique<node_type>( 647*4d6fc14bSjoerg __h, _VSTD::move(__nh)); 648*4d6fc14bSjoerg } 649*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 650*4d6fc14bSjoerg node_type extract(key_type const& __key) 651*4d6fc14bSjoerg { 652*4d6fc14bSjoerg return __table_.template __node_handle_extract<node_type>(__key); 653*4d6fc14bSjoerg } 654*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 655*4d6fc14bSjoerg node_type extract(const_iterator __it) 656*4d6fc14bSjoerg { 657*4d6fc14bSjoerg return __table_.template __node_handle_extract<node_type>(__it); 658*4d6fc14bSjoerg } 659*4d6fc14bSjoerg 660*4d6fc14bSjoerg template<class _H2, class _P2> 661*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 662*4d6fc14bSjoerg void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 663*4d6fc14bSjoerg { 664*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 665*4d6fc14bSjoerg "merging container with incompatible allocator"); 666*4d6fc14bSjoerg __table_.__node_handle_merge_unique(__source.__table_); 667*4d6fc14bSjoerg } 668*4d6fc14bSjoerg template<class _H2, class _P2> 669*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 670*4d6fc14bSjoerg void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 671*4d6fc14bSjoerg { 672*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 673*4d6fc14bSjoerg "merging container with incompatible allocator"); 674*4d6fc14bSjoerg __table_.__node_handle_merge_unique(__source.__table_); 675*4d6fc14bSjoerg } 676*4d6fc14bSjoerg template<class _H2, class _P2> 677*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 678*4d6fc14bSjoerg void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 679*4d6fc14bSjoerg { 680*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 681*4d6fc14bSjoerg "merging container with incompatible allocator"); 682*4d6fc14bSjoerg __table_.__node_handle_merge_unique(__source.__table_); 683*4d6fc14bSjoerg } 684*4d6fc14bSjoerg template<class _H2, class _P2> 685*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 686*4d6fc14bSjoerg void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 687*4d6fc14bSjoerg { 688*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 689*4d6fc14bSjoerg "merging container with incompatible allocator"); 690*4d6fc14bSjoerg __table_.__node_handle_merge_unique(__source.__table_); 691*4d6fc14bSjoerg } 692*4d6fc14bSjoerg#endif 693*4d6fc14bSjoerg 694*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 695*4d6fc14bSjoerg void swap(unordered_set& __u) 696*4d6fc14bSjoerg _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 697*4d6fc14bSjoerg {__table_.swap(__u.__table_);} 698*4d6fc14bSjoerg 699*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 700*4d6fc14bSjoerg hasher hash_function() const {return __table_.hash_function();} 701*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 702*4d6fc14bSjoerg key_equal key_eq() const {return __table_.key_eq();} 703*4d6fc14bSjoerg 704*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 705*4d6fc14bSjoerg iterator find(const key_type& __k) {return __table_.find(__k);} 706*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 707*4d6fc14bSjoerg const_iterator find(const key_type& __k) const {return __table_.find(__k);} 708*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 709*4d6fc14bSjoerg template <typename _K2> 710*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 711*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> 712*4d6fc14bSjoerg find(const _K2& __k) {return __table_.find(__k);} 713*4d6fc14bSjoerg template <typename _K2> 714*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 715*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> 716*4d6fc14bSjoerg find(const _K2& __k) const {return __table_.find(__k);} 717*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 718*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 719*4d6fc14bSjoerg size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 720*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 721*4d6fc14bSjoerg template <typename _K2> 722*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 723*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> 724*4d6fc14bSjoerg count(const _K2& __k) const {return __table_.__count_unique(__k);} 725*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 726*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 727*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 728*4d6fc14bSjoerg bool contains(const key_type& __k) const {return find(__k) != end();} 729*4d6fc14bSjoerg 730*4d6fc14bSjoerg template <typename _K2> 731*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 732*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> 733*4d6fc14bSjoerg contains(const _K2& __k) const {return find(__k) != end();} 734*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 735*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 736*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const key_type& __k) 737*4d6fc14bSjoerg {return __table_.__equal_range_unique(__k);} 738*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 739*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 740*4d6fc14bSjoerg {return __table_.__equal_range_unique(__k);} 741*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 742*4d6fc14bSjoerg template <typename _K2> 743*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 744*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> 745*4d6fc14bSjoerg equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} 746*4d6fc14bSjoerg template <typename _K2> 747*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 748*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> 749*4d6fc14bSjoerg equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} 750*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 751*4d6fc14bSjoerg 752*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 753*4d6fc14bSjoerg size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 754*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 755*4d6fc14bSjoerg size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 756*4d6fc14bSjoerg 757*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 758*4d6fc14bSjoerg size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 759*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 760*4d6fc14bSjoerg size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 761*4d6fc14bSjoerg 762*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 763*4d6fc14bSjoerg local_iterator begin(size_type __n) {return __table_.begin(__n);} 764*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 765*4d6fc14bSjoerg local_iterator end(size_type __n) {return __table_.end(__n);} 766*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 767*4d6fc14bSjoerg const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 768*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 769*4d6fc14bSjoerg const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 770*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 771*4d6fc14bSjoerg const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 772*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 773*4d6fc14bSjoerg const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 774*4d6fc14bSjoerg 775*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 776*4d6fc14bSjoerg float load_factor() const _NOEXCEPT {return __table_.load_factor();} 777*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 778*4d6fc14bSjoerg float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 779*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 780*4d6fc14bSjoerg void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 781*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 782*4d6fc14bSjoerg void rehash(size_type __n) {__table_.rehash(__n);} 783*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 784*4d6fc14bSjoerg void reserve(size_type __n) {__table_.reserve(__n);} 785*4d6fc14bSjoerg 786*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 787*4d6fc14bSjoerg 788*4d6fc14bSjoerg bool __dereferenceable(const const_iterator* __i) const 789*4d6fc14bSjoerg {return __table_.__dereferenceable(__i);} 790*4d6fc14bSjoerg bool __decrementable(const const_iterator* __i) const 791*4d6fc14bSjoerg {return __table_.__decrementable(__i);} 792*4d6fc14bSjoerg bool __addable(const const_iterator* __i, ptrdiff_t __n) const 793*4d6fc14bSjoerg {return __table_.__addable(__i, __n);} 794*4d6fc14bSjoerg bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 795*4d6fc14bSjoerg {return __table_.__addable(__i, __n);} 796*4d6fc14bSjoerg 797*4d6fc14bSjoerg#endif // _LIBCPP_DEBUG_LEVEL == 2 798*4d6fc14bSjoerg 799*4d6fc14bSjoerg}; 800*4d6fc14bSjoerg 801*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES 802*4d6fc14bSjoergtemplate<class _InputIterator, 803*4d6fc14bSjoerg class _Hash = hash<__iter_value_type<_InputIterator>>, 804*4d6fc14bSjoerg class _Pred = equal_to<__iter_value_type<_InputIterator>>, 805*4d6fc14bSjoerg class _Allocator = allocator<__iter_value_type<_InputIterator>>, 806*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 807*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 808*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Pred>::value>, 809*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 810*4d6fc14bSjoergunordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 811*4d6fc14bSjoerg _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 812*4d6fc14bSjoerg -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 813*4d6fc14bSjoerg 814*4d6fc14bSjoergtemplate<class _Tp, class _Hash = hash<_Tp>, 815*4d6fc14bSjoerg class _Pred = equal_to<_Tp>, 816*4d6fc14bSjoerg class _Allocator = allocator<_Tp>, 817*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 818*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 819*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Pred>::value>, 820*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 821*4d6fc14bSjoergunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 822*4d6fc14bSjoerg _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 823*4d6fc14bSjoerg -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; 824*4d6fc14bSjoerg 825*4d6fc14bSjoergtemplate<class _InputIterator, class _Allocator, 826*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 827*4d6fc14bSjoergunordered_set(_InputIterator, _InputIterator, 828*4d6fc14bSjoerg typename allocator_traits<_Allocator>::size_type, _Allocator) 829*4d6fc14bSjoerg -> unordered_set<__iter_value_type<_InputIterator>, 830*4d6fc14bSjoerg hash<__iter_value_type<_InputIterator>>, 831*4d6fc14bSjoerg equal_to<__iter_value_type<_InputIterator>>, 832*4d6fc14bSjoerg _Allocator>; 833*4d6fc14bSjoerg 834*4d6fc14bSjoergtemplate<class _InputIterator, class _Hash, class _Allocator, 835*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 836*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 837*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 838*4d6fc14bSjoergunordered_set(_InputIterator, _InputIterator, 839*4d6fc14bSjoerg typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 840*4d6fc14bSjoerg -> unordered_set<__iter_value_type<_InputIterator>, _Hash, 841*4d6fc14bSjoerg equal_to<__iter_value_type<_InputIterator>>, 842*4d6fc14bSjoerg _Allocator>; 843*4d6fc14bSjoerg 844*4d6fc14bSjoergtemplate<class _Tp, class _Allocator, 845*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 846*4d6fc14bSjoergunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 847*4d6fc14bSjoerg -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 848*4d6fc14bSjoerg 849*4d6fc14bSjoergtemplate<class _Tp, class _Hash, class _Allocator, 850*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 851*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 852*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 853*4d6fc14bSjoergunordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 854*4d6fc14bSjoerg -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 855*4d6fc14bSjoerg#endif 856*4d6fc14bSjoerg 857*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 858*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 859*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql) 860*4d6fc14bSjoerg : __table_(__hf, __eql) 861*4d6fc14bSjoerg{ 862*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 863*4d6fc14bSjoerg __get_db()->__insert_c(this); 864*4d6fc14bSjoerg#endif 865*4d6fc14bSjoerg __table_.rehash(__n); 866*4d6fc14bSjoerg} 867*4d6fc14bSjoerg 868*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 869*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, 870*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 871*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 872*4d6fc14bSjoerg{ 873*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 874*4d6fc14bSjoerg __get_db()->__insert_c(this); 875*4d6fc14bSjoerg#endif 876*4d6fc14bSjoerg __table_.rehash(__n); 877*4d6fc14bSjoerg} 878*4d6fc14bSjoerg 879*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 880*4d6fc14bSjoergtemplate <class _InputIterator> 881*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 882*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last) 883*4d6fc14bSjoerg{ 884*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 885*4d6fc14bSjoerg __get_db()->__insert_c(this); 886*4d6fc14bSjoerg#endif 887*4d6fc14bSjoerg insert(__first, __last); 888*4d6fc14bSjoerg} 889*4d6fc14bSjoerg 890*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 891*4d6fc14bSjoergtemplate <class _InputIterator> 892*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 893*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last, size_type __n, 894*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql) 895*4d6fc14bSjoerg : __table_(__hf, __eql) 896*4d6fc14bSjoerg{ 897*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 898*4d6fc14bSjoerg __get_db()->__insert_c(this); 899*4d6fc14bSjoerg#endif 900*4d6fc14bSjoerg __table_.rehash(__n); 901*4d6fc14bSjoerg insert(__first, __last); 902*4d6fc14bSjoerg} 903*4d6fc14bSjoerg 904*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 905*4d6fc14bSjoergtemplate <class _InputIterator> 906*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 907*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last, size_type __n, 908*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 909*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 910*4d6fc14bSjoerg{ 911*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 912*4d6fc14bSjoerg __get_db()->__insert_c(this); 913*4d6fc14bSjoerg#endif 914*4d6fc14bSjoerg __table_.rehash(__n); 915*4d6fc14bSjoerg insert(__first, __last); 916*4d6fc14bSjoerg} 917*4d6fc14bSjoerg 918*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 919*4d6fc14bSjoerginline 920*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 921*4d6fc14bSjoerg const allocator_type& __a) 922*4d6fc14bSjoerg : __table_(__a) 923*4d6fc14bSjoerg{ 924*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 925*4d6fc14bSjoerg __get_db()->__insert_c(this); 926*4d6fc14bSjoerg#endif 927*4d6fc14bSjoerg} 928*4d6fc14bSjoerg 929*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 930*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 931*4d6fc14bSjoerg const unordered_set& __u) 932*4d6fc14bSjoerg : __table_(__u.__table_) 933*4d6fc14bSjoerg{ 934*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 935*4d6fc14bSjoerg __get_db()->__insert_c(this); 936*4d6fc14bSjoerg#endif 937*4d6fc14bSjoerg __table_.rehash(__u.bucket_count()); 938*4d6fc14bSjoerg insert(__u.begin(), __u.end()); 939*4d6fc14bSjoerg} 940*4d6fc14bSjoerg 941*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 942*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 943*4d6fc14bSjoerg const unordered_set& __u, const allocator_type& __a) 944*4d6fc14bSjoerg : __table_(__u.__table_, __a) 945*4d6fc14bSjoerg{ 946*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 947*4d6fc14bSjoerg __get_db()->__insert_c(this); 948*4d6fc14bSjoerg#endif 949*4d6fc14bSjoerg __table_.rehash(__u.bucket_count()); 950*4d6fc14bSjoerg insert(__u.begin(), __u.end()); 951*4d6fc14bSjoerg} 952*4d6fc14bSjoerg 953*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 954*4d6fc14bSjoerg 955*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 956*4d6fc14bSjoerginline 957*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 958*4d6fc14bSjoerg unordered_set&& __u) 959*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 960*4d6fc14bSjoerg : __table_(_VSTD::move(__u.__table_)) 961*4d6fc14bSjoerg{ 962*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 963*4d6fc14bSjoerg __get_db()->__insert_c(this); 964*4d6fc14bSjoerg __get_db()->swap(this, &__u); 965*4d6fc14bSjoerg#endif 966*4d6fc14bSjoerg} 967*4d6fc14bSjoerg 968*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 969*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 970*4d6fc14bSjoerg unordered_set&& __u, const allocator_type& __a) 971*4d6fc14bSjoerg : __table_(_VSTD::move(__u.__table_), __a) 972*4d6fc14bSjoerg{ 973*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 974*4d6fc14bSjoerg __get_db()->__insert_c(this); 975*4d6fc14bSjoerg#endif 976*4d6fc14bSjoerg if (__a != __u.get_allocator()) 977*4d6fc14bSjoerg { 978*4d6fc14bSjoerg iterator __i = __u.begin(); 979*4d6fc14bSjoerg while (__u.size() != 0) 980*4d6fc14bSjoerg __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 981*4d6fc14bSjoerg } 982*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 983*4d6fc14bSjoerg else 984*4d6fc14bSjoerg __get_db()->swap(this, &__u); 985*4d6fc14bSjoerg#endif 986*4d6fc14bSjoerg} 987*4d6fc14bSjoerg 988*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 989*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 990*4d6fc14bSjoerg initializer_list<value_type> __il) 991*4d6fc14bSjoerg{ 992*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 993*4d6fc14bSjoerg __get_db()->__insert_c(this); 994*4d6fc14bSjoerg#endif 995*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 996*4d6fc14bSjoerg} 997*4d6fc14bSjoerg 998*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 999*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 1000*4d6fc14bSjoerg initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1001*4d6fc14bSjoerg const key_equal& __eql) 1002*4d6fc14bSjoerg : __table_(__hf, __eql) 1003*4d6fc14bSjoerg{ 1004*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1005*4d6fc14bSjoerg __get_db()->__insert_c(this); 1006*4d6fc14bSjoerg#endif 1007*4d6fc14bSjoerg __table_.rehash(__n); 1008*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 1009*4d6fc14bSjoerg} 1010*4d6fc14bSjoerg 1011*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1012*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( 1013*4d6fc14bSjoerg initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1014*4d6fc14bSjoerg const key_equal& __eql, const allocator_type& __a) 1015*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 1016*4d6fc14bSjoerg{ 1017*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1018*4d6fc14bSjoerg __get_db()->__insert_c(this); 1019*4d6fc14bSjoerg#endif 1020*4d6fc14bSjoerg __table_.rehash(__n); 1021*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 1022*4d6fc14bSjoerg} 1023*4d6fc14bSjoerg 1024*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1025*4d6fc14bSjoerginline 1026*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>& 1027*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) 1028*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 1029*4d6fc14bSjoerg{ 1030*4d6fc14bSjoerg __table_ = _VSTD::move(__u.__table_); 1031*4d6fc14bSjoerg return *this; 1032*4d6fc14bSjoerg} 1033*4d6fc14bSjoerg 1034*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1035*4d6fc14bSjoerginline 1036*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>& 1037*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( 1038*4d6fc14bSjoerg initializer_list<value_type> __il) 1039*4d6fc14bSjoerg{ 1040*4d6fc14bSjoerg __table_.__assign_unique(__il.begin(), __il.end()); 1041*4d6fc14bSjoerg return *this; 1042*4d6fc14bSjoerg} 1043*4d6fc14bSjoerg 1044*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 1045*4d6fc14bSjoerg 1046*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1047*4d6fc14bSjoergtemplate <class _InputIterator> 1048*4d6fc14bSjoerginline 1049*4d6fc14bSjoergvoid 1050*4d6fc14bSjoergunordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 1051*4d6fc14bSjoerg _InputIterator __last) 1052*4d6fc14bSjoerg{ 1053*4d6fc14bSjoerg for (; __first != __last; ++__first) 1054*4d6fc14bSjoerg __table_.__insert_unique(*__first); 1055*4d6fc14bSjoerg} 1056*4d6fc14bSjoerg 1057*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1058*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1059*4d6fc14bSjoergvoid 1060*4d6fc14bSjoergswap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 1061*4d6fc14bSjoerg unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 1062*4d6fc14bSjoerg _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 1063*4d6fc14bSjoerg{ 1064*4d6fc14bSjoerg __x.swap(__y); 1065*4d6fc14bSjoerg} 1066*4d6fc14bSjoerg 1067*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 17 1068*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc, 1069*4d6fc14bSjoerg class _Predicate> 1070*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1071*4d6fc14bSjoerg typename unordered_set<_Value, _Hash, _Pred, _Alloc>::size_type 1072*4d6fc14bSjoerg erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, 1073*4d6fc14bSjoerg _Predicate __pred) { 1074*4d6fc14bSjoerg return _VSTD::__libcpp_erase_if_container(__c, __pred); 1075*4d6fc14bSjoerg} 1076*4d6fc14bSjoerg#endif 1077*4d6fc14bSjoerg 1078*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1079*4d6fc14bSjoergbool 1080*4d6fc14bSjoergoperator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 1081*4d6fc14bSjoerg const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 1082*4d6fc14bSjoerg{ 1083*4d6fc14bSjoerg if (__x.size() != __y.size()) 1084*4d6fc14bSjoerg return false; 1085*4d6fc14bSjoerg typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator 1086*4d6fc14bSjoerg const_iterator; 1087*4d6fc14bSjoerg for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 1088*4d6fc14bSjoerg __i != __ex; ++__i) 1089*4d6fc14bSjoerg { 1090*4d6fc14bSjoerg const_iterator __j = __y.find(*__i); 1091*4d6fc14bSjoerg if (__j == __ey || !(*__i == *__j)) 1092*4d6fc14bSjoerg return false; 1093*4d6fc14bSjoerg } 1094*4d6fc14bSjoerg return true; 1095*4d6fc14bSjoerg} 1096*4d6fc14bSjoerg 1097*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1098*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1099*4d6fc14bSjoergbool 1100*4d6fc14bSjoergoperator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, 1101*4d6fc14bSjoerg const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) 1102*4d6fc14bSjoerg{ 1103*4d6fc14bSjoerg return !(__x == __y); 1104*4d6fc14bSjoerg} 1105*4d6fc14bSjoerg 1106*4d6fc14bSjoergtemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 1107*4d6fc14bSjoerg class _Alloc = allocator<_Value> > 1108*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS unordered_multiset 1109*4d6fc14bSjoerg{ 1110*4d6fc14bSjoergpublic: 1111*4d6fc14bSjoerg // types 1112*4d6fc14bSjoerg typedef _Value key_type; 1113*4d6fc14bSjoerg typedef key_type value_type; 1114*4d6fc14bSjoerg typedef __identity_t<_Hash> hasher; 1115*4d6fc14bSjoerg typedef __identity_t<_Pred> key_equal; 1116*4d6fc14bSjoerg typedef __identity_t<_Alloc> allocator_type; 1117*4d6fc14bSjoerg typedef value_type& reference; 1118*4d6fc14bSjoerg typedef const value_type& const_reference; 1119*4d6fc14bSjoerg static_assert((is_same<value_type, typename allocator_type::value_type>::value), 1120*4d6fc14bSjoerg "Invalid allocator::value_type"); 1121*4d6fc14bSjoerg 1122*4d6fc14bSjoergprivate: 1123*4d6fc14bSjoerg typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 1124*4d6fc14bSjoerg 1125*4d6fc14bSjoerg __table __table_; 1126*4d6fc14bSjoerg 1127*4d6fc14bSjoergpublic: 1128*4d6fc14bSjoerg typedef typename __table::pointer pointer; 1129*4d6fc14bSjoerg typedef typename __table::const_pointer const_pointer; 1130*4d6fc14bSjoerg typedef typename __table::size_type size_type; 1131*4d6fc14bSjoerg typedef typename __table::difference_type difference_type; 1132*4d6fc14bSjoerg 1133*4d6fc14bSjoerg typedef typename __table::const_iterator iterator; 1134*4d6fc14bSjoerg typedef typename __table::const_iterator const_iterator; 1135*4d6fc14bSjoerg typedef typename __table::const_local_iterator local_iterator; 1136*4d6fc14bSjoerg typedef typename __table::const_local_iterator const_local_iterator; 1137*4d6fc14bSjoerg 1138*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 1139*4d6fc14bSjoerg typedef __set_node_handle<typename __table::__node, allocator_type> node_type; 1140*4d6fc14bSjoerg#endif 1141*4d6fc14bSjoerg 1142*4d6fc14bSjoerg template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 1143*4d6fc14bSjoerg friend class _LIBCPP_TEMPLATE_VIS unordered_set; 1144*4d6fc14bSjoerg template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> 1145*4d6fc14bSjoerg friend class _LIBCPP_TEMPLATE_VIS unordered_multiset; 1146*4d6fc14bSjoerg 1147*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1148*4d6fc14bSjoerg unordered_multiset() 1149*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 1150*4d6fc14bSjoerg { 1151*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1152*4d6fc14bSjoerg __get_db()->__insert_c(this); 1153*4d6fc14bSjoerg#endif 1154*4d6fc14bSjoerg } 1155*4d6fc14bSjoerg explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), 1156*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 1157*4d6fc14bSjoerg unordered_multiset(size_type __n, const hasher& __hf, 1158*4d6fc14bSjoerg const key_equal& __eql, const allocator_type& __a); 1159*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 1160*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1161*4d6fc14bSjoerg unordered_multiset(size_type __n, const allocator_type& __a) 1162*4d6fc14bSjoerg : unordered_multiset(__n, hasher(), key_equal(), __a) {} 1163*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1164*4d6fc14bSjoerg unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) 1165*4d6fc14bSjoerg : unordered_multiset(__n, __hf, key_equal(), __a) {} 1166*4d6fc14bSjoerg#endif 1167*4d6fc14bSjoerg template <class _InputIterator> 1168*4d6fc14bSjoerg unordered_multiset(_InputIterator __first, _InputIterator __last); 1169*4d6fc14bSjoerg template <class _InputIterator> 1170*4d6fc14bSjoerg unordered_multiset(_InputIterator __first, _InputIterator __last, 1171*4d6fc14bSjoerg size_type __n, const hasher& __hf = hasher(), 1172*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 1173*4d6fc14bSjoerg template <class _InputIterator> 1174*4d6fc14bSjoerg unordered_multiset(_InputIterator __first, _InputIterator __last, 1175*4d6fc14bSjoerg size_type __n , const hasher& __hf, 1176*4d6fc14bSjoerg const key_equal& __eql, const allocator_type& __a); 1177*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 1178*4d6fc14bSjoerg template <class _InputIterator> 1179*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1180*4d6fc14bSjoerg unordered_multiset(_InputIterator __first, _InputIterator __last, 1181*4d6fc14bSjoerg size_type __n, const allocator_type& __a) 1182*4d6fc14bSjoerg : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} 1183*4d6fc14bSjoerg template <class _InputIterator> 1184*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1185*4d6fc14bSjoerg unordered_multiset(_InputIterator __first, _InputIterator __last, 1186*4d6fc14bSjoerg size_type __n, const hasher& __hf, const allocator_type& __a) 1187*4d6fc14bSjoerg : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} 1188*4d6fc14bSjoerg#endif 1189*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1190*4d6fc14bSjoerg explicit unordered_multiset(const allocator_type& __a); 1191*4d6fc14bSjoerg unordered_multiset(const unordered_multiset& __u); 1192*4d6fc14bSjoerg unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); 1193*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 1194*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1195*4d6fc14bSjoerg unordered_multiset(unordered_multiset&& __u) 1196*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 1197*4d6fc14bSjoerg unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); 1198*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> __il); 1199*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> __il, size_type __n, 1200*4d6fc14bSjoerg const hasher& __hf = hasher(), 1201*4d6fc14bSjoerg const key_equal& __eql = key_equal()); 1202*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> __il, size_type __n, 1203*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql, 1204*4d6fc14bSjoerg const allocator_type& __a); 1205*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 11 1206*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1207*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 1208*4d6fc14bSjoerg : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} 1209*4d6fc14bSjoerg inline _LIBCPP_INLINE_VISIBILITY 1210*4d6fc14bSjoerg unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) 1211*4d6fc14bSjoerg : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} 1212*4d6fc14bSjoerg#endif 1213*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 1214*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1215*4d6fc14bSjoerg ~unordered_multiset() { 1216*4d6fc14bSjoerg static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); 1217*4d6fc14bSjoerg } 1218*4d6fc14bSjoerg 1219*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1220*4d6fc14bSjoerg unordered_multiset& operator=(const unordered_multiset& __u) 1221*4d6fc14bSjoerg { 1222*4d6fc14bSjoerg __table_ = __u.__table_; 1223*4d6fc14bSjoerg return *this; 1224*4d6fc14bSjoerg } 1225*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 1226*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1227*4d6fc14bSjoerg unordered_multiset& operator=(unordered_multiset&& __u) 1228*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 1229*4d6fc14bSjoerg unordered_multiset& operator=(initializer_list<value_type> __il); 1230*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 1231*4d6fc14bSjoerg 1232*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1233*4d6fc14bSjoerg allocator_type get_allocator() const _NOEXCEPT 1234*4d6fc14bSjoerg {return allocator_type(__table_.__node_alloc());} 1235*4d6fc14bSjoerg 1236*4d6fc14bSjoerg _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 1237*4d6fc14bSjoerg bool empty() const _NOEXCEPT {return __table_.size() == 0;} 1238*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1239*4d6fc14bSjoerg size_type size() const _NOEXCEPT {return __table_.size();} 1240*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1241*4d6fc14bSjoerg size_type max_size() const _NOEXCEPT {return __table_.max_size();} 1242*4d6fc14bSjoerg 1243*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1244*4d6fc14bSjoerg iterator begin() _NOEXCEPT {return __table_.begin();} 1245*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1246*4d6fc14bSjoerg iterator end() _NOEXCEPT {return __table_.end();} 1247*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1248*4d6fc14bSjoerg const_iterator begin() const _NOEXCEPT {return __table_.begin();} 1249*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1250*4d6fc14bSjoerg const_iterator end() const _NOEXCEPT {return __table_.end();} 1251*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1252*4d6fc14bSjoerg const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 1253*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1254*4d6fc14bSjoerg const_iterator cend() const _NOEXCEPT {return __table_.end();} 1255*4d6fc14bSjoerg 1256*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 1257*4d6fc14bSjoerg template <class... _Args> 1258*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1259*4d6fc14bSjoerg iterator emplace(_Args&&... __args) 1260*4d6fc14bSjoerg {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} 1261*4d6fc14bSjoerg template <class... _Args> 1262*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1263*4d6fc14bSjoerg iterator emplace_hint(const_iterator __p, _Args&&... __args) 1264*4d6fc14bSjoerg {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} 1265*4d6fc14bSjoerg 1266*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1267*4d6fc14bSjoerg iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} 1268*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1269*4d6fc14bSjoerg iterator insert(const_iterator __p, value_type&& __x) 1270*4d6fc14bSjoerg {return __table_.__insert_multi(__p, _VSTD::move(__x));} 1271*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1272*4d6fc14bSjoerg void insert(initializer_list<value_type> __il) 1273*4d6fc14bSjoerg {insert(__il.begin(), __il.end());} 1274*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 1275*4d6fc14bSjoerg 1276*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1277*4d6fc14bSjoerg iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 1278*4d6fc14bSjoerg 1279*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1280*4d6fc14bSjoerg iterator insert(const_iterator __p, const value_type& __x) 1281*4d6fc14bSjoerg {return __table_.__insert_multi(__p, __x);} 1282*4d6fc14bSjoerg 1283*4d6fc14bSjoerg template <class _InputIterator> 1284*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1285*4d6fc14bSjoerg void insert(_InputIterator __first, _InputIterator __last); 1286*4d6fc14bSjoerg 1287*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 1288*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1289*4d6fc14bSjoerg iterator insert(node_type&& __nh) 1290*4d6fc14bSjoerg { 1291*4d6fc14bSjoerg _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1292*4d6fc14bSjoerg "node_type with incompatible allocator passed to unordered_multiset::insert()"); 1293*4d6fc14bSjoerg return __table_.template __node_handle_insert_multi<node_type>( 1294*4d6fc14bSjoerg _VSTD::move(__nh)); 1295*4d6fc14bSjoerg } 1296*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1297*4d6fc14bSjoerg iterator insert(const_iterator __hint, node_type&& __nh) 1298*4d6fc14bSjoerg { 1299*4d6fc14bSjoerg _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1300*4d6fc14bSjoerg "node_type with incompatible allocator passed to unordered_multiset::insert()"); 1301*4d6fc14bSjoerg return __table_.template __node_handle_insert_multi<node_type>( 1302*4d6fc14bSjoerg __hint, _VSTD::move(__nh)); 1303*4d6fc14bSjoerg } 1304*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1305*4d6fc14bSjoerg node_type extract(const_iterator __position) 1306*4d6fc14bSjoerg { 1307*4d6fc14bSjoerg return __table_.template __node_handle_extract<node_type>( 1308*4d6fc14bSjoerg __position); 1309*4d6fc14bSjoerg } 1310*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1311*4d6fc14bSjoerg node_type extract(key_type const& __key) 1312*4d6fc14bSjoerg { 1313*4d6fc14bSjoerg return __table_.template __node_handle_extract<node_type>(__key); 1314*4d6fc14bSjoerg } 1315*4d6fc14bSjoerg 1316*4d6fc14bSjoerg template <class _H2, class _P2> 1317*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1318*4d6fc14bSjoerg void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source) 1319*4d6fc14bSjoerg { 1320*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1321*4d6fc14bSjoerg "merging container with incompatible allocator"); 1322*4d6fc14bSjoerg return __table_.__node_handle_merge_multi(__source.__table_); 1323*4d6fc14bSjoerg } 1324*4d6fc14bSjoerg template <class _H2, class _P2> 1325*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1326*4d6fc14bSjoerg void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source) 1327*4d6fc14bSjoerg { 1328*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1329*4d6fc14bSjoerg "merging container with incompatible allocator"); 1330*4d6fc14bSjoerg return __table_.__node_handle_merge_multi(__source.__table_); 1331*4d6fc14bSjoerg } 1332*4d6fc14bSjoerg template <class _H2, class _P2> 1333*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1334*4d6fc14bSjoerg void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source) 1335*4d6fc14bSjoerg { 1336*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1337*4d6fc14bSjoerg "merging container with incompatible allocator"); 1338*4d6fc14bSjoerg return __table_.__node_handle_merge_multi(__source.__table_); 1339*4d6fc14bSjoerg } 1340*4d6fc14bSjoerg template <class _H2, class _P2> 1341*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1342*4d6fc14bSjoerg void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source) 1343*4d6fc14bSjoerg { 1344*4d6fc14bSjoerg _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1345*4d6fc14bSjoerg "merging container with incompatible allocator"); 1346*4d6fc14bSjoerg return __table_.__node_handle_merge_multi(__source.__table_); 1347*4d6fc14bSjoerg } 1348*4d6fc14bSjoerg#endif 1349*4d6fc14bSjoerg 1350*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1351*4d6fc14bSjoerg iterator erase(const_iterator __p) {return __table_.erase(__p);} 1352*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1353*4d6fc14bSjoerg size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 1354*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1355*4d6fc14bSjoerg iterator erase(const_iterator __first, const_iterator __last) 1356*4d6fc14bSjoerg {return __table_.erase(__first, __last);} 1357*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1358*4d6fc14bSjoerg void clear() _NOEXCEPT {__table_.clear();} 1359*4d6fc14bSjoerg 1360*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1361*4d6fc14bSjoerg void swap(unordered_multiset& __u) 1362*4d6fc14bSjoerg _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 1363*4d6fc14bSjoerg {__table_.swap(__u.__table_);} 1364*4d6fc14bSjoerg 1365*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1366*4d6fc14bSjoerg hasher hash_function() const {return __table_.hash_function();} 1367*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1368*4d6fc14bSjoerg key_equal key_eq() const {return __table_.key_eq();} 1369*4d6fc14bSjoerg 1370*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1371*4d6fc14bSjoerg iterator find(const key_type& __k) {return __table_.find(__k);} 1372*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1373*4d6fc14bSjoerg const_iterator find(const key_type& __k) const {return __table_.find(__k);} 1374*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 1375*4d6fc14bSjoerg template <typename _K2> 1376*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1377*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> 1378*4d6fc14bSjoerg find(const _K2& __k) {return __table_.find(__k);} 1379*4d6fc14bSjoerg template <typename _K2> 1380*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1381*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> 1382*4d6fc14bSjoerg find(const _K2& __k) const {return __table_.find(__k);} 1383*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 1384*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1385*4d6fc14bSjoerg size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 1386*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 1387*4d6fc14bSjoerg template <typename _K2> 1388*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1389*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> 1390*4d6fc14bSjoerg count(const _K2& __k) const {return __table_.__count_multi(__k);} 1391*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 1392*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 1393*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1394*4d6fc14bSjoerg bool contains(const key_type& __k) const {return find(__k) != end();} 1395*4d6fc14bSjoerg 1396*4d6fc14bSjoerg template <typename _K2> 1397*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1398*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> 1399*4d6fc14bSjoerg contains(const _K2& __k) const {return find(__k) != end();} 1400*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 1401*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1402*4d6fc14bSjoerg pair<iterator, iterator> equal_range(const key_type& __k) 1403*4d6fc14bSjoerg {return __table_.__equal_range_multi(__k);} 1404*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1405*4d6fc14bSjoerg pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 1406*4d6fc14bSjoerg {return __table_.__equal_range_multi(__k);} 1407*4d6fc14bSjoerg #if _LIBCPP_STD_VER > 17 1408*4d6fc14bSjoerg template <typename _K2> 1409*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1410*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> 1411*4d6fc14bSjoerg equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} 1412*4d6fc14bSjoerg template <typename _K2> 1413*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1414*4d6fc14bSjoerg _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> 1415*4d6fc14bSjoerg equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} 1416*4d6fc14bSjoerg #endif // _LIBCPP_STD_VER > 17 1417*4d6fc14bSjoerg 1418*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1419*4d6fc14bSjoerg size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 1420*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1421*4d6fc14bSjoerg size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 1422*4d6fc14bSjoerg 1423*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1424*4d6fc14bSjoerg size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} 1425*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1426*4d6fc14bSjoerg size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 1427*4d6fc14bSjoerg 1428*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1429*4d6fc14bSjoerg local_iterator begin(size_type __n) {return __table_.begin(__n);} 1430*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1431*4d6fc14bSjoerg local_iterator end(size_type __n) {return __table_.end(__n);} 1432*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1433*4d6fc14bSjoerg const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 1434*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1435*4d6fc14bSjoerg const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 1436*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1437*4d6fc14bSjoerg const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 1438*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1439*4d6fc14bSjoerg const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 1440*4d6fc14bSjoerg 1441*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1442*4d6fc14bSjoerg float load_factor() const _NOEXCEPT {return __table_.load_factor();} 1443*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1444*4d6fc14bSjoerg float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 1445*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1446*4d6fc14bSjoerg void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 1447*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1448*4d6fc14bSjoerg void rehash(size_type __n) {__table_.rehash(__n);} 1449*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 1450*4d6fc14bSjoerg void reserve(size_type __n) {__table_.reserve(__n);} 1451*4d6fc14bSjoerg 1452*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1453*4d6fc14bSjoerg 1454*4d6fc14bSjoerg bool __dereferenceable(const const_iterator* __i) const 1455*4d6fc14bSjoerg {return __table_.__dereferenceable(__i);} 1456*4d6fc14bSjoerg bool __decrementable(const const_iterator* __i) const 1457*4d6fc14bSjoerg {return __table_.__decrementable(__i);} 1458*4d6fc14bSjoerg bool __addable(const const_iterator* __i, ptrdiff_t __n) const 1459*4d6fc14bSjoerg {return __table_.__addable(__i, __n);} 1460*4d6fc14bSjoerg bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 1461*4d6fc14bSjoerg {return __table_.__addable(__i, __n);} 1462*4d6fc14bSjoerg 1463*4d6fc14bSjoerg#endif // _LIBCPP_DEBUG_LEVEL == 2 1464*4d6fc14bSjoerg 1465*4d6fc14bSjoerg}; 1466*4d6fc14bSjoerg 1467*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES 1468*4d6fc14bSjoergtemplate<class _InputIterator, 1469*4d6fc14bSjoerg class _Hash = hash<__iter_value_type<_InputIterator>>, 1470*4d6fc14bSjoerg class _Pred = equal_to<__iter_value_type<_InputIterator>>, 1471*4d6fc14bSjoerg class _Allocator = allocator<__iter_value_type<_InputIterator>>, 1472*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 1473*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 1474*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Pred>::value>, 1475*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1476*4d6fc14bSjoergunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, 1477*4d6fc14bSjoerg _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 1478*4d6fc14bSjoerg -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>; 1479*4d6fc14bSjoerg 1480*4d6fc14bSjoergtemplate<class _Tp, class _Hash = hash<_Tp>, 1481*4d6fc14bSjoerg class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>, 1482*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 1483*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 1484*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Pred>::value>, 1485*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1486*4d6fc14bSjoergunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0, 1487*4d6fc14bSjoerg _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) 1488*4d6fc14bSjoerg -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; 1489*4d6fc14bSjoerg 1490*4d6fc14bSjoergtemplate<class _InputIterator, class _Allocator, 1491*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1492*4d6fc14bSjoergunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) 1493*4d6fc14bSjoerg -> unordered_multiset<__iter_value_type<_InputIterator>, 1494*4d6fc14bSjoerg hash<__iter_value_type<_InputIterator>>, 1495*4d6fc14bSjoerg equal_to<__iter_value_type<_InputIterator>>, 1496*4d6fc14bSjoerg _Allocator>; 1497*4d6fc14bSjoerg 1498*4d6fc14bSjoergtemplate<class _InputIterator, class _Hash, class _Allocator, 1499*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 1500*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 1501*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1502*4d6fc14bSjoergunordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, 1503*4d6fc14bSjoerg _Hash, _Allocator) 1504*4d6fc14bSjoerg -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, 1505*4d6fc14bSjoerg equal_to<__iter_value_type<_InputIterator>>, 1506*4d6fc14bSjoerg _Allocator>; 1507*4d6fc14bSjoerg 1508*4d6fc14bSjoergtemplate<class _Tp, class _Allocator, 1509*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1510*4d6fc14bSjoergunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator) 1511*4d6fc14bSjoerg -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; 1512*4d6fc14bSjoerg 1513*4d6fc14bSjoergtemplate<class _Tp, class _Hash, class _Allocator, 1514*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Hash>::value>, 1515*4d6fc14bSjoerg class = _EnableIf<!is_integral<_Hash>::value>, 1516*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Allocator>::value>> 1517*4d6fc14bSjoergunordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) 1518*4d6fc14bSjoerg -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; 1519*4d6fc14bSjoerg#endif 1520*4d6fc14bSjoerg 1521*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1522*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1523*4d6fc14bSjoerg size_type __n, const hasher& __hf, const key_equal& __eql) 1524*4d6fc14bSjoerg : __table_(__hf, __eql) 1525*4d6fc14bSjoerg{ 1526*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1527*4d6fc14bSjoerg __get_db()->__insert_c(this); 1528*4d6fc14bSjoerg#endif 1529*4d6fc14bSjoerg __table_.rehash(__n); 1530*4d6fc14bSjoerg} 1531*4d6fc14bSjoerg 1532*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1533*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1534*4d6fc14bSjoerg size_type __n, const hasher& __hf, const key_equal& __eql, 1535*4d6fc14bSjoerg const allocator_type& __a) 1536*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 1537*4d6fc14bSjoerg{ 1538*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1539*4d6fc14bSjoerg __get_db()->__insert_c(this); 1540*4d6fc14bSjoerg#endif 1541*4d6fc14bSjoerg __table_.rehash(__n); 1542*4d6fc14bSjoerg} 1543*4d6fc14bSjoerg 1544*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1545*4d6fc14bSjoergtemplate <class _InputIterator> 1546*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1547*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last) 1548*4d6fc14bSjoerg{ 1549*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1550*4d6fc14bSjoerg __get_db()->__insert_c(this); 1551*4d6fc14bSjoerg#endif 1552*4d6fc14bSjoerg insert(__first, __last); 1553*4d6fc14bSjoerg} 1554*4d6fc14bSjoerg 1555*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1556*4d6fc14bSjoergtemplate <class _InputIterator> 1557*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1558*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last, size_type __n, 1559*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql) 1560*4d6fc14bSjoerg : __table_(__hf, __eql) 1561*4d6fc14bSjoerg{ 1562*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1563*4d6fc14bSjoerg __get_db()->__insert_c(this); 1564*4d6fc14bSjoerg#endif 1565*4d6fc14bSjoerg __table_.rehash(__n); 1566*4d6fc14bSjoerg insert(__first, __last); 1567*4d6fc14bSjoerg} 1568*4d6fc14bSjoerg 1569*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1570*4d6fc14bSjoergtemplate <class _InputIterator> 1571*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1572*4d6fc14bSjoerg _InputIterator __first, _InputIterator __last, size_type __n, 1573*4d6fc14bSjoerg const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 1574*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 1575*4d6fc14bSjoerg{ 1576*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1577*4d6fc14bSjoerg __get_db()->__insert_c(this); 1578*4d6fc14bSjoerg#endif 1579*4d6fc14bSjoerg __table_.rehash(__n); 1580*4d6fc14bSjoerg insert(__first, __last); 1581*4d6fc14bSjoerg} 1582*4d6fc14bSjoerg 1583*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1584*4d6fc14bSjoerginline 1585*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1586*4d6fc14bSjoerg const allocator_type& __a) 1587*4d6fc14bSjoerg : __table_(__a) 1588*4d6fc14bSjoerg{ 1589*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1590*4d6fc14bSjoerg __get_db()->__insert_c(this); 1591*4d6fc14bSjoerg#endif 1592*4d6fc14bSjoerg} 1593*4d6fc14bSjoerg 1594*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1595*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1596*4d6fc14bSjoerg const unordered_multiset& __u) 1597*4d6fc14bSjoerg : __table_(__u.__table_) 1598*4d6fc14bSjoerg{ 1599*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1600*4d6fc14bSjoerg __get_db()->__insert_c(this); 1601*4d6fc14bSjoerg#endif 1602*4d6fc14bSjoerg __table_.rehash(__u.bucket_count()); 1603*4d6fc14bSjoerg insert(__u.begin(), __u.end()); 1604*4d6fc14bSjoerg} 1605*4d6fc14bSjoerg 1606*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1607*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1608*4d6fc14bSjoerg const unordered_multiset& __u, const allocator_type& __a) 1609*4d6fc14bSjoerg : __table_(__u.__table_, __a) 1610*4d6fc14bSjoerg{ 1611*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1612*4d6fc14bSjoerg __get_db()->__insert_c(this); 1613*4d6fc14bSjoerg#endif 1614*4d6fc14bSjoerg __table_.rehash(__u.bucket_count()); 1615*4d6fc14bSjoerg insert(__u.begin(), __u.end()); 1616*4d6fc14bSjoerg} 1617*4d6fc14bSjoerg 1618*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 1619*4d6fc14bSjoerg 1620*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1621*4d6fc14bSjoerginline 1622*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1623*4d6fc14bSjoerg unordered_multiset&& __u) 1624*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 1625*4d6fc14bSjoerg : __table_(_VSTD::move(__u.__table_)) 1626*4d6fc14bSjoerg{ 1627*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1628*4d6fc14bSjoerg __get_db()->__insert_c(this); 1629*4d6fc14bSjoerg __get_db()->swap(this, &__u); 1630*4d6fc14bSjoerg#endif 1631*4d6fc14bSjoerg} 1632*4d6fc14bSjoerg 1633*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1634*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1635*4d6fc14bSjoerg unordered_multiset&& __u, const allocator_type& __a) 1636*4d6fc14bSjoerg : __table_(_VSTD::move(__u.__table_), __a) 1637*4d6fc14bSjoerg{ 1638*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1639*4d6fc14bSjoerg __get_db()->__insert_c(this); 1640*4d6fc14bSjoerg#endif 1641*4d6fc14bSjoerg if (__a != __u.get_allocator()) 1642*4d6fc14bSjoerg { 1643*4d6fc14bSjoerg iterator __i = __u.begin(); 1644*4d6fc14bSjoerg while (__u.size() != 0) 1645*4d6fc14bSjoerg __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); 1646*4d6fc14bSjoerg } 1647*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1648*4d6fc14bSjoerg else 1649*4d6fc14bSjoerg __get_db()->swap(this, &__u); 1650*4d6fc14bSjoerg#endif 1651*4d6fc14bSjoerg} 1652*4d6fc14bSjoerg 1653*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1654*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1655*4d6fc14bSjoerg initializer_list<value_type> __il) 1656*4d6fc14bSjoerg{ 1657*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1658*4d6fc14bSjoerg __get_db()->__insert_c(this); 1659*4d6fc14bSjoerg#endif 1660*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 1661*4d6fc14bSjoerg} 1662*4d6fc14bSjoerg 1663*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1664*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1665*4d6fc14bSjoerg initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1666*4d6fc14bSjoerg const key_equal& __eql) 1667*4d6fc14bSjoerg : __table_(__hf, __eql) 1668*4d6fc14bSjoerg{ 1669*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1670*4d6fc14bSjoerg __get_db()->__insert_c(this); 1671*4d6fc14bSjoerg#endif 1672*4d6fc14bSjoerg __table_.rehash(__n); 1673*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 1674*4d6fc14bSjoerg} 1675*4d6fc14bSjoerg 1676*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1677*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( 1678*4d6fc14bSjoerg initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1679*4d6fc14bSjoerg const key_equal& __eql, const allocator_type& __a) 1680*4d6fc14bSjoerg : __table_(__hf, __eql, __a) 1681*4d6fc14bSjoerg{ 1682*4d6fc14bSjoerg#if _LIBCPP_DEBUG_LEVEL == 2 1683*4d6fc14bSjoerg __get_db()->__insert_c(this); 1684*4d6fc14bSjoerg#endif 1685*4d6fc14bSjoerg __table_.rehash(__n); 1686*4d6fc14bSjoerg insert(__il.begin(), __il.end()); 1687*4d6fc14bSjoerg} 1688*4d6fc14bSjoerg 1689*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1690*4d6fc14bSjoerginline 1691*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 1692*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 1693*4d6fc14bSjoerg unordered_multiset&& __u) 1694*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 1695*4d6fc14bSjoerg{ 1696*4d6fc14bSjoerg __table_ = _VSTD::move(__u.__table_); 1697*4d6fc14bSjoerg return *this; 1698*4d6fc14bSjoerg} 1699*4d6fc14bSjoerg 1700*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1701*4d6fc14bSjoerginline 1702*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>& 1703*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( 1704*4d6fc14bSjoerg initializer_list<value_type> __il) 1705*4d6fc14bSjoerg{ 1706*4d6fc14bSjoerg __table_.__assign_multi(__il.begin(), __il.end()); 1707*4d6fc14bSjoerg return *this; 1708*4d6fc14bSjoerg} 1709*4d6fc14bSjoerg 1710*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 1711*4d6fc14bSjoerg 1712*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1713*4d6fc14bSjoergtemplate <class _InputIterator> 1714*4d6fc14bSjoerginline 1715*4d6fc14bSjoergvoid 1716*4d6fc14bSjoergunordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 1717*4d6fc14bSjoerg _InputIterator __last) 1718*4d6fc14bSjoerg{ 1719*4d6fc14bSjoerg for (; __first != __last; ++__first) 1720*4d6fc14bSjoerg __table_.__insert_multi(*__first); 1721*4d6fc14bSjoerg} 1722*4d6fc14bSjoerg 1723*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1724*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1725*4d6fc14bSjoergvoid 1726*4d6fc14bSjoergswap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 1727*4d6fc14bSjoerg unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 1728*4d6fc14bSjoerg _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 1729*4d6fc14bSjoerg{ 1730*4d6fc14bSjoerg __x.swap(__y); 1731*4d6fc14bSjoerg} 1732*4d6fc14bSjoerg 1733*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 17 1734*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc, 1735*4d6fc14bSjoerg class _Predicate> 1736*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1737*4d6fc14bSjoerg typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::size_type 1738*4d6fc14bSjoerg erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, 1739*4d6fc14bSjoerg _Predicate __pred) { 1740*4d6fc14bSjoerg return _VSTD::__libcpp_erase_if_container(__c, __pred); 1741*4d6fc14bSjoerg} 1742*4d6fc14bSjoerg#endif 1743*4d6fc14bSjoerg 1744*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1745*4d6fc14bSjoergbool 1746*4d6fc14bSjoergoperator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 1747*4d6fc14bSjoerg const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 1748*4d6fc14bSjoerg{ 1749*4d6fc14bSjoerg if (__x.size() != __y.size()) 1750*4d6fc14bSjoerg return false; 1751*4d6fc14bSjoerg typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator 1752*4d6fc14bSjoerg const_iterator; 1753*4d6fc14bSjoerg typedef pair<const_iterator, const_iterator> _EqRng; 1754*4d6fc14bSjoerg for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 1755*4d6fc14bSjoerg { 1756*4d6fc14bSjoerg _EqRng __xeq = __x.equal_range(*__i); 1757*4d6fc14bSjoerg _EqRng __yeq = __y.equal_range(*__i); 1758*4d6fc14bSjoerg if (_VSTD::distance(__xeq.first, __xeq.second) != 1759*4d6fc14bSjoerg _VSTD::distance(__yeq.first, __yeq.second) || 1760*4d6fc14bSjoerg !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 1761*4d6fc14bSjoerg return false; 1762*4d6fc14bSjoerg __i = __xeq.second; 1763*4d6fc14bSjoerg } 1764*4d6fc14bSjoerg return true; 1765*4d6fc14bSjoerg} 1766*4d6fc14bSjoerg 1767*4d6fc14bSjoergtemplate <class _Value, class _Hash, class _Pred, class _Alloc> 1768*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 1769*4d6fc14bSjoergbool 1770*4d6fc14bSjoergoperator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 1771*4d6fc14bSjoerg const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 1772*4d6fc14bSjoerg{ 1773*4d6fc14bSjoerg return !(__x == __y); 1774*4d6fc14bSjoerg} 1775*4d6fc14bSjoerg 1776*4d6fc14bSjoerg_LIBCPP_END_NAMESPACE_STD 1777*4d6fc14bSjoerg 1778*4d6fc14bSjoerg#endif // _LIBCPP_UNORDERED_SET 1779