1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*- 2*58b9f456SAndroid Build Coastguard Worker//===------------------------- hash_set ------------------------------------===// 3*58b9f456SAndroid Build Coastguard Worker// 4*58b9f456SAndroid Build Coastguard Worker// The LLVM Compiler Infrastructure 5*58b9f456SAndroid Build Coastguard Worker// 6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open 7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details. 8*58b9f456SAndroid Build Coastguard Worker// 9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 10*58b9f456SAndroid Build Coastguard Worker 11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HASH_SET 12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HASH_SET 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard Worker/* 15*58b9f456SAndroid Build Coastguard Worker 16*58b9f456SAndroid Build Coastguard Worker hash_set synopsis 17*58b9f456SAndroid Build Coastguard Worker 18*58b9f456SAndroid Build Coastguard Workernamespace __gnu_cxx 19*58b9f456SAndroid Build Coastguard Worker{ 20*58b9f456SAndroid Build Coastguard Worker 21*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 22*58b9f456SAndroid Build Coastguard Worker class Alloc = allocator<Value>> 23*58b9f456SAndroid Build Coastguard Workerclass hash_set 24*58b9f456SAndroid Build Coastguard Worker{ 25*58b9f456SAndroid Build Coastguard Workerpublic: 26*58b9f456SAndroid Build Coastguard Worker // types 27*58b9f456SAndroid Build Coastguard Worker typedef Value key_type; 28*58b9f456SAndroid Build Coastguard Worker typedef key_type value_type; 29*58b9f456SAndroid Build Coastguard Worker typedef Hash hasher; 30*58b9f456SAndroid Build Coastguard Worker typedef Pred key_equal; 31*58b9f456SAndroid Build Coastguard Worker typedef Alloc allocator_type; 32*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 33*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 34*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::pointer pointer; 35*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 36*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::size_type size_type; 37*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::difference_type difference_type; 38*58b9f456SAndroid Build Coastguard Worker 39*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ iterator; 40*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_iterator; 41*58b9f456SAndroid Build Coastguard Worker 42*58b9f456SAndroid Build Coastguard Worker explicit hash_set(size_type n = 193, const hasher& hf = hasher(), 43*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 44*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 45*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 46*58b9f456SAndroid Build Coastguard Worker hash_set(InputIterator f, InputIterator l, 47*58b9f456SAndroid Build Coastguard Worker size_type n = 193, const hasher& hf = hasher(), 48*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 49*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 50*58b9f456SAndroid Build Coastguard Worker hash_set(const hash_set&); 51*58b9f456SAndroid Build Coastguard Worker ~hash_set(); 52*58b9f456SAndroid Build Coastguard Worker hash_set& operator=(const hash_set&); 53*58b9f456SAndroid Build Coastguard Worker 54*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const; 55*58b9f456SAndroid Build Coastguard Worker 56*58b9f456SAndroid Build Coastguard Worker bool empty() const; 57*58b9f456SAndroid Build Coastguard Worker size_type size() const; 58*58b9f456SAndroid Build Coastguard Worker size_type max_size() const; 59*58b9f456SAndroid Build Coastguard Worker 60*58b9f456SAndroid Build Coastguard Worker iterator begin(); 61*58b9f456SAndroid Build Coastguard Worker iterator end(); 62*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const; 63*58b9f456SAndroid Build Coastguard Worker const_iterator end() const; 64*58b9f456SAndroid Build Coastguard Worker 65*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(const value_type& obj); 66*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 67*58b9f456SAndroid Build Coastguard Worker void insert(InputIterator first, InputIterator last); 68*58b9f456SAndroid Build Coastguard Worker 69*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator position); 70*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& k); 71*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator first, const_iterator last); 72*58b9f456SAndroid Build Coastguard Worker void clear(); 73*58b9f456SAndroid Build Coastguard Worker 74*58b9f456SAndroid Build Coastguard Worker void swap(hash_set&); 75*58b9f456SAndroid Build Coastguard Worker 76*58b9f456SAndroid Build Coastguard Worker hasher hash_funct() const; 77*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const; 78*58b9f456SAndroid Build Coastguard Worker 79*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& k); 80*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& k) const; 81*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& k) const; 82*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& k); 83*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 84*58b9f456SAndroid Build Coastguard Worker 85*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const; 86*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const; 87*58b9f456SAndroid Build Coastguard Worker 88*58b9f456SAndroid Build Coastguard Worker size_type elems_in_bucket(size_type n) const; 89*58b9f456SAndroid Build Coastguard Worker 90*58b9f456SAndroid Build Coastguard Worker void resize(size_type n); 91*58b9f456SAndroid Build Coastguard Worker}; 92*58b9f456SAndroid Build Coastguard Worker 93*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 94*58b9f456SAndroid Build Coastguard Worker void swap(hash_set<Value, Hash, Pred, Alloc>& x, 95*58b9f456SAndroid Build Coastguard Worker hash_set<Value, Hash, Pred, Alloc>& y); 96*58b9f456SAndroid Build Coastguard Worker 97*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 98*58b9f456SAndroid Build Coastguard Worker bool 99*58b9f456SAndroid Build Coastguard Worker operator==(const hash_set<Value, Hash, Pred, Alloc>& x, 100*58b9f456SAndroid Build Coastguard Worker const hash_set<Value, Hash, Pred, Alloc>& y); 101*58b9f456SAndroid Build Coastguard Worker 102*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 103*58b9f456SAndroid Build Coastguard Worker bool 104*58b9f456SAndroid Build Coastguard Worker operator!=(const hash_set<Value, Hash, Pred, Alloc>& x, 105*58b9f456SAndroid Build Coastguard Worker const hash_set<Value, Hash, Pred, Alloc>& y); 106*58b9f456SAndroid Build Coastguard Worker 107*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 108*58b9f456SAndroid Build Coastguard Worker class Alloc = allocator<Value>> 109*58b9f456SAndroid Build Coastguard Workerclass hash_multiset 110*58b9f456SAndroid Build Coastguard Worker{ 111*58b9f456SAndroid Build Coastguard Workerpublic: 112*58b9f456SAndroid Build Coastguard Worker // types 113*58b9f456SAndroid Build Coastguard Worker typedef Value key_type; 114*58b9f456SAndroid Build Coastguard Worker typedef key_type value_type; 115*58b9f456SAndroid Build Coastguard Worker typedef Hash hasher; 116*58b9f456SAndroid Build Coastguard Worker typedef Pred key_equal; 117*58b9f456SAndroid Build Coastguard Worker typedef Alloc allocator_type; 118*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 119*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 120*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::pointer pointer; 121*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 122*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::size_type size_type; 123*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::difference_type difference_type; 124*58b9f456SAndroid Build Coastguard Worker 125*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ iterator; 126*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_iterator; 127*58b9f456SAndroid Build Coastguard Worker 128*58b9f456SAndroid Build Coastguard Worker explicit hash_multiset(size_type n = 193, const hasher& hf = hasher(), 129*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 130*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 131*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 132*58b9f456SAndroid Build Coastguard Worker hash_multiset(InputIterator f, InputIterator l, 133*58b9f456SAndroid Build Coastguard Worker size_type n = 193, const hasher& hf = hasher(), 134*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 135*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 136*58b9f456SAndroid Build Coastguard Worker hash_multiset(const hash_multiset&); 137*58b9f456SAndroid Build Coastguard Worker ~hash_multiset(); 138*58b9f456SAndroid Build Coastguard Worker hash_multiset& operator=(const hash_multiset&); 139*58b9f456SAndroid Build Coastguard Worker 140*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const; 141*58b9f456SAndroid Build Coastguard Worker 142*58b9f456SAndroid Build Coastguard Worker bool empty() const; 143*58b9f456SAndroid Build Coastguard Worker size_type size() const; 144*58b9f456SAndroid Build Coastguard Worker size_type max_size() const; 145*58b9f456SAndroid Build Coastguard Worker 146*58b9f456SAndroid Build Coastguard Worker iterator begin(); 147*58b9f456SAndroid Build Coastguard Worker iterator end(); 148*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const; 149*58b9f456SAndroid Build Coastguard Worker const_iterator end() const; 150*58b9f456SAndroid Build Coastguard Worker 151*58b9f456SAndroid Build Coastguard Worker iterator insert(const value_type& obj); 152*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 153*58b9f456SAndroid Build Coastguard Worker void insert(InputIterator first, InputIterator last); 154*58b9f456SAndroid Build Coastguard Worker 155*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator position); 156*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& k); 157*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator first, const_iterator last); 158*58b9f456SAndroid Build Coastguard Worker void clear(); 159*58b9f456SAndroid Build Coastguard Worker 160*58b9f456SAndroid Build Coastguard Worker void swap(hash_multiset&); 161*58b9f456SAndroid Build Coastguard Worker 162*58b9f456SAndroid Build Coastguard Worker hasher hash_funct() const; 163*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const; 164*58b9f456SAndroid Build Coastguard Worker 165*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& k); 166*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& k) const; 167*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& k) const; 168*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& k); 169*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 170*58b9f456SAndroid Build Coastguard Worker 171*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const; 172*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const; 173*58b9f456SAndroid Build Coastguard Worker 174*58b9f456SAndroid Build Coastguard Worker size_type elems_in_bucket(size_type n) const; 175*58b9f456SAndroid Build Coastguard Worker 176*58b9f456SAndroid Build Coastguard Worker void resize(size_type n); 177*58b9f456SAndroid Build Coastguard Worker}; 178*58b9f456SAndroid Build Coastguard Worker 179*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 180*58b9f456SAndroid Build Coastguard Worker void swap(hash_multiset<Value, Hash, Pred, Alloc>& x, 181*58b9f456SAndroid Build Coastguard Worker hash_multiset<Value, Hash, Pred, Alloc>& y); 182*58b9f456SAndroid Build Coastguard Worker 183*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 184*58b9f456SAndroid Build Coastguard Worker bool 185*58b9f456SAndroid Build Coastguard Worker operator==(const hash_multiset<Value, Hash, Pred, Alloc>& x, 186*58b9f456SAndroid Build Coastguard Worker const hash_multiset<Value, Hash, Pred, Alloc>& y); 187*58b9f456SAndroid Build Coastguard Worker 188*58b9f456SAndroid Build Coastguard Workertemplate <class Value, class Hash, class Pred, class Alloc> 189*58b9f456SAndroid Build Coastguard Worker bool 190*58b9f456SAndroid Build Coastguard Worker operator!=(const hash_multiset<Value, Hash, Pred, Alloc>& x, 191*58b9f456SAndroid Build Coastguard Worker const hash_multiset<Value, Hash, Pred, Alloc>& y); 192*58b9f456SAndroid Build Coastguard Worker} // __gnu_cxx 193*58b9f456SAndroid Build Coastguard Worker 194*58b9f456SAndroid Build Coastguard Worker*/ 195*58b9f456SAndroid Build Coastguard Worker 196*58b9f456SAndroid Build Coastguard Worker#include <__config> 197*58b9f456SAndroid Build Coastguard Worker#include <__hash_table> 198*58b9f456SAndroid Build Coastguard Worker#include <functional> 199*58b9f456SAndroid Build Coastguard Worker#include <ext/__hash> 200*58b9f456SAndroid Build Coastguard Worker 201*58b9f456SAndroid Build Coastguard Worker#if __DEPRECATED 202*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_WARNING) 203*58b9f456SAndroid Build Coastguard Worker _LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>") 204*58b9f456SAndroid Build Coastguard Worker#else 205*58b9f456SAndroid Build Coastguard Worker# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set> 206*58b9f456SAndroid Build Coastguard Worker#endif 207*58b9f456SAndroid Build Coastguard Worker#endif 208*58b9f456SAndroid Build Coastguard Worker 209*58b9f456SAndroid Build Coastguard Workernamespace __gnu_cxx { 210*58b9f456SAndroid Build Coastguard Worker 211*58b9f456SAndroid Build Coastguard Workerusing namespace std; 212*58b9f456SAndroid Build Coastguard Worker 213*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 214*58b9f456SAndroid Build Coastguard Worker class _Alloc = allocator<_Value> > 215*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS hash_set 216*58b9f456SAndroid Build Coastguard Worker{ 217*58b9f456SAndroid Build Coastguard Workerpublic: 218*58b9f456SAndroid Build Coastguard Worker // types 219*58b9f456SAndroid Build Coastguard Worker typedef _Value key_type; 220*58b9f456SAndroid Build Coastguard Worker typedef key_type value_type; 221*58b9f456SAndroid Build Coastguard Worker typedef _Hash hasher; 222*58b9f456SAndroid Build Coastguard Worker typedef _Pred key_equal; 223*58b9f456SAndroid Build Coastguard Worker typedef _Alloc allocator_type; 224*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 225*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 226*58b9f456SAndroid Build Coastguard Worker 227*58b9f456SAndroid Build Coastguard Workerprivate: 228*58b9f456SAndroid Build Coastguard Worker typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 229*58b9f456SAndroid Build Coastguard Worker 230*58b9f456SAndroid Build Coastguard Worker __table __table_; 231*58b9f456SAndroid Build Coastguard Worker 232*58b9f456SAndroid Build Coastguard Workerpublic: 233*58b9f456SAndroid Build Coastguard Worker typedef typename __table::pointer pointer; 234*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_pointer const_pointer; 235*58b9f456SAndroid Build Coastguard Worker typedef typename __table::size_type size_type; 236*58b9f456SAndroid Build Coastguard Worker typedef typename __table::difference_type difference_type; 237*58b9f456SAndroid Build Coastguard Worker 238*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_iterator iterator; 239*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_iterator const_iterator; 240*58b9f456SAndroid Build Coastguard Worker 241*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 242*58b9f456SAndroid Build Coastguard Worker hash_set() {__table_.rehash(193);} 243*58b9f456SAndroid Build Coastguard Worker explicit hash_set(size_type __n, const hasher& __hf = hasher(), 244*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 245*58b9f456SAndroid Build Coastguard Worker hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, 246*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 247*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 248*58b9f456SAndroid Build Coastguard Worker hash_set(_InputIterator __first, _InputIterator __last); 249*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 250*58b9f456SAndroid Build Coastguard Worker hash_set(_InputIterator __first, _InputIterator __last, 251*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf = hasher(), 252*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 253*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 254*58b9f456SAndroid Build Coastguard Worker hash_set(_InputIterator __first, _InputIterator __last, 255*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql, 256*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 257*58b9f456SAndroid Build Coastguard Worker hash_set(const hash_set& __u); 258*58b9f456SAndroid Build Coastguard Worker 259*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 260*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const 261*58b9f456SAndroid Build Coastguard Worker {return allocator_type(__table_.__node_alloc());} 262*58b9f456SAndroid Build Coastguard Worker 263*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 264*58b9f456SAndroid Build Coastguard Worker bool empty() const {return __table_.size() == 0;} 265*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 266*58b9f456SAndroid Build Coastguard Worker size_type size() const {return __table_.size();} 267*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 268*58b9f456SAndroid Build Coastguard Worker size_type max_size() const {return __table_.max_size();} 269*58b9f456SAndroid Build Coastguard Worker 270*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 271*58b9f456SAndroid Build Coastguard Worker iterator begin() {return __table_.begin();} 272*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 273*58b9f456SAndroid Build Coastguard Worker iterator end() {return __table_.end();} 274*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 275*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const {return __table_.begin();} 276*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 277*58b9f456SAndroid Build Coastguard Worker const_iterator end() const {return __table_.end();} 278*58b9f456SAndroid Build Coastguard Worker 279*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 280*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(const value_type& __x) 281*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_unique(__x);} 282*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 283*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;} 284*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 285*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 286*58b9f456SAndroid Build Coastguard Worker void insert(_InputIterator __first, _InputIterator __last); 287*58b9f456SAndroid Build Coastguard Worker 288*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 289*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator __p) {__table_.erase(__p);} 290*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 291*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 292*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 293*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator __first, const_iterator __last) 294*58b9f456SAndroid Build Coastguard Worker {__table_.erase(__first, __last);} 295*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 296*58b9f456SAndroid Build Coastguard Worker void clear() {__table_.clear();} 297*58b9f456SAndroid Build Coastguard Worker 298*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 299*58b9f456SAndroid Build Coastguard Worker void swap(hash_set& __u) {__table_.swap(__u.__table_);} 300*58b9f456SAndroid Build Coastguard Worker 301*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 302*58b9f456SAndroid Build Coastguard Worker hasher hash_funct() const {return __table_.hash_function();} 303*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 304*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const {return __table_.key_eq();} 305*58b9f456SAndroid Build Coastguard Worker 306*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 307*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& __k) {return __table_.find(__k);} 308*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 309*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& __k) const {return __table_.find(__k);} 310*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 311*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 312*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 313*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& __k) 314*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_unique(__k);} 315*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 316*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 317*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_unique(__k);} 318*58b9f456SAndroid Build Coastguard Worker 319*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 320*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const {return __table_.bucket_count();} 321*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 322*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const {return __table_.max_bucket_count();} 323*58b9f456SAndroid Build Coastguard Worker 324*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 325*58b9f456SAndroid Build Coastguard Worker size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);} 326*58b9f456SAndroid Build Coastguard Worker 327*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 328*58b9f456SAndroid Build Coastguard Worker void resize(size_type __n) {__table_.rehash(__n);} 329*58b9f456SAndroid Build Coastguard Worker}; 330*58b9f456SAndroid Build Coastguard Worker 331*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 332*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n, 333*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql) 334*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 335*58b9f456SAndroid Build Coastguard Worker{ 336*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 337*58b9f456SAndroid Build Coastguard Worker} 338*58b9f456SAndroid Build Coastguard Worker 339*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 340*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(size_type __n, 341*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 342*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, __a) 343*58b9f456SAndroid Build Coastguard Worker{ 344*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 345*58b9f456SAndroid Build Coastguard Worker} 346*58b9f456SAndroid Build Coastguard Worker 347*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 348*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 349*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set( 350*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last) 351*58b9f456SAndroid Build Coastguard Worker{ 352*58b9f456SAndroid Build Coastguard Worker __table_.rehash(193); 353*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 354*58b9f456SAndroid Build Coastguard Worker} 355*58b9f456SAndroid Build Coastguard Worker 356*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 357*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 358*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set( 359*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 360*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql) 361*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 362*58b9f456SAndroid Build Coastguard Worker{ 363*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 364*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 365*58b9f456SAndroid Build Coastguard Worker} 366*58b9f456SAndroid Build Coastguard Worker 367*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 368*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 369*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set( 370*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 371*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 372*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, __a) 373*58b9f456SAndroid Build Coastguard Worker{ 374*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 375*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 376*58b9f456SAndroid Build Coastguard Worker} 377*58b9f456SAndroid Build Coastguard Worker 378*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 379*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::hash_set( 380*58b9f456SAndroid Build Coastguard Worker const hash_set& __u) 381*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_) 382*58b9f456SAndroid Build Coastguard Worker{ 383*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 384*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 385*58b9f456SAndroid Build Coastguard Worker} 386*58b9f456SAndroid Build Coastguard Worker 387*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 388*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 389*58b9f456SAndroid Build Coastguard Workerinline 390*58b9f456SAndroid Build Coastguard Workervoid 391*58b9f456SAndroid Build Coastguard Workerhash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 392*58b9f456SAndroid Build Coastguard Worker _InputIterator __last) 393*58b9f456SAndroid Build Coastguard Worker{ 394*58b9f456SAndroid Build Coastguard Worker for (; __first != __last; ++__first) 395*58b9f456SAndroid Build Coastguard Worker __table_.__insert_unique(*__first); 396*58b9f456SAndroid Build Coastguard Worker} 397*58b9f456SAndroid Build Coastguard Worker 398*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 399*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 400*58b9f456SAndroid Build Coastguard Workervoid 401*58b9f456SAndroid Build Coastguard Workerswap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x, 402*58b9f456SAndroid Build Coastguard Worker hash_set<_Value, _Hash, _Pred, _Alloc>& __y) 403*58b9f456SAndroid Build Coastguard Worker{ 404*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 405*58b9f456SAndroid Build Coastguard Worker} 406*58b9f456SAndroid Build Coastguard Worker 407*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 408*58b9f456SAndroid Build Coastguard Workerbool 409*58b9f456SAndroid Build Coastguard Workeroperator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, 410*58b9f456SAndroid Build Coastguard Worker const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) 411*58b9f456SAndroid Build Coastguard Worker{ 412*58b9f456SAndroid Build Coastguard Worker if (__x.size() != __y.size()) 413*58b9f456SAndroid Build Coastguard Worker return false; 414*58b9f456SAndroid Build Coastguard Worker typedef typename hash_set<_Value, _Hash, _Pred, _Alloc>::const_iterator 415*58b9f456SAndroid Build Coastguard Worker const_iterator; 416*58b9f456SAndroid Build Coastguard Worker for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 417*58b9f456SAndroid Build Coastguard Worker __i != __ex; ++__i) 418*58b9f456SAndroid Build Coastguard Worker { 419*58b9f456SAndroid Build Coastguard Worker const_iterator __j = __y.find(*__i); 420*58b9f456SAndroid Build Coastguard Worker if (__j == __ey || !(*__i == *__j)) 421*58b9f456SAndroid Build Coastguard Worker return false; 422*58b9f456SAndroid Build Coastguard Worker } 423*58b9f456SAndroid Build Coastguard Worker return true; 424*58b9f456SAndroid Build Coastguard Worker} 425*58b9f456SAndroid Build Coastguard Worker 426*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 427*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 428*58b9f456SAndroid Build Coastguard Workerbool 429*58b9f456SAndroid Build Coastguard Workeroperator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x, 430*58b9f456SAndroid Build Coastguard Worker const hash_set<_Value, _Hash, _Pred, _Alloc>& __y) 431*58b9f456SAndroid Build Coastguard Worker{ 432*58b9f456SAndroid Build Coastguard Worker return !(__x == __y); 433*58b9f456SAndroid Build Coastguard Worker} 434*58b9f456SAndroid Build Coastguard Worker 435*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, 436*58b9f456SAndroid Build Coastguard Worker class _Alloc = allocator<_Value> > 437*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS hash_multiset 438*58b9f456SAndroid Build Coastguard Worker{ 439*58b9f456SAndroid Build Coastguard Workerpublic: 440*58b9f456SAndroid Build Coastguard Worker // types 441*58b9f456SAndroid Build Coastguard Worker typedef _Value key_type; 442*58b9f456SAndroid Build Coastguard Worker typedef key_type value_type; 443*58b9f456SAndroid Build Coastguard Worker typedef _Hash hasher; 444*58b9f456SAndroid Build Coastguard Worker typedef _Pred key_equal; 445*58b9f456SAndroid Build Coastguard Worker typedef _Alloc allocator_type; 446*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 447*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 448*58b9f456SAndroid Build Coastguard Worker 449*58b9f456SAndroid Build Coastguard Workerprivate: 450*58b9f456SAndroid Build Coastguard Worker typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; 451*58b9f456SAndroid Build Coastguard Worker 452*58b9f456SAndroid Build Coastguard Worker __table __table_; 453*58b9f456SAndroid Build Coastguard Worker 454*58b9f456SAndroid Build Coastguard Workerpublic: 455*58b9f456SAndroid Build Coastguard Worker typedef typename __table::pointer pointer; 456*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_pointer const_pointer; 457*58b9f456SAndroid Build Coastguard Worker typedef typename __table::size_type size_type; 458*58b9f456SAndroid Build Coastguard Worker typedef typename __table::difference_type difference_type; 459*58b9f456SAndroid Build Coastguard Worker 460*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_iterator iterator; 461*58b9f456SAndroid Build Coastguard Worker typedef typename __table::const_iterator const_iterator; 462*58b9f456SAndroid Build Coastguard Worker 463*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 464*58b9f456SAndroid Build Coastguard Worker hash_multiset() {__table_.rehash(193);} 465*58b9f456SAndroid Build Coastguard Worker explicit hash_multiset(size_type __n, const hasher& __hf = hasher(), 466*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 467*58b9f456SAndroid Build Coastguard Worker hash_multiset(size_type __n, const hasher& __hf, 468*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, const allocator_type& __a); 469*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 470*58b9f456SAndroid Build Coastguard Worker hash_multiset(_InputIterator __first, _InputIterator __last); 471*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 472*58b9f456SAndroid Build Coastguard Worker hash_multiset(_InputIterator __first, _InputIterator __last, 473*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf = hasher(), 474*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 475*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 476*58b9f456SAndroid Build Coastguard Worker hash_multiset(_InputIterator __first, _InputIterator __last, 477*58b9f456SAndroid Build Coastguard Worker size_type __n , const hasher& __hf, 478*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, const allocator_type& __a); 479*58b9f456SAndroid Build Coastguard Worker hash_multiset(const hash_multiset& __u); 480*58b9f456SAndroid Build Coastguard Worker 481*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 482*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const 483*58b9f456SAndroid Build Coastguard Worker {return allocator_type(__table_.__node_alloc());} 484*58b9f456SAndroid Build Coastguard Worker 485*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 486*58b9f456SAndroid Build Coastguard Worker bool empty() const {return __table_.size() == 0;} 487*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 488*58b9f456SAndroid Build Coastguard Worker size_type size() const {return __table_.size();} 489*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 490*58b9f456SAndroid Build Coastguard Worker size_type max_size() const {return __table_.max_size();} 491*58b9f456SAndroid Build Coastguard Worker 492*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 493*58b9f456SAndroid Build Coastguard Worker iterator begin() {return __table_.begin();} 494*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 495*58b9f456SAndroid Build Coastguard Worker iterator end() {return __table_.end();} 496*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 497*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const {return __table_.begin();} 498*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 499*58b9f456SAndroid Build Coastguard Worker const_iterator end() const {return __table_.end();} 500*58b9f456SAndroid Build Coastguard Worker 501*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 502*58b9f456SAndroid Build Coastguard Worker iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 503*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 504*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator, const value_type& __x) {return insert(__x);} 505*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 506*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 507*58b9f456SAndroid Build Coastguard Worker void insert(_InputIterator __first, _InputIterator __last); 508*58b9f456SAndroid Build Coastguard Worker 509*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 510*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator __p) {__table_.erase(__p);} 511*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 512*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 513*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 514*58b9f456SAndroid Build Coastguard Worker void erase(const_iterator __first, const_iterator __last) 515*58b9f456SAndroid Build Coastguard Worker {__table_.erase(__first, __last);} 516*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 517*58b9f456SAndroid Build Coastguard Worker void clear() {__table_.clear();} 518*58b9f456SAndroid Build Coastguard Worker 519*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 520*58b9f456SAndroid Build Coastguard Worker void swap(hash_multiset& __u) {__table_.swap(__u.__table_);} 521*58b9f456SAndroid Build Coastguard Worker 522*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 523*58b9f456SAndroid Build Coastguard Worker hasher hash_funct() const {return __table_.hash_function();} 524*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 525*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const {return __table_.key_eq();} 526*58b9f456SAndroid Build Coastguard Worker 527*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 528*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& __k) {return __table_.find(__k);} 529*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 530*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& __k) const {return __table_.find(__k);} 531*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 532*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 533*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 534*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& __k) 535*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_multi(__k);} 536*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 537*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 538*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_multi(__k);} 539*58b9f456SAndroid Build Coastguard Worker 540*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 541*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const {return __table_.bucket_count();} 542*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 543*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const {return __table_.max_bucket_count();} 544*58b9f456SAndroid Build Coastguard Worker 545*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 546*58b9f456SAndroid Build Coastguard Worker size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);} 547*58b9f456SAndroid Build Coastguard Worker 548*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 549*58b9f456SAndroid Build Coastguard Worker void resize(size_type __n) {__table_.rehash(__n);} 550*58b9f456SAndroid Build Coastguard Worker}; 551*58b9f456SAndroid Build Coastguard Worker 552*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 553*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 554*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql) 555*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 556*58b9f456SAndroid Build Coastguard Worker{ 557*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 558*58b9f456SAndroid Build Coastguard Worker} 559*58b9f456SAndroid Build Coastguard Worker 560*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 561*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 562*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql, 563*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 564*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, __a) 565*58b9f456SAndroid Build Coastguard Worker{ 566*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 567*58b9f456SAndroid Build Coastguard Worker} 568*58b9f456SAndroid Build Coastguard Worker 569*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 570*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 571*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 572*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last) 573*58b9f456SAndroid Build Coastguard Worker{ 574*58b9f456SAndroid Build Coastguard Worker __table_.rehash(193); 575*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 576*58b9f456SAndroid Build Coastguard Worker} 577*58b9f456SAndroid Build Coastguard Worker 578*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 579*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 580*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 581*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 582*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql) 583*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 584*58b9f456SAndroid Build Coastguard Worker{ 585*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 586*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 587*58b9f456SAndroid Build Coastguard Worker} 588*58b9f456SAndroid Build Coastguard Worker 589*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 590*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 591*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 592*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 593*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 594*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, __a) 595*58b9f456SAndroid Build Coastguard Worker{ 596*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 597*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 598*58b9f456SAndroid Build Coastguard Worker} 599*58b9f456SAndroid Build Coastguard Worker 600*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 601*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( 602*58b9f456SAndroid Build Coastguard Worker const hash_multiset& __u) 603*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_) 604*58b9f456SAndroid Build Coastguard Worker{ 605*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 606*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 607*58b9f456SAndroid Build Coastguard Worker} 608*58b9f456SAndroid Build Coastguard Worker 609*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 610*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 611*58b9f456SAndroid Build Coastguard Workerinline 612*58b9f456SAndroid Build Coastguard Workervoid 613*58b9f456SAndroid Build Coastguard Workerhash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 614*58b9f456SAndroid Build Coastguard Worker _InputIterator __last) 615*58b9f456SAndroid Build Coastguard Worker{ 616*58b9f456SAndroid Build Coastguard Worker for (; __first != __last; ++__first) 617*58b9f456SAndroid Build Coastguard Worker __table_.__insert_multi(*__first); 618*58b9f456SAndroid Build Coastguard Worker} 619*58b9f456SAndroid Build Coastguard Worker 620*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 621*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 622*58b9f456SAndroid Build Coastguard Workervoid 623*58b9f456SAndroid Build Coastguard Workerswap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 624*58b9f456SAndroid Build Coastguard Worker hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 625*58b9f456SAndroid Build Coastguard Worker{ 626*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 627*58b9f456SAndroid Build Coastguard Worker} 628*58b9f456SAndroid Build Coastguard Worker 629*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 630*58b9f456SAndroid Build Coastguard Workerbool 631*58b9f456SAndroid Build Coastguard Workeroperator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 632*58b9f456SAndroid Build Coastguard Worker const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 633*58b9f456SAndroid Build Coastguard Worker{ 634*58b9f456SAndroid Build Coastguard Worker if (__x.size() != __y.size()) 635*58b9f456SAndroid Build Coastguard Worker return false; 636*58b9f456SAndroid Build Coastguard Worker typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator 637*58b9f456SAndroid Build Coastguard Worker const_iterator; 638*58b9f456SAndroid Build Coastguard Worker typedef pair<const_iterator, const_iterator> _EqRng; 639*58b9f456SAndroid Build Coastguard Worker for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 640*58b9f456SAndroid Build Coastguard Worker { 641*58b9f456SAndroid Build Coastguard Worker _EqRng __xeq = __x.equal_range(*__i); 642*58b9f456SAndroid Build Coastguard Worker _EqRng __yeq = __y.equal_range(*__i); 643*58b9f456SAndroid Build Coastguard Worker if (_VSTD::distance(__xeq.first, __xeq.second) != 644*58b9f456SAndroid Build Coastguard Worker _VSTD::distance(__yeq.first, __yeq.second) || 645*58b9f456SAndroid Build Coastguard Worker !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 646*58b9f456SAndroid Build Coastguard Worker return false; 647*58b9f456SAndroid Build Coastguard Worker __i = __xeq.second; 648*58b9f456SAndroid Build Coastguard Worker } 649*58b9f456SAndroid Build Coastguard Worker return true; 650*58b9f456SAndroid Build Coastguard Worker} 651*58b9f456SAndroid Build Coastguard Worker 652*58b9f456SAndroid Build Coastguard Workertemplate <class _Value, class _Hash, class _Pred, class _Alloc> 653*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 654*58b9f456SAndroid Build Coastguard Workerbool 655*58b9f456SAndroid Build Coastguard Workeroperator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, 656*58b9f456SAndroid Build Coastguard Worker const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y) 657*58b9f456SAndroid Build Coastguard Worker{ 658*58b9f456SAndroid Build Coastguard Worker return !(__x == __y); 659*58b9f456SAndroid Build Coastguard Worker} 660*58b9f456SAndroid Build Coastguard Worker 661*58b9f456SAndroid Build Coastguard Worker} // __gnu_cxx 662*58b9f456SAndroid Build Coastguard Worker 663*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_HASH_SET 664