1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*- 2*58b9f456SAndroid Build Coastguard Worker//===-------------------------- unordered_map -----------------------------===// 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_UNORDERED_MAP 12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_UNORDERED_MAP 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard Worker/* 15*58b9f456SAndroid Build Coastguard Worker 16*58b9f456SAndroid Build Coastguard Worker unordered_map synopsis 17*58b9f456SAndroid Build Coastguard Worker 18*58b9f456SAndroid Build Coastguard Worker#include <initializer_list> 19*58b9f456SAndroid Build Coastguard Worker 20*58b9f456SAndroid Build Coastguard Workernamespace std 21*58b9f456SAndroid Build Coastguard Worker{ 22*58b9f456SAndroid Build Coastguard Worker 23*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 24*58b9f456SAndroid Build Coastguard Worker class Alloc = allocator<pair<const Key, T>>> 25*58b9f456SAndroid Build Coastguard Workerclass unordered_map 26*58b9f456SAndroid Build Coastguard Worker{ 27*58b9f456SAndroid Build Coastguard Workerpublic: 28*58b9f456SAndroid Build Coastguard Worker // types 29*58b9f456SAndroid Build Coastguard Worker typedef Key key_type; 30*58b9f456SAndroid Build Coastguard Worker typedef T mapped_type; 31*58b9f456SAndroid Build Coastguard Worker typedef Hash hasher; 32*58b9f456SAndroid Build Coastguard Worker typedef Pred key_equal; 33*58b9f456SAndroid Build Coastguard Worker typedef Alloc allocator_type; 34*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 35*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 36*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 37*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::pointer pointer; 38*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 39*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::size_type size_type; 40*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::difference_type difference_type; 41*58b9f456SAndroid Build Coastguard Worker 42*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ iterator; 43*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_iterator; 44*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ local_iterator; 45*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_local_iterator; 46*58b9f456SAndroid Build Coastguard Worker 47*58b9f456SAndroid Build Coastguard Worker typedef unspecified node_type; // C++17 48*58b9f456SAndroid Build Coastguard Worker typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 49*58b9f456SAndroid Build Coastguard Worker 50*58b9f456SAndroid Build Coastguard Worker unordered_map() 51*58b9f456SAndroid Build Coastguard Worker noexcept( 52*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<hasher>::value && 53*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<key_equal>::value && 54*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<allocator_type>::value); 55*58b9f456SAndroid Build Coastguard Worker explicit unordered_map(size_type n, const hasher& hf = hasher(), 56*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 57*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 58*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 59*58b9f456SAndroid Build Coastguard Worker unordered_map(InputIterator f, InputIterator l, 60*58b9f456SAndroid Build Coastguard Worker size_type n = 0, const hasher& hf = hasher(), 61*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 62*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 63*58b9f456SAndroid Build Coastguard Worker explicit unordered_map(const allocator_type&); 64*58b9f456SAndroid Build Coastguard Worker unordered_map(const unordered_map&); 65*58b9f456SAndroid Build Coastguard Worker unordered_map(const unordered_map&, const Allocator&); 66*58b9f456SAndroid Build Coastguard Worker unordered_map(unordered_map&&) 67*58b9f456SAndroid Build Coastguard Worker noexcept( 68*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<hasher>::value && 69*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<key_equal>::value && 70*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<allocator_type>::value); 71*58b9f456SAndroid Build Coastguard Worker unordered_map(unordered_map&&, const Allocator&); 72*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type>, size_type n = 0, 73*58b9f456SAndroid Build Coastguard Worker const hasher& hf = hasher(), const key_equal& eql = key_equal(), 74*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 75*58b9f456SAndroid Build Coastguard Worker unordered_map(size_type n, const allocator_type& a) 76*58b9f456SAndroid Build Coastguard Worker : unordered_map(n, hasher(), key_equal(), a) {} // C++14 77*58b9f456SAndroid Build Coastguard Worker unordered_map(size_type n, const hasher& hf, const allocator_type& a) 78*58b9f456SAndroid Build Coastguard Worker : unordered_map(n, hf, key_equal(), a) {} // C++14 79*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 80*58b9f456SAndroid Build Coastguard Worker unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a) 81*58b9f456SAndroid Build Coastguard Worker : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14 82*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 83*58b9f456SAndroid Build Coastguard Worker unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, 84*58b9f456SAndroid Build Coastguard Worker const allocator_type& a) 85*58b9f456SAndroid Build Coastguard Worker : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14 86*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a) 87*58b9f456SAndroid Build Coastguard Worker : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14 88*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, 89*58b9f456SAndroid Build Coastguard Worker const allocator_type& a) 90*58b9f456SAndroid Build Coastguard Worker : unordered_map(il, n, hf, key_equal(), a) {} // C++14 91*58b9f456SAndroid Build Coastguard Worker ~unordered_map(); 92*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(const unordered_map&); 93*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(unordered_map&&) 94*58b9f456SAndroid Build Coastguard Worker noexcept( 95*58b9f456SAndroid Build Coastguard Worker allocator_type::propagate_on_container_move_assignment::value && 96*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<allocator_type>::value && 97*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<hasher>::value && 98*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<key_equal>::value); 99*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(initializer_list<value_type>); 100*58b9f456SAndroid Build Coastguard Worker 101*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const noexcept; 102*58b9f456SAndroid Build Coastguard Worker 103*58b9f456SAndroid Build Coastguard Worker bool empty() const noexcept; 104*58b9f456SAndroid Build Coastguard Worker size_type size() const noexcept; 105*58b9f456SAndroid Build Coastguard Worker size_type max_size() const noexcept; 106*58b9f456SAndroid Build Coastguard Worker 107*58b9f456SAndroid Build Coastguard Worker iterator begin() noexcept; 108*58b9f456SAndroid Build Coastguard Worker iterator end() noexcept; 109*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const noexcept; 110*58b9f456SAndroid Build Coastguard Worker const_iterator end() const noexcept; 111*58b9f456SAndroid Build Coastguard Worker const_iterator cbegin() const noexcept; 112*58b9f456SAndroid Build Coastguard Worker const_iterator cend() const noexcept; 113*58b9f456SAndroid Build Coastguard Worker 114*58b9f456SAndroid Build Coastguard Worker template <class... Args> 115*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> emplace(Args&&... args); 116*58b9f456SAndroid Build Coastguard Worker template <class... Args> 117*58b9f456SAndroid Build Coastguard Worker iterator emplace_hint(const_iterator position, Args&&... args); 118*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(const value_type& obj); 119*58b9f456SAndroid Build Coastguard Worker template <class P> 120*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(P&& obj); 121*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, const value_type& obj); 122*58b9f456SAndroid Build Coastguard Worker template <class P> 123*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, P&& obj); 124*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 125*58b9f456SAndroid Build Coastguard Worker void insert(InputIterator first, InputIterator last); 126*58b9f456SAndroid Build Coastguard Worker void insert(initializer_list<value_type>); 127*58b9f456SAndroid Build Coastguard Worker 128*58b9f456SAndroid Build Coastguard Worker node_type extract(const_iterator position); // C++17 129*58b9f456SAndroid Build Coastguard Worker node_type extract(const key_type& x); // C++17 130*58b9f456SAndroid Build Coastguard Worker insert_return_type insert(node_type&& nh); // C++17 131*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, node_type&& nh); // C++17 132*58b9f456SAndroid Build Coastguard Worker 133*58b9f456SAndroid Build Coastguard Worker template <class... Args> 134*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17 135*58b9f456SAndroid Build Coastguard Worker template <class... Args> 136*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17 137*58b9f456SAndroid Build Coastguard Worker template <class... Args> 138*58b9f456SAndroid Build Coastguard Worker iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17 139*58b9f456SAndroid Build Coastguard Worker template <class... Args> 140*58b9f456SAndroid Build Coastguard Worker iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 141*58b9f456SAndroid Build Coastguard Worker template <class M> 142*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17 143*58b9f456SAndroid Build Coastguard Worker template <class M> 144*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17 145*58b9f456SAndroid Build Coastguard Worker template <class M> 146*58b9f456SAndroid Build Coastguard Worker iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17 147*58b9f456SAndroid Build Coastguard Worker template <class M> 148*58b9f456SAndroid Build Coastguard Worker iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 149*58b9f456SAndroid Build Coastguard Worker 150*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator position); 151*58b9f456SAndroid Build Coastguard Worker iterator erase(iterator position); // C++14 152*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& k); 153*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator first, const_iterator last); 154*58b9f456SAndroid Build Coastguard Worker void clear() noexcept; 155*58b9f456SAndroid Build Coastguard Worker 156*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 157*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17 158*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 159*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17 160*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 161*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17 162*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 163*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17 164*58b9f456SAndroid Build Coastguard Worker 165*58b9f456SAndroid Build Coastguard Worker void swap(unordered_map&) 166*58b9f456SAndroid Build Coastguard Worker noexcept( 167*58b9f456SAndroid Build Coastguard Worker (!allocator_type::propagate_on_container_swap::value || 168*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<allocator_type>::value) && 169*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<hasher>::value && 170*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<key_equal>::value); 171*58b9f456SAndroid Build Coastguard Worker 172*58b9f456SAndroid Build Coastguard Worker hasher hash_function() const; 173*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const; 174*58b9f456SAndroid Build Coastguard Worker 175*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& k); 176*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& k) const; 177*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& k) const; 178*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& k); 179*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 180*58b9f456SAndroid Build Coastguard Worker 181*58b9f456SAndroid Build Coastguard Worker mapped_type& operator[](const key_type& k); 182*58b9f456SAndroid Build Coastguard Worker mapped_type& operator[](key_type&& k); 183*58b9f456SAndroid Build Coastguard Worker 184*58b9f456SAndroid Build Coastguard Worker mapped_type& at(const key_type& k); 185*58b9f456SAndroid Build Coastguard Worker const mapped_type& at(const key_type& k) const; 186*58b9f456SAndroid Build Coastguard Worker 187*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const noexcept; 188*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const noexcept; 189*58b9f456SAndroid Build Coastguard Worker 190*58b9f456SAndroid Build Coastguard Worker size_type bucket_size(size_type n) const; 191*58b9f456SAndroid Build Coastguard Worker size_type bucket(const key_type& k) const; 192*58b9f456SAndroid Build Coastguard Worker 193*58b9f456SAndroid Build Coastguard Worker local_iterator begin(size_type n); 194*58b9f456SAndroid Build Coastguard Worker local_iterator end(size_type n); 195*58b9f456SAndroid Build Coastguard Worker const_local_iterator begin(size_type n) const; 196*58b9f456SAndroid Build Coastguard Worker const_local_iterator end(size_type n) const; 197*58b9f456SAndroid Build Coastguard Worker const_local_iterator cbegin(size_type n) const; 198*58b9f456SAndroid Build Coastguard Worker const_local_iterator cend(size_type n) const; 199*58b9f456SAndroid Build Coastguard Worker 200*58b9f456SAndroid Build Coastguard Worker float load_factor() const noexcept; 201*58b9f456SAndroid Build Coastguard Worker float max_load_factor() const noexcept; 202*58b9f456SAndroid Build Coastguard Worker void max_load_factor(float z); 203*58b9f456SAndroid Build Coastguard Worker void rehash(size_type n); 204*58b9f456SAndroid Build Coastguard Worker void reserve(size_type n); 205*58b9f456SAndroid Build Coastguard Worker}; 206*58b9f456SAndroid Build Coastguard Worker 207*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 208*58b9f456SAndroid Build Coastguard Worker void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x, 209*58b9f456SAndroid Build Coastguard Worker unordered_map<Key, T, Hash, Pred, Alloc>& y) 210*58b9f456SAndroid Build Coastguard Worker noexcept(noexcept(x.swap(y))); 211*58b9f456SAndroid Build Coastguard Worker 212*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 213*58b9f456SAndroid Build Coastguard Worker bool 214*58b9f456SAndroid Build Coastguard Worker operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& x, 215*58b9f456SAndroid Build Coastguard Worker const unordered_map<Key, T, Hash, Pred, Alloc>& y); 216*58b9f456SAndroid Build Coastguard Worker 217*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 218*58b9f456SAndroid Build Coastguard Worker bool 219*58b9f456SAndroid Build Coastguard Worker operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& x, 220*58b9f456SAndroid Build Coastguard Worker const unordered_map<Key, T, Hash, Pred, Alloc>& y); 221*58b9f456SAndroid Build Coastguard Worker 222*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 223*58b9f456SAndroid Build Coastguard Worker class Alloc = allocator<pair<const Key, T>>> 224*58b9f456SAndroid Build Coastguard Workerclass unordered_multimap 225*58b9f456SAndroid Build Coastguard Worker{ 226*58b9f456SAndroid Build Coastguard Workerpublic: 227*58b9f456SAndroid Build Coastguard Worker // types 228*58b9f456SAndroid Build Coastguard Worker typedef Key key_type; 229*58b9f456SAndroid Build Coastguard Worker typedef T mapped_type; 230*58b9f456SAndroid Build Coastguard Worker typedef Hash hasher; 231*58b9f456SAndroid Build Coastguard Worker typedef Pred key_equal; 232*58b9f456SAndroid Build Coastguard Worker typedef Alloc allocator_type; 233*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 234*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 235*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 236*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::pointer pointer; 237*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 238*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::size_type size_type; 239*58b9f456SAndroid Build Coastguard Worker typedef typename allocator_traits<allocator_type>::difference_type difference_type; 240*58b9f456SAndroid Build Coastguard Worker 241*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ iterator; 242*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_iterator; 243*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ local_iterator; 244*58b9f456SAndroid Build Coastguard Worker typedef /unspecified/ const_local_iterator; 245*58b9f456SAndroid Build Coastguard Worker 246*58b9f456SAndroid Build Coastguard Worker typedef unspecified node_type; // C++17 247*58b9f456SAndroid Build Coastguard Worker 248*58b9f456SAndroid Build Coastguard Worker unordered_multimap() 249*58b9f456SAndroid Build Coastguard Worker noexcept( 250*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<hasher>::value && 251*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<key_equal>::value && 252*58b9f456SAndroid Build Coastguard Worker is_nothrow_default_constructible<allocator_type>::value); 253*58b9f456SAndroid Build Coastguard Worker explicit unordered_multimap(size_type n, const hasher& hf = hasher(), 254*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 255*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 256*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 257*58b9f456SAndroid Build Coastguard Worker unordered_multimap(InputIterator f, InputIterator l, 258*58b9f456SAndroid Build Coastguard Worker size_type n = 0, const hasher& hf = hasher(), 259*58b9f456SAndroid Build Coastguard Worker const key_equal& eql = key_equal(), 260*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 261*58b9f456SAndroid Build Coastguard Worker explicit unordered_multimap(const allocator_type&); 262*58b9f456SAndroid Build Coastguard Worker unordered_multimap(const unordered_multimap&); 263*58b9f456SAndroid Build Coastguard Worker unordered_multimap(const unordered_multimap&, const Allocator&); 264*58b9f456SAndroid Build Coastguard Worker unordered_multimap(unordered_multimap&&) 265*58b9f456SAndroid Build Coastguard Worker noexcept( 266*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<hasher>::value && 267*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<key_equal>::value && 268*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_constructible<allocator_type>::value); 269*58b9f456SAndroid Build Coastguard Worker unordered_multimap(unordered_multimap&&, const Allocator&); 270*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type>, size_type n = 0, 271*58b9f456SAndroid Build Coastguard Worker const hasher& hf = hasher(), const key_equal& eql = key_equal(), 272*58b9f456SAndroid Build Coastguard Worker const allocator_type& a = allocator_type()); 273*58b9f456SAndroid Build Coastguard Worker unordered_multimap(size_type n, const allocator_type& a) 274*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(n, hasher(), key_equal(), a) {} // C++14 275*58b9f456SAndroid Build Coastguard Worker unordered_multimap(size_type n, const hasher& hf, const allocator_type& a) 276*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(n, hf, key_equal(), a) {} // C++14 277*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 278*58b9f456SAndroid Build Coastguard Worker unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a) 279*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14 280*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 281*58b9f456SAndroid Build Coastguard Worker unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, 282*58b9f456SAndroid Build Coastguard Worker const allocator_type& a) 283*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14 284*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a) 285*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14 286*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, 287*58b9f456SAndroid Build Coastguard Worker const allocator_type& a) 288*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14 289*58b9f456SAndroid Build Coastguard Worker ~unordered_multimap(); 290*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(const unordered_multimap&); 291*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(unordered_multimap&&) 292*58b9f456SAndroid Build Coastguard Worker noexcept( 293*58b9f456SAndroid Build Coastguard Worker allocator_type::propagate_on_container_move_assignment::value && 294*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<allocator_type>::value && 295*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<hasher>::value && 296*58b9f456SAndroid Build Coastguard Worker is_nothrow_move_assignable<key_equal>::value); 297*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(initializer_list<value_type>); 298*58b9f456SAndroid Build Coastguard Worker 299*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const noexcept; 300*58b9f456SAndroid Build Coastguard Worker 301*58b9f456SAndroid Build Coastguard Worker bool empty() const noexcept; 302*58b9f456SAndroid Build Coastguard Worker size_type size() const noexcept; 303*58b9f456SAndroid Build Coastguard Worker size_type max_size() const noexcept; 304*58b9f456SAndroid Build Coastguard Worker 305*58b9f456SAndroid Build Coastguard Worker iterator begin() noexcept; 306*58b9f456SAndroid Build Coastguard Worker iterator end() noexcept; 307*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const noexcept; 308*58b9f456SAndroid Build Coastguard Worker const_iterator end() const noexcept; 309*58b9f456SAndroid Build Coastguard Worker const_iterator cbegin() const noexcept; 310*58b9f456SAndroid Build Coastguard Worker const_iterator cend() const noexcept; 311*58b9f456SAndroid Build Coastguard Worker 312*58b9f456SAndroid Build Coastguard Worker template <class... Args> 313*58b9f456SAndroid Build Coastguard Worker iterator emplace(Args&&... args); 314*58b9f456SAndroid Build Coastguard Worker template <class... Args> 315*58b9f456SAndroid Build Coastguard Worker iterator emplace_hint(const_iterator position, Args&&... args); 316*58b9f456SAndroid Build Coastguard Worker iterator insert(const value_type& obj); 317*58b9f456SAndroid Build Coastguard Worker template <class P> 318*58b9f456SAndroid Build Coastguard Worker iterator insert(P&& obj); 319*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, const value_type& obj); 320*58b9f456SAndroid Build Coastguard Worker template <class P> 321*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, P&& obj); 322*58b9f456SAndroid Build Coastguard Worker template <class InputIterator> 323*58b9f456SAndroid Build Coastguard Worker void insert(InputIterator first, InputIterator last); 324*58b9f456SAndroid Build Coastguard Worker void insert(initializer_list<value_type>); 325*58b9f456SAndroid Build Coastguard Worker 326*58b9f456SAndroid Build Coastguard Worker node_type extract(const_iterator position); // C++17 327*58b9f456SAndroid Build Coastguard Worker node_type extract(const key_type& x); // C++17 328*58b9f456SAndroid Build Coastguard Worker iterator insert(node_type&& nh); // C++17 329*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator hint, node_type&& nh); // C++17 330*58b9f456SAndroid Build Coastguard Worker 331*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator position); 332*58b9f456SAndroid Build Coastguard Worker iterator erase(iterator position); // C++14 333*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& k); 334*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator first, const_iterator last); 335*58b9f456SAndroid Build Coastguard Worker void clear() noexcept; 336*58b9f456SAndroid Build Coastguard Worker 337*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 338*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17 339*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 340*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17 341*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 342*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17 343*58b9f456SAndroid Build Coastguard Worker template<class H2, class P2> 344*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17 345*58b9f456SAndroid Build Coastguard Worker 346*58b9f456SAndroid Build Coastguard Worker void swap(unordered_multimap&) 347*58b9f456SAndroid Build Coastguard Worker noexcept( 348*58b9f456SAndroid Build Coastguard Worker (!allocator_type::propagate_on_container_swap::value || 349*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<allocator_type>::value) && 350*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<hasher>::value && 351*58b9f456SAndroid Build Coastguard Worker __is_nothrow_swappable<key_equal>::value); 352*58b9f456SAndroid Build Coastguard Worker 353*58b9f456SAndroid Build Coastguard Worker hasher hash_function() const; 354*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const; 355*58b9f456SAndroid Build Coastguard Worker 356*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& k); 357*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& k) const; 358*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& k) const; 359*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& k); 360*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& k) const; 361*58b9f456SAndroid Build Coastguard Worker 362*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const noexcept; 363*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const noexcept; 364*58b9f456SAndroid Build Coastguard Worker 365*58b9f456SAndroid Build Coastguard Worker size_type bucket_size(size_type n) const; 366*58b9f456SAndroid Build Coastguard Worker size_type bucket(const key_type& k) const; 367*58b9f456SAndroid Build Coastguard Worker 368*58b9f456SAndroid Build Coastguard Worker local_iterator begin(size_type n); 369*58b9f456SAndroid Build Coastguard Worker local_iterator end(size_type n); 370*58b9f456SAndroid Build Coastguard Worker const_local_iterator begin(size_type n) const; 371*58b9f456SAndroid Build Coastguard Worker const_local_iterator end(size_type n) const; 372*58b9f456SAndroid Build Coastguard Worker const_local_iterator cbegin(size_type n) const; 373*58b9f456SAndroid Build Coastguard Worker const_local_iterator cend(size_type n) const; 374*58b9f456SAndroid Build Coastguard Worker 375*58b9f456SAndroid Build Coastguard Worker float load_factor() const noexcept; 376*58b9f456SAndroid Build Coastguard Worker float max_load_factor() const noexcept; 377*58b9f456SAndroid Build Coastguard Worker void max_load_factor(float z); 378*58b9f456SAndroid Build Coastguard Worker void rehash(size_type n); 379*58b9f456SAndroid Build Coastguard Worker void reserve(size_type n); 380*58b9f456SAndroid Build Coastguard Worker}; 381*58b9f456SAndroid Build Coastguard Worker 382*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 383*58b9f456SAndroid Build Coastguard Worker void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x, 384*58b9f456SAndroid Build Coastguard Worker unordered_multimap<Key, T, Hash, Pred, Alloc>& y) 385*58b9f456SAndroid Build Coastguard Worker noexcept(noexcept(x.swap(y))); 386*58b9f456SAndroid Build Coastguard Worker 387*58b9f456SAndroid Build Coastguard Workertemplate <class K, class T, class H, class P, class A, class Predicate> 388*58b9f456SAndroid Build Coastguard Worker void erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20 389*58b9f456SAndroid Build Coastguard Worker 390*58b9f456SAndroid Build Coastguard Workertemplate <class K, class T, class H, class P, class A, class Predicate> 391*58b9f456SAndroid Build Coastguard Worker void erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20 392*58b9f456SAndroid Build Coastguard Worker 393*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 394*58b9f456SAndroid Build Coastguard Worker bool 395*58b9f456SAndroid Build Coastguard Worker operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x, 396*58b9f456SAndroid Build Coastguard Worker const unordered_multimap<Key, T, Hash, Pred, Alloc>& y); 397*58b9f456SAndroid Build Coastguard Worker 398*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Hash, class Pred, class Alloc> 399*58b9f456SAndroid Build Coastguard Worker bool 400*58b9f456SAndroid Build Coastguard Worker operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x, 401*58b9f456SAndroid Build Coastguard Worker const unordered_multimap<Key, T, Hash, Pred, Alloc>& y); 402*58b9f456SAndroid Build Coastguard Worker 403*58b9f456SAndroid Build Coastguard Worker} // std 404*58b9f456SAndroid Build Coastguard Worker 405*58b9f456SAndroid Build Coastguard Worker*/ 406*58b9f456SAndroid Build Coastguard Worker 407*58b9f456SAndroid Build Coastguard Worker#include <__config> 408*58b9f456SAndroid Build Coastguard Worker#include <__hash_table> 409*58b9f456SAndroid Build Coastguard Worker#include <__node_handle> 410*58b9f456SAndroid Build Coastguard Worker#include <functional> 411*58b9f456SAndroid Build Coastguard Worker#include <stdexcept> 412*58b9f456SAndroid Build Coastguard Worker#include <tuple> 413*58b9f456SAndroid Build Coastguard Worker#include <version> 414*58b9f456SAndroid Build Coastguard Worker 415*58b9f456SAndroid Build Coastguard Worker#include <__debug> 416*58b9f456SAndroid Build Coastguard Worker 417*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 418*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header 419*58b9f456SAndroid Build Coastguard Worker#endif 420*58b9f456SAndroid Build Coastguard Worker 421*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD 422*58b9f456SAndroid Build Coastguard Worker 423*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Hash, 424*58b9f456SAndroid Build Coastguard Worker bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value> 425*58b9f456SAndroid Build Coastguard Workerclass __unordered_map_hasher 426*58b9f456SAndroid Build Coastguard Worker : private _Hash 427*58b9f456SAndroid Build Coastguard Worker{ 428*58b9f456SAndroid Build Coastguard Workerpublic: 429*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 430*58b9f456SAndroid Build Coastguard Worker __unordered_map_hasher() 431*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) 432*58b9f456SAndroid Build Coastguard Worker : _Hash() {} 433*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 434*58b9f456SAndroid Build Coastguard Worker __unordered_map_hasher(const _Hash& __h) 435*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value) 436*58b9f456SAndroid Build Coastguard Worker : _Hash(__h) {} 437*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 438*58b9f456SAndroid Build Coastguard Worker const _Hash& hash_function() const _NOEXCEPT {return *this;} 439*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 440*58b9f456SAndroid Build Coastguard Worker size_t operator()(const _Cp& __x) const 441*58b9f456SAndroid Build Coastguard Worker {return static_cast<const _Hash&>(*this)(__x.__get_value().first);} 442*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 443*58b9f456SAndroid Build Coastguard Worker size_t operator()(const _Key& __x) const 444*58b9f456SAndroid Build Coastguard Worker {return static_cast<const _Hash&>(*this)(__x);} 445*58b9f456SAndroid Build Coastguard Worker void swap(__unordered_map_hasher&__y) 446*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) 447*58b9f456SAndroid Build Coastguard Worker { 448*58b9f456SAndroid Build Coastguard Worker using _VSTD::swap; 449*58b9f456SAndroid Build Coastguard Worker swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); 450*58b9f456SAndroid Build Coastguard Worker } 451*58b9f456SAndroid Build Coastguard Worker}; 452*58b9f456SAndroid Build Coastguard Worker 453*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Hash> 454*58b9f456SAndroid Build Coastguard Workerclass __unordered_map_hasher<_Key, _Cp, _Hash, false> 455*58b9f456SAndroid Build Coastguard Worker{ 456*58b9f456SAndroid Build Coastguard Worker _Hash __hash_; 457*58b9f456SAndroid Build Coastguard Workerpublic: 458*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 459*58b9f456SAndroid Build Coastguard Worker __unordered_map_hasher() 460*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value) 461*58b9f456SAndroid Build Coastguard Worker : __hash_() {} 462*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 463*58b9f456SAndroid Build Coastguard Worker __unordered_map_hasher(const _Hash& __h) 464*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value) 465*58b9f456SAndroid Build Coastguard Worker : __hash_(__h) {} 466*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 467*58b9f456SAndroid Build Coastguard Worker const _Hash& hash_function() const _NOEXCEPT {return __hash_;} 468*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 469*58b9f456SAndroid Build Coastguard Worker size_t operator()(const _Cp& __x) const 470*58b9f456SAndroid Build Coastguard Worker {return __hash_(__x.__get_value().first);} 471*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 472*58b9f456SAndroid Build Coastguard Worker size_t operator()(const _Key& __x) const 473*58b9f456SAndroid Build Coastguard Worker {return __hash_(__x);} 474*58b9f456SAndroid Build Coastguard Worker void swap(__unordered_map_hasher&__y) 475*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) 476*58b9f456SAndroid Build Coastguard Worker { 477*58b9f456SAndroid Build Coastguard Worker using _VSTD::swap; 478*58b9f456SAndroid Build Coastguard Worker swap(__hash_, __y.__hash_); 479*58b9f456SAndroid Build Coastguard Worker } 480*58b9f456SAndroid Build Coastguard Worker}; 481*58b9f456SAndroid Build Coastguard Worker 482*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Hash, bool __b> 483*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 484*58b9f456SAndroid Build Coastguard Workervoid 485*58b9f456SAndroid Build Coastguard Workerswap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x, 486*58b9f456SAndroid Build Coastguard Worker __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y) 487*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 488*58b9f456SAndroid Build Coastguard Worker{ 489*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 490*58b9f456SAndroid Build Coastguard Worker} 491*58b9f456SAndroid Build Coastguard Worker 492*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Pred, 493*58b9f456SAndroid Build Coastguard Worker bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value> 494*58b9f456SAndroid Build Coastguard Workerclass __unordered_map_equal 495*58b9f456SAndroid Build Coastguard Worker : private _Pred 496*58b9f456SAndroid Build Coastguard Worker{ 497*58b9f456SAndroid Build Coastguard Workerpublic: 498*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 499*58b9f456SAndroid Build Coastguard Worker __unordered_map_equal() 500*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) 501*58b9f456SAndroid Build Coastguard Worker : _Pred() {} 502*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 503*58b9f456SAndroid Build Coastguard Worker __unordered_map_equal(const _Pred& __p) 504*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value) 505*58b9f456SAndroid Build Coastguard Worker : _Pred(__p) {} 506*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 507*58b9f456SAndroid Build Coastguard Worker const _Pred& key_eq() const _NOEXCEPT {return *this;} 508*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 509*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Cp& __x, const _Cp& __y) const 510*58b9f456SAndroid Build Coastguard Worker {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);} 511*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 512*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Cp& __x, const _Key& __y) const 513*58b9f456SAndroid Build Coastguard Worker {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} 514*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 515*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Key& __x, const _Cp& __y) const 516*58b9f456SAndroid Build Coastguard Worker {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} 517*58b9f456SAndroid Build Coastguard Worker void swap(__unordered_map_equal&__y) 518*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) 519*58b9f456SAndroid Build Coastguard Worker { 520*58b9f456SAndroid Build Coastguard Worker using _VSTD::swap; 521*58b9f456SAndroid Build Coastguard Worker swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); 522*58b9f456SAndroid Build Coastguard Worker } 523*58b9f456SAndroid Build Coastguard Worker}; 524*58b9f456SAndroid Build Coastguard Worker 525*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Pred> 526*58b9f456SAndroid Build Coastguard Workerclass __unordered_map_equal<_Key, _Cp, _Pred, false> 527*58b9f456SAndroid Build Coastguard Worker{ 528*58b9f456SAndroid Build Coastguard Worker _Pred __pred_; 529*58b9f456SAndroid Build Coastguard Workerpublic: 530*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 531*58b9f456SAndroid Build Coastguard Worker __unordered_map_equal() 532*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value) 533*58b9f456SAndroid Build Coastguard Worker : __pred_() {} 534*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 535*58b9f456SAndroid Build Coastguard Worker __unordered_map_equal(const _Pred& __p) 536*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value) 537*58b9f456SAndroid Build Coastguard Worker : __pred_(__p) {} 538*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 539*58b9f456SAndroid Build Coastguard Worker const _Pred& key_eq() const _NOEXCEPT {return __pred_;} 540*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 541*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Cp& __x, const _Cp& __y) const 542*58b9f456SAndroid Build Coastguard Worker {return __pred_(__x.__get_value().first, __y.__get_value().first);} 543*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 544*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Cp& __x, const _Key& __y) const 545*58b9f456SAndroid Build Coastguard Worker {return __pred_(__x.__get_value().first, __y);} 546*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 547*58b9f456SAndroid Build Coastguard Worker bool operator()(const _Key& __x, const _Cp& __y) const 548*58b9f456SAndroid Build Coastguard Worker {return __pred_(__x, __y.__get_value().first);} 549*58b9f456SAndroid Build Coastguard Worker void swap(__unordered_map_equal&__y) 550*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) 551*58b9f456SAndroid Build Coastguard Worker { 552*58b9f456SAndroid Build Coastguard Worker using _VSTD::swap; 553*58b9f456SAndroid Build Coastguard Worker swap(__pred_, __y.__pred_); 554*58b9f456SAndroid Build Coastguard Worker } 555*58b9f456SAndroid Build Coastguard Worker}; 556*58b9f456SAndroid Build Coastguard Worker 557*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Cp, class _Pred, bool __b> 558*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 559*58b9f456SAndroid Build Coastguard Workervoid 560*58b9f456SAndroid Build Coastguard Workerswap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x, 561*58b9f456SAndroid Build Coastguard Worker __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y) 562*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 563*58b9f456SAndroid Build Coastguard Worker{ 564*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 565*58b9f456SAndroid Build Coastguard Worker} 566*58b9f456SAndroid Build Coastguard Worker 567*58b9f456SAndroid Build Coastguard Workertemplate <class _Alloc> 568*58b9f456SAndroid Build Coastguard Workerclass __hash_map_node_destructor 569*58b9f456SAndroid Build Coastguard Worker{ 570*58b9f456SAndroid Build Coastguard Worker typedef _Alloc allocator_type; 571*58b9f456SAndroid Build Coastguard Worker typedef allocator_traits<allocator_type> __alloc_traits; 572*58b9f456SAndroid Build Coastguard Worker 573*58b9f456SAndroid Build Coastguard Workerpublic: 574*58b9f456SAndroid Build Coastguard Worker 575*58b9f456SAndroid Build Coastguard Worker typedef typename __alloc_traits::pointer pointer; 576*58b9f456SAndroid Build Coastguard Workerprivate: 577*58b9f456SAndroid Build Coastguard Worker 578*58b9f456SAndroid Build Coastguard Worker allocator_type& __na_; 579*58b9f456SAndroid Build Coastguard Worker 580*58b9f456SAndroid Build Coastguard Worker __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); 581*58b9f456SAndroid Build Coastguard Worker 582*58b9f456SAndroid Build Coastguard Workerpublic: 583*58b9f456SAndroid Build Coastguard Worker bool __first_constructed; 584*58b9f456SAndroid Build Coastguard Worker bool __second_constructed; 585*58b9f456SAndroid Build Coastguard Worker 586*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 587*58b9f456SAndroid Build Coastguard Worker explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT 588*58b9f456SAndroid Build Coastguard Worker : __na_(__na), 589*58b9f456SAndroid Build Coastguard Worker __first_constructed(false), 590*58b9f456SAndroid Build Coastguard Worker __second_constructed(false) 591*58b9f456SAndroid Build Coastguard Worker {} 592*58b9f456SAndroid Build Coastguard Worker 593*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 594*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 595*58b9f456SAndroid Build Coastguard Worker __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) 596*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT 597*58b9f456SAndroid Build Coastguard Worker : __na_(__x.__na_), 598*58b9f456SAndroid Build Coastguard Worker __first_constructed(__x.__value_constructed), 599*58b9f456SAndroid Build Coastguard Worker __second_constructed(__x.__value_constructed) 600*58b9f456SAndroid Build Coastguard Worker { 601*58b9f456SAndroid Build Coastguard Worker __x.__value_constructed = false; 602*58b9f456SAndroid Build Coastguard Worker } 603*58b9f456SAndroid Build Coastguard Worker#else // _LIBCPP_CXX03_LANG 604*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 605*58b9f456SAndroid Build Coastguard Worker __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x) 606*58b9f456SAndroid Build Coastguard Worker : __na_(__x.__na_), 607*58b9f456SAndroid Build Coastguard Worker __first_constructed(__x.__value_constructed), 608*58b9f456SAndroid Build Coastguard Worker __second_constructed(__x.__value_constructed) 609*58b9f456SAndroid Build Coastguard Worker { 610*58b9f456SAndroid Build Coastguard Worker const_cast<bool&>(__x.__value_constructed) = false; 611*58b9f456SAndroid Build Coastguard Worker } 612*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 613*58b9f456SAndroid Build Coastguard Worker 614*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 615*58b9f456SAndroid Build Coastguard Worker void operator()(pointer __p) _NOEXCEPT 616*58b9f456SAndroid Build Coastguard Worker { 617*58b9f456SAndroid Build Coastguard Worker if (__second_constructed) 618*58b9f456SAndroid Build Coastguard Worker __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().second)); 619*58b9f456SAndroid Build Coastguard Worker if (__first_constructed) 620*58b9f456SAndroid Build Coastguard Worker __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().first)); 621*58b9f456SAndroid Build Coastguard Worker if (__p) 622*58b9f456SAndroid Build Coastguard Worker __alloc_traits::deallocate(__na_, __p, 1); 623*58b9f456SAndroid Build Coastguard Worker } 624*58b9f456SAndroid Build Coastguard Worker}; 625*58b9f456SAndroid Build Coastguard Worker 626*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 627*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp> 628*58b9f456SAndroid Build Coastguard Workerstruct __hash_value_type 629*58b9f456SAndroid Build Coastguard Worker{ 630*58b9f456SAndroid Build Coastguard Worker typedef _Key key_type; 631*58b9f456SAndroid Build Coastguard Worker typedef _Tp mapped_type; 632*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 633*58b9f456SAndroid Build Coastguard Worker typedef pair<key_type&, mapped_type&> __nc_ref_pair_type; 634*58b9f456SAndroid Build Coastguard Worker typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; 635*58b9f456SAndroid Build Coastguard Worker 636*58b9f456SAndroid Build Coastguard Workerprivate: 637*58b9f456SAndroid Build Coastguard Worker value_type __cc; 638*58b9f456SAndroid Build Coastguard Worker 639*58b9f456SAndroid Build Coastguard Workerpublic: 640*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 641*58b9f456SAndroid Build Coastguard Worker value_type& __get_value() 642*58b9f456SAndroid Build Coastguard Worker { 643*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 644*58b9f456SAndroid Build Coastguard Worker return *_VSTD::launder(_VSTD::addressof(__cc)); 645*58b9f456SAndroid Build Coastguard Worker#else 646*58b9f456SAndroid Build Coastguard Worker return __cc; 647*58b9f456SAndroid Build Coastguard Worker#endif 648*58b9f456SAndroid Build Coastguard Worker } 649*58b9f456SAndroid Build Coastguard Worker 650*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 651*58b9f456SAndroid Build Coastguard Worker const value_type& __get_value() const 652*58b9f456SAndroid Build Coastguard Worker { 653*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 654*58b9f456SAndroid Build Coastguard Worker return *_VSTD::launder(_VSTD::addressof(__cc)); 655*58b9f456SAndroid Build Coastguard Worker#else 656*58b9f456SAndroid Build Coastguard Worker return __cc; 657*58b9f456SAndroid Build Coastguard Worker#endif 658*58b9f456SAndroid Build Coastguard Worker } 659*58b9f456SAndroid Build Coastguard Worker 660*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 661*58b9f456SAndroid Build Coastguard Worker __nc_ref_pair_type __ref() 662*58b9f456SAndroid Build Coastguard Worker { 663*58b9f456SAndroid Build Coastguard Worker value_type& __v = __get_value(); 664*58b9f456SAndroid Build Coastguard Worker return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second); 665*58b9f456SAndroid Build Coastguard Worker } 666*58b9f456SAndroid Build Coastguard Worker 667*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 668*58b9f456SAndroid Build Coastguard Worker __nc_rref_pair_type __move() 669*58b9f456SAndroid Build Coastguard Worker { 670*58b9f456SAndroid Build Coastguard Worker value_type& __v = __get_value(); 671*58b9f456SAndroid Build Coastguard Worker return __nc_rref_pair_type( 672*58b9f456SAndroid Build Coastguard Worker _VSTD::move(const_cast<key_type&>(__v.first)), 673*58b9f456SAndroid Build Coastguard Worker _VSTD::move(__v.second)); 674*58b9f456SAndroid Build Coastguard Worker } 675*58b9f456SAndroid Build Coastguard Worker 676*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 677*58b9f456SAndroid Build Coastguard Worker __hash_value_type& operator=(const __hash_value_type& __v) 678*58b9f456SAndroid Build Coastguard Worker { 679*58b9f456SAndroid Build Coastguard Worker __ref() = __v.__get_value(); 680*58b9f456SAndroid Build Coastguard Worker return *this; 681*58b9f456SAndroid Build Coastguard Worker } 682*58b9f456SAndroid Build Coastguard Worker 683*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 684*58b9f456SAndroid Build Coastguard Worker __hash_value_type& operator=(__hash_value_type&& __v) 685*58b9f456SAndroid Build Coastguard Worker { 686*58b9f456SAndroid Build Coastguard Worker __ref() = __v.__move(); 687*58b9f456SAndroid Build Coastguard Worker return *this; 688*58b9f456SAndroid Build Coastguard Worker } 689*58b9f456SAndroid Build Coastguard Worker 690*58b9f456SAndroid Build Coastguard Worker template <class _ValueTp, 691*58b9f456SAndroid Build Coastguard Worker class = typename enable_if< 692*58b9f456SAndroid Build Coastguard Worker __is_same_uncvref<_ValueTp, value_type>::value 693*58b9f456SAndroid Build Coastguard Worker >::type 694*58b9f456SAndroid Build Coastguard Worker > 695*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 696*58b9f456SAndroid Build Coastguard Worker __hash_value_type& operator=(_ValueTp&& __v) 697*58b9f456SAndroid Build Coastguard Worker { 698*58b9f456SAndroid Build Coastguard Worker __ref() = _VSTD::forward<_ValueTp>(__v); 699*58b9f456SAndroid Build Coastguard Worker return *this; 700*58b9f456SAndroid Build Coastguard Worker } 701*58b9f456SAndroid Build Coastguard Worker 702*58b9f456SAndroid Build Coastguard Workerprivate: 703*58b9f456SAndroid Build Coastguard Worker __hash_value_type(const __hash_value_type& __v) = delete; 704*58b9f456SAndroid Build Coastguard Worker __hash_value_type(__hash_value_type&& __v) = delete; 705*58b9f456SAndroid Build Coastguard Worker template <class ..._Args> 706*58b9f456SAndroid Build Coastguard Worker explicit __hash_value_type(_Args&& ...__args) = delete; 707*58b9f456SAndroid Build Coastguard Worker 708*58b9f456SAndroid Build Coastguard Worker ~__hash_value_type() = delete; 709*58b9f456SAndroid Build Coastguard Worker}; 710*58b9f456SAndroid Build Coastguard Worker 711*58b9f456SAndroid Build Coastguard Worker#else 712*58b9f456SAndroid Build Coastguard Worker 713*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp> 714*58b9f456SAndroid Build Coastguard Workerstruct __hash_value_type 715*58b9f456SAndroid Build Coastguard Worker{ 716*58b9f456SAndroid Build Coastguard Worker typedef _Key key_type; 717*58b9f456SAndroid Build Coastguard Worker typedef _Tp mapped_type; 718*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 719*58b9f456SAndroid Build Coastguard Worker 720*58b9f456SAndroid Build Coastguard Workerprivate: 721*58b9f456SAndroid Build Coastguard Worker value_type __cc; 722*58b9f456SAndroid Build Coastguard Worker 723*58b9f456SAndroid Build Coastguard Workerpublic: 724*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 725*58b9f456SAndroid Build Coastguard Worker value_type& __get_value() { return __cc; } 726*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 727*58b9f456SAndroid Build Coastguard Worker const value_type& __get_value() const { return __cc; } 728*58b9f456SAndroid Build Coastguard Worker 729*58b9f456SAndroid Build Coastguard Workerprivate: 730*58b9f456SAndroid Build Coastguard Worker ~__hash_value_type(); 731*58b9f456SAndroid Build Coastguard Worker}; 732*58b9f456SAndroid Build Coastguard Worker 733*58b9f456SAndroid Build Coastguard Worker#endif 734*58b9f456SAndroid Build Coastguard Worker 735*58b9f456SAndroid Build Coastguard Workertemplate <class _HashIterator> 736*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS __hash_map_iterator 737*58b9f456SAndroid Build Coastguard Worker{ 738*58b9f456SAndroid Build Coastguard Worker _HashIterator __i_; 739*58b9f456SAndroid Build Coastguard Worker 740*58b9f456SAndroid Build Coastguard Worker typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; 741*58b9f456SAndroid Build Coastguard Worker 742*58b9f456SAndroid Build Coastguard Workerpublic: 743*58b9f456SAndroid Build Coastguard Worker typedef forward_iterator_tag iterator_category; 744*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::__map_value_type value_type; 745*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::difference_type difference_type; 746*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 747*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::__map_value_type_pointer pointer; 748*58b9f456SAndroid Build Coastguard Worker 749*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 750*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator() _NOEXCEPT {} 751*58b9f456SAndroid Build Coastguard Worker 752*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 753*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {} 754*58b9f456SAndroid Build Coastguard Worker 755*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 756*58b9f456SAndroid Build Coastguard Worker reference operator*() const {return __i_->__get_value();} 757*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 758*58b9f456SAndroid Build Coastguard Worker pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} 759*58b9f456SAndroid Build Coastguard Worker 760*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 761*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator& operator++() {++__i_; return *this;} 762*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 763*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator operator++(int) 764*58b9f456SAndroid Build Coastguard Worker { 765*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator __t(*this); 766*58b9f456SAndroid Build Coastguard Worker ++(*this); 767*58b9f456SAndroid Build Coastguard Worker return __t; 768*58b9f456SAndroid Build Coastguard Worker } 769*58b9f456SAndroid Build Coastguard Worker 770*58b9f456SAndroid Build Coastguard Worker friend _LIBCPP_INLINE_VISIBILITY 771*58b9f456SAndroid Build Coastguard Worker bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) 772*58b9f456SAndroid Build Coastguard Worker {return __x.__i_ == __y.__i_;} 773*58b9f456SAndroid Build Coastguard Worker friend _LIBCPP_INLINE_VISIBILITY 774*58b9f456SAndroid Build Coastguard Worker bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) 775*58b9f456SAndroid Build Coastguard Worker {return __x.__i_ != __y.__i_;} 776*58b9f456SAndroid Build Coastguard Worker 777*58b9f456SAndroid Build Coastguard Worker template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; 778*58b9f456SAndroid Build Coastguard Worker template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; 779*58b9f456SAndroid Build Coastguard Worker template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; 780*58b9f456SAndroid Build Coastguard Worker template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; 781*58b9f456SAndroid Build Coastguard Worker template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; 782*58b9f456SAndroid Build Coastguard Worker}; 783*58b9f456SAndroid Build Coastguard Worker 784*58b9f456SAndroid Build Coastguard Workertemplate <class _HashIterator> 785*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator 786*58b9f456SAndroid Build Coastguard Worker{ 787*58b9f456SAndroid Build Coastguard Worker _HashIterator __i_; 788*58b9f456SAndroid Build Coastguard Worker 789*58b9f456SAndroid Build Coastguard Worker typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; 790*58b9f456SAndroid Build Coastguard Worker 791*58b9f456SAndroid Build Coastguard Workerpublic: 792*58b9f456SAndroid Build Coastguard Worker typedef forward_iterator_tag iterator_category; 793*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::__map_value_type value_type; 794*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::difference_type difference_type; 795*58b9f456SAndroid Build Coastguard Worker typedef const value_type& reference; 796*58b9f456SAndroid Build Coastguard Worker typedef typename _NodeTypes::__const_map_value_type_pointer pointer; 797*58b9f456SAndroid Build Coastguard Worker 798*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 799*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator() _NOEXCEPT {} 800*58b9f456SAndroid Build Coastguard Worker 801*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 802*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {} 803*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 804*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator( 805*58b9f456SAndroid Build Coastguard Worker __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) 806*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT 807*58b9f456SAndroid Build Coastguard Worker : __i_(__i.__i_) {} 808*58b9f456SAndroid Build Coastguard Worker 809*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 810*58b9f456SAndroid Build Coastguard Worker reference operator*() const {return __i_->__get_value();} 811*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 812*58b9f456SAndroid Build Coastguard Worker pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} 813*58b9f456SAndroid Build Coastguard Worker 814*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 815*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator& operator++() {++__i_; return *this;} 816*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 817*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator operator++(int) 818*58b9f456SAndroid Build Coastguard Worker { 819*58b9f456SAndroid Build Coastguard Worker __hash_map_const_iterator __t(*this); 820*58b9f456SAndroid Build Coastguard Worker ++(*this); 821*58b9f456SAndroid Build Coastguard Worker return __t; 822*58b9f456SAndroid Build Coastguard Worker } 823*58b9f456SAndroid Build Coastguard Worker 824*58b9f456SAndroid Build Coastguard Worker friend _LIBCPP_INLINE_VISIBILITY 825*58b9f456SAndroid Build Coastguard Worker bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) 826*58b9f456SAndroid Build Coastguard Worker {return __x.__i_ == __y.__i_;} 827*58b9f456SAndroid Build Coastguard Worker friend _LIBCPP_INLINE_VISIBILITY 828*58b9f456SAndroid Build Coastguard Worker bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) 829*58b9f456SAndroid Build Coastguard Worker {return __x.__i_ != __y.__i_;} 830*58b9f456SAndroid Build Coastguard Worker 831*58b9f456SAndroid Build Coastguard Worker template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; 832*58b9f456SAndroid Build Coastguard Worker template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; 833*58b9f456SAndroid Build Coastguard Worker template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; 834*58b9f456SAndroid Build Coastguard Worker template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; 835*58b9f456SAndroid Build Coastguard Worker}; 836*58b9f456SAndroid Build Coastguard Worker 837*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 838*58b9f456SAndroid Build Coastguard Workerclass unordered_multimap; 839*58b9f456SAndroid Build Coastguard Worker 840*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, 841*58b9f456SAndroid Build Coastguard Worker class _Alloc = allocator<pair<const _Key, _Tp> > > 842*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS unordered_map 843*58b9f456SAndroid Build Coastguard Worker{ 844*58b9f456SAndroid Build Coastguard Workerpublic: 845*58b9f456SAndroid Build Coastguard Worker // types 846*58b9f456SAndroid Build Coastguard Worker typedef _Key key_type; 847*58b9f456SAndroid Build Coastguard Worker typedef _Tp mapped_type; 848*58b9f456SAndroid Build Coastguard Worker typedef _Hash hasher; 849*58b9f456SAndroid Build Coastguard Worker typedef _Pred key_equal; 850*58b9f456SAndroid Build Coastguard Worker typedef _Alloc allocator_type; 851*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 852*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 853*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 854*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<value_type, typename allocator_type::value_type>::value), 855*58b9f456SAndroid Build Coastguard Worker "Invalid allocator::value_type"); 856*58b9f456SAndroid Build Coastguard Worker static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); 857*58b9f456SAndroid Build Coastguard Worker 858*58b9f456SAndroid Build Coastguard Workerprivate: 859*58b9f456SAndroid Build Coastguard Worker typedef __hash_value_type<key_type, mapped_type> __value_type; 860*58b9f456SAndroid Build Coastguard Worker typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; 861*58b9f456SAndroid Build Coastguard Worker typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; 862*58b9f456SAndroid Build Coastguard Worker typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, 863*58b9f456SAndroid Build Coastguard Worker __value_type>::type __allocator_type; 864*58b9f456SAndroid Build Coastguard Worker 865*58b9f456SAndroid Build Coastguard Worker typedef __hash_table<__value_type, __hasher, 866*58b9f456SAndroid Build Coastguard Worker __key_equal, __allocator_type> __table; 867*58b9f456SAndroid Build Coastguard Worker 868*58b9f456SAndroid Build Coastguard Worker __table __table_; 869*58b9f456SAndroid Build Coastguard Worker 870*58b9f456SAndroid Build Coastguard Worker typedef typename __table::_NodeTypes _NodeTypes; 871*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_pointer __node_pointer; 872*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_const_pointer __node_const_pointer; 873*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_traits __node_traits; 874*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_allocator __node_allocator; 875*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node __node; 876*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_node_destructor<__node_allocator> _Dp; 877*58b9f456SAndroid Build Coastguard Worker typedef unique_ptr<__node, _Dp> __node_holder; 878*58b9f456SAndroid Build Coastguard Worker typedef allocator_traits<allocator_type> __alloc_traits; 879*58b9f456SAndroid Build Coastguard Worker 880*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<typename __table::__container_value_type, value_type>::value), ""); 881*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<typename __table::__node_value_type, __value_type>::value), ""); 882*58b9f456SAndroid Build Coastguard Workerpublic: 883*58b9f456SAndroid Build Coastguard Worker typedef typename __alloc_traits::pointer pointer; 884*58b9f456SAndroid Build Coastguard Worker typedef typename __alloc_traits::const_pointer const_pointer; 885*58b9f456SAndroid Build Coastguard Worker typedef typename __table::size_type size_type; 886*58b9f456SAndroid Build Coastguard Worker typedef typename __table::difference_type difference_type; 887*58b9f456SAndroid Build Coastguard Worker 888*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_iterator<typename __table::iterator> iterator; 889*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; 890*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; 891*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; 892*58b9f456SAndroid Build Coastguard Worker 893*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 894*58b9f456SAndroid Build Coastguard Worker typedef __map_node_handle<__node, allocator_type> node_type; 895*58b9f456SAndroid Build Coastguard Worker typedef __insert_return_type<iterator, node_type> insert_return_type; 896*58b9f456SAndroid Build Coastguard Worker#endif 897*58b9f456SAndroid Build Coastguard Worker 898*58b9f456SAndroid Build Coastguard Worker template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> 899*58b9f456SAndroid Build Coastguard Worker friend class _LIBCPP_TEMPLATE_VIS unordered_map; 900*58b9f456SAndroid Build Coastguard Worker template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> 901*58b9f456SAndroid Build Coastguard Worker friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; 902*58b9f456SAndroid Build Coastguard Worker 903*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 904*58b9f456SAndroid Build Coastguard Worker unordered_map() 905*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 906*58b9f456SAndroid Build Coastguard Worker { 907*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 908*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 909*58b9f456SAndroid Build Coastguard Worker#endif 910*58b9f456SAndroid Build Coastguard Worker } 911*58b9f456SAndroid Build Coastguard Worker explicit unordered_map(size_type __n, const hasher& __hf = hasher(), 912*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 913*58b9f456SAndroid Build Coastguard Worker unordered_map(size_type __n, const hasher& __hf, 914*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, 915*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 916*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 917*58b9f456SAndroid Build Coastguard Worker unordered_map(_InputIterator __first, _InputIterator __last); 918*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 919*58b9f456SAndroid Build Coastguard Worker unordered_map(_InputIterator __first, _InputIterator __last, 920*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf = hasher(), 921*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 922*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 923*58b9f456SAndroid Build Coastguard Worker unordered_map(_InputIterator __first, _InputIterator __last, 924*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, 925*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, 926*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 927*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 928*58b9f456SAndroid Build Coastguard Worker explicit unordered_map(const allocator_type& __a); 929*58b9f456SAndroid Build Coastguard Worker unordered_map(const unordered_map& __u); 930*58b9f456SAndroid Build Coastguard Worker unordered_map(const unordered_map& __u, const allocator_type& __a); 931*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 932*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 933*58b9f456SAndroid Build Coastguard Worker unordered_map(unordered_map&& __u) 934*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 935*58b9f456SAndroid Build Coastguard Worker unordered_map(unordered_map&& __u, const allocator_type& __a); 936*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> __il); 937*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> __il, size_type __n, 938*58b9f456SAndroid Build Coastguard Worker const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); 939*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> __il, size_type __n, 940*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, 941*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 942*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 943*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11 944*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 945*58b9f456SAndroid Build Coastguard Worker unordered_map(size_type __n, const allocator_type& __a) 946*58b9f456SAndroid Build Coastguard Worker : unordered_map(__n, hasher(), key_equal(), __a) {} 947*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 948*58b9f456SAndroid Build Coastguard Worker unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a) 949*58b9f456SAndroid Build Coastguard Worker : unordered_map(__n, __hf, key_equal(), __a) {} 950*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 951*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 952*58b9f456SAndroid Build Coastguard Worker unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) 953*58b9f456SAndroid Build Coastguard Worker : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {} 954*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 955*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 956*58b9f456SAndroid Build Coastguard Worker unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 957*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 958*58b9f456SAndroid Build Coastguard Worker : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {} 959*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 960*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 961*58b9f456SAndroid Build Coastguard Worker : unordered_map(__il, __n, hasher(), key_equal(), __a) {} 962*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 963*58b9f456SAndroid Build Coastguard Worker unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 964*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 965*58b9f456SAndroid Build Coastguard Worker : unordered_map(__il, __n, __hf, key_equal(), __a) {} 966*58b9f456SAndroid Build Coastguard Worker#endif 967*58b9f456SAndroid Build Coastguard Worker // ~unordered_map() = default; 968*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 969*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(const unordered_map& __u) 970*58b9f456SAndroid Build Coastguard Worker { 971*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 972*58b9f456SAndroid Build Coastguard Worker __table_ = __u.__table_; 973*58b9f456SAndroid Build Coastguard Worker#else 974*58b9f456SAndroid Build Coastguard Worker if (this != &__u) { 975*58b9f456SAndroid Build Coastguard Worker __table_.clear(); 976*58b9f456SAndroid Build Coastguard Worker __table_.hash_function() = __u.__table_.hash_function(); 977*58b9f456SAndroid Build Coastguard Worker __table_.key_eq() = __u.__table_.key_eq(); 978*58b9f456SAndroid Build Coastguard Worker __table_.max_load_factor() = __u.__table_.max_load_factor(); 979*58b9f456SAndroid Build Coastguard Worker __table_.__copy_assign_alloc(__u.__table_); 980*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 981*58b9f456SAndroid Build Coastguard Worker } 982*58b9f456SAndroid Build Coastguard Worker#endif 983*58b9f456SAndroid Build Coastguard Worker return *this; 984*58b9f456SAndroid Build Coastguard Worker } 985*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 986*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 987*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(unordered_map&& __u) 988*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 989*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 990*58b9f456SAndroid Build Coastguard Worker unordered_map& operator=(initializer_list<value_type> __il); 991*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 992*58b9f456SAndroid Build Coastguard Worker 993*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 994*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const _NOEXCEPT 995*58b9f456SAndroid Build Coastguard Worker {return allocator_type(__table_.__node_alloc());} 996*58b9f456SAndroid Build Coastguard Worker 997*58b9f456SAndroid Build Coastguard Worker _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 998*58b9f456SAndroid Build Coastguard Worker bool empty() const _NOEXCEPT {return __table_.size() == 0;} 999*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1000*58b9f456SAndroid Build Coastguard Worker size_type size() const _NOEXCEPT {return __table_.size();} 1001*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1002*58b9f456SAndroid Build Coastguard Worker size_type max_size() const _NOEXCEPT {return __table_.max_size();} 1003*58b9f456SAndroid Build Coastguard Worker 1004*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1005*58b9f456SAndroid Build Coastguard Worker iterator begin() _NOEXCEPT {return __table_.begin();} 1006*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1007*58b9f456SAndroid Build Coastguard Worker iterator end() _NOEXCEPT {return __table_.end();} 1008*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1009*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const _NOEXCEPT {return __table_.begin();} 1010*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1011*58b9f456SAndroid Build Coastguard Worker const_iterator end() const _NOEXCEPT {return __table_.end();} 1012*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1013*58b9f456SAndroid Build Coastguard Worker const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 1014*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1015*58b9f456SAndroid Build Coastguard Worker const_iterator cend() const _NOEXCEPT {return __table_.end();} 1016*58b9f456SAndroid Build Coastguard Worker 1017*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1018*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(const value_type& __x) 1019*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_unique(__x);} 1020*58b9f456SAndroid Build Coastguard Worker 1021*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, const value_type& __x) { 1022*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1023*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 1024*58b9f456SAndroid Build Coastguard Worker "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" 1025*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1026*58b9f456SAndroid Build Coastguard Worker#else 1027*58b9f456SAndroid Build Coastguard Worker ((void)__p); 1028*58b9f456SAndroid Build Coastguard Worker#endif 1029*58b9f456SAndroid Build Coastguard Worker return insert(__x).first; 1030*58b9f456SAndroid Build Coastguard Worker } 1031*58b9f456SAndroid Build Coastguard Worker 1032*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1033*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1034*58b9f456SAndroid Build Coastguard Worker void insert(_InputIterator __first, _InputIterator __last); 1035*58b9f456SAndroid Build Coastguard Worker 1036*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1037*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1038*58b9f456SAndroid Build Coastguard Worker void insert(initializer_list<value_type> __il) 1039*58b9f456SAndroid Build Coastguard Worker {insert(__il.begin(), __il.end());} 1040*58b9f456SAndroid Build Coastguard Worker 1041*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1042*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(value_type&& __x) 1043*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_unique(_VSTD::move(__x));} 1044*58b9f456SAndroid Build Coastguard Worker 1045*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, value_type&& __x) { 1046*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1047*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 1048*58b9f456SAndroid Build Coastguard Worker "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" 1049*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1050*58b9f456SAndroid Build Coastguard Worker#else 1051*58b9f456SAndroid Build Coastguard Worker ((void)__p); 1052*58b9f456SAndroid Build Coastguard Worker#endif 1053*58b9f456SAndroid Build Coastguard Worker return __table_.__insert_unique(_VSTD::move(__x)).first; 1054*58b9f456SAndroid Build Coastguard Worker } 1055*58b9f456SAndroid Build Coastguard Worker 1056*58b9f456SAndroid Build Coastguard Worker template <class _Pp, 1057*58b9f456SAndroid Build Coastguard Worker class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> 1058*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1059*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert(_Pp&& __x) 1060*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));} 1061*58b9f456SAndroid Build Coastguard Worker 1062*58b9f456SAndroid Build Coastguard Worker template <class _Pp, 1063*58b9f456SAndroid Build Coastguard Worker class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> 1064*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1065*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, _Pp&& __x) 1066*58b9f456SAndroid Build Coastguard Worker { 1067*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1068*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 1069*58b9f456SAndroid Build Coastguard Worker "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" 1070*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1071*58b9f456SAndroid Build Coastguard Worker#else 1072*58b9f456SAndroid Build Coastguard Worker ((void)__p); 1073*58b9f456SAndroid Build Coastguard Worker#endif 1074*58b9f456SAndroid Build Coastguard Worker return insert(_VSTD::forward<_Pp>(__x)).first; 1075*58b9f456SAndroid Build Coastguard Worker } 1076*58b9f456SAndroid Build Coastguard Worker 1077*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1078*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1079*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> emplace(_Args&&... __args) { 1080*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...); 1081*58b9f456SAndroid Build Coastguard Worker } 1082*58b9f456SAndroid Build Coastguard Worker 1083*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1084*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1085*58b9f456SAndroid Build Coastguard Worker iterator emplace_hint(const_iterator __p, _Args&&... __args) { 1086*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1087*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, 1088*58b9f456SAndroid Build Coastguard Worker "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" 1089*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1090*58b9f456SAndroid Build Coastguard Worker#else 1091*58b9f456SAndroid Build Coastguard Worker ((void)__p); 1092*58b9f456SAndroid Build Coastguard Worker#endif 1093*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; 1094*58b9f456SAndroid Build Coastguard Worker } 1095*58b9f456SAndroid Build Coastguard Worker 1096*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1097*58b9f456SAndroid Build Coastguard Worker 1098*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 1099*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1100*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1101*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) 1102*58b9f456SAndroid Build Coastguard Worker { 1103*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct, 1104*58b9f456SAndroid Build Coastguard Worker _VSTD::forward_as_tuple(__k), 1105*58b9f456SAndroid Build Coastguard Worker _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); 1106*58b9f456SAndroid Build Coastguard Worker } 1107*58b9f456SAndroid Build Coastguard Worker 1108*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1109*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1110*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) 1111*58b9f456SAndroid Build Coastguard Worker { 1112*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct, 1113*58b9f456SAndroid Build Coastguard Worker _VSTD::forward_as_tuple(_VSTD::move(__k)), 1114*58b9f456SAndroid Build Coastguard Worker _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); 1115*58b9f456SAndroid Build Coastguard Worker } 1116*58b9f456SAndroid Build Coastguard Worker 1117*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1118*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1119*58b9f456SAndroid Build Coastguard Worker iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) 1120*58b9f456SAndroid Build Coastguard Worker { 1121*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1122*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, 1123*58b9f456SAndroid Build Coastguard Worker "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" 1124*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1125*58b9f456SAndroid Build Coastguard Worker#else 1126*58b9f456SAndroid Build Coastguard Worker ((void)__h); 1127*58b9f456SAndroid Build Coastguard Worker#endif 1128*58b9f456SAndroid Build Coastguard Worker return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first; 1129*58b9f456SAndroid Build Coastguard Worker } 1130*58b9f456SAndroid Build Coastguard Worker 1131*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1132*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1133*58b9f456SAndroid Build Coastguard Worker iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) 1134*58b9f456SAndroid Build Coastguard Worker { 1135*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1136*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, 1137*58b9f456SAndroid Build Coastguard Worker "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" 1138*58b9f456SAndroid Build Coastguard Worker " referring to this unordered_map"); 1139*58b9f456SAndroid Build Coastguard Worker#else 1140*58b9f456SAndroid Build Coastguard Worker ((void)__h); 1141*58b9f456SAndroid Build Coastguard Worker#endif 1142*58b9f456SAndroid Build Coastguard Worker return try_emplace(_VSTD::move(__k), _VSTD::forward<_Args>(__args)...).first; 1143*58b9f456SAndroid Build Coastguard Worker } 1144*58b9f456SAndroid Build Coastguard Worker 1145*58b9f456SAndroid Build Coastguard Worker template <class _Vp> 1146*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1147*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) 1148*58b9f456SAndroid Build Coastguard Worker { 1149*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, 1150*58b9f456SAndroid Build Coastguard Worker __k, _VSTD::forward<_Vp>(__v)); 1151*58b9f456SAndroid Build Coastguard Worker if (!__res.second) { 1152*58b9f456SAndroid Build Coastguard Worker __res.first->second = _VSTD::forward<_Vp>(__v); 1153*58b9f456SAndroid Build Coastguard Worker } 1154*58b9f456SAndroid Build Coastguard Worker return __res; 1155*58b9f456SAndroid Build Coastguard Worker } 1156*58b9f456SAndroid Build Coastguard Worker 1157*58b9f456SAndroid Build Coastguard Worker template <class _Vp> 1158*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1159*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) 1160*58b9f456SAndroid Build Coastguard Worker { 1161*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> __res = __table_.__emplace_unique_key_args(__k, 1162*58b9f456SAndroid Build Coastguard Worker _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); 1163*58b9f456SAndroid Build Coastguard Worker if (!__res.second) { 1164*58b9f456SAndroid Build Coastguard Worker __res.first->second = _VSTD::forward<_Vp>(__v); 1165*58b9f456SAndroid Build Coastguard Worker } 1166*58b9f456SAndroid Build Coastguard Worker return __res; 1167*58b9f456SAndroid Build Coastguard Worker } 1168*58b9f456SAndroid Build Coastguard Worker 1169*58b9f456SAndroid Build Coastguard Worker template <class _Vp> 1170*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1171*58b9f456SAndroid Build Coastguard Worker iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v) 1172*58b9f456SAndroid Build Coastguard Worker { 1173*58b9f456SAndroid Build Coastguard Worker // FIXME: Add debug mode checking for the iterator input 1174*58b9f456SAndroid Build Coastguard Worker return insert_or_assign(__k, _VSTD::forward<_Vp>(__v)).first; 1175*58b9f456SAndroid Build Coastguard Worker } 1176*58b9f456SAndroid Build Coastguard Worker 1177*58b9f456SAndroid Build Coastguard Worker template <class _Vp> 1178*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1179*58b9f456SAndroid Build Coastguard Worker iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v) 1180*58b9f456SAndroid Build Coastguard Worker { 1181*58b9f456SAndroid Build Coastguard Worker // FIXME: Add debug mode checking for the iterator input 1182*58b9f456SAndroid Build Coastguard Worker return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; 1183*58b9f456SAndroid Build Coastguard Worker } 1184*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_STD_VER > 14 1185*58b9f456SAndroid Build Coastguard Worker 1186*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1187*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} 1188*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1189*58b9f456SAndroid Build Coastguard Worker iterator erase(iterator __p) {return __table_.erase(__p.__i_);} 1190*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1191*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} 1192*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1193*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator __first, const_iterator __last) 1194*58b9f456SAndroid Build Coastguard Worker {return __table_.erase(__first.__i_, __last.__i_);} 1195*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1196*58b9f456SAndroid Build Coastguard Worker void clear() _NOEXCEPT {__table_.clear();} 1197*58b9f456SAndroid Build Coastguard Worker 1198*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 1199*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1200*58b9f456SAndroid Build Coastguard Worker insert_return_type insert(node_type&& __nh) 1201*58b9f456SAndroid Build Coastguard Worker { 1202*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1203*58b9f456SAndroid Build Coastguard Worker "node_type with incompatible allocator passed to unordered_map::insert()"); 1204*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_insert_unique< 1205*58b9f456SAndroid Build Coastguard Worker node_type, insert_return_type>(_VSTD::move(__nh)); 1206*58b9f456SAndroid Build Coastguard Worker } 1207*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1208*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __hint, node_type&& __nh) 1209*58b9f456SAndroid Build Coastguard Worker { 1210*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1211*58b9f456SAndroid Build Coastguard Worker "node_type with incompatible allocator passed to unordered_map::insert()"); 1212*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_insert_unique<node_type>( 1213*58b9f456SAndroid Build Coastguard Worker __hint.__i_, _VSTD::move(__nh)); 1214*58b9f456SAndroid Build Coastguard Worker } 1215*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1216*58b9f456SAndroid Build Coastguard Worker node_type extract(key_type const& __key) 1217*58b9f456SAndroid Build Coastguard Worker { 1218*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_extract<node_type>(__key); 1219*58b9f456SAndroid Build Coastguard Worker } 1220*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1221*58b9f456SAndroid Build Coastguard Worker node_type extract(const_iterator __it) 1222*58b9f456SAndroid Build Coastguard Worker { 1223*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_extract<node_type>( 1224*58b9f456SAndroid Build Coastguard Worker __it.__i_); 1225*58b9f456SAndroid Build Coastguard Worker } 1226*58b9f456SAndroid Build Coastguard Worker 1227*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1228*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1229*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) 1230*58b9f456SAndroid Build Coastguard Worker { 1231*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1232*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1233*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_unique(__source.__table_); 1234*58b9f456SAndroid Build Coastguard Worker } 1235*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1236*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1237*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) 1238*58b9f456SAndroid Build Coastguard Worker { 1239*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1240*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1241*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_unique(__source.__table_); 1242*58b9f456SAndroid Build Coastguard Worker } 1243*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1244*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1245*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) 1246*58b9f456SAndroid Build Coastguard Worker { 1247*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1248*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1249*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_unique(__source.__table_); 1250*58b9f456SAndroid Build Coastguard Worker } 1251*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1252*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1253*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) 1254*58b9f456SAndroid Build Coastguard Worker { 1255*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1256*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1257*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_unique(__source.__table_); 1258*58b9f456SAndroid Build Coastguard Worker } 1259*58b9f456SAndroid Build Coastguard Worker#endif 1260*58b9f456SAndroid Build Coastguard Worker 1261*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1262*58b9f456SAndroid Build Coastguard Worker void swap(unordered_map& __u) 1263*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 1264*58b9f456SAndroid Build Coastguard Worker { __table_.swap(__u.__table_);} 1265*58b9f456SAndroid Build Coastguard Worker 1266*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1267*58b9f456SAndroid Build Coastguard Worker hasher hash_function() const 1268*58b9f456SAndroid Build Coastguard Worker {return __table_.hash_function().hash_function();} 1269*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1270*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const 1271*58b9f456SAndroid Build Coastguard Worker {return __table_.key_eq().key_eq();} 1272*58b9f456SAndroid Build Coastguard Worker 1273*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1274*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& __k) {return __table_.find(__k);} 1275*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1276*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& __k) const {return __table_.find(__k);} 1277*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1278*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} 1279*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1280*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& __k) 1281*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_unique(__k);} 1282*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1283*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 1284*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_unique(__k);} 1285*58b9f456SAndroid Build Coastguard Worker 1286*58b9f456SAndroid Build Coastguard Worker mapped_type& operator[](const key_type& __k); 1287*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1288*58b9f456SAndroid Build Coastguard Worker mapped_type& operator[](key_type&& __k); 1289*58b9f456SAndroid Build Coastguard Worker#endif 1290*58b9f456SAndroid Build Coastguard Worker 1291*58b9f456SAndroid Build Coastguard Worker mapped_type& at(const key_type& __k); 1292*58b9f456SAndroid Build Coastguard Worker const mapped_type& at(const key_type& __k) const; 1293*58b9f456SAndroid Build Coastguard Worker 1294*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1295*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 1296*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1297*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();} 1298*58b9f456SAndroid Build Coastguard Worker 1299*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1300*58b9f456SAndroid Build Coastguard Worker size_type bucket_size(size_type __n) const 1301*58b9f456SAndroid Build Coastguard Worker {return __table_.bucket_size(__n);} 1302*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1303*58b9f456SAndroid Build Coastguard Worker size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 1304*58b9f456SAndroid Build Coastguard Worker 1305*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1306*58b9f456SAndroid Build Coastguard Worker local_iterator begin(size_type __n) {return __table_.begin(__n);} 1307*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1308*58b9f456SAndroid Build Coastguard Worker local_iterator end(size_type __n) {return __table_.end(__n);} 1309*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1310*58b9f456SAndroid Build Coastguard Worker const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 1311*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1312*58b9f456SAndroid Build Coastguard Worker const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 1313*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1314*58b9f456SAndroid Build Coastguard Worker const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 1315*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1316*58b9f456SAndroid Build Coastguard Worker const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 1317*58b9f456SAndroid Build Coastguard Worker 1318*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1319*58b9f456SAndroid Build Coastguard Worker float load_factor() const _NOEXCEPT {return __table_.load_factor();} 1320*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1321*58b9f456SAndroid Build Coastguard Worker float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 1322*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1323*58b9f456SAndroid Build Coastguard Worker void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 1324*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1325*58b9f456SAndroid Build Coastguard Worker void rehash(size_type __n) {__table_.rehash(__n);} 1326*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1327*58b9f456SAndroid Build Coastguard Worker void reserve(size_type __n) {__table_.reserve(__n);} 1328*58b9f456SAndroid Build Coastguard Worker 1329*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1330*58b9f456SAndroid Build Coastguard Worker 1331*58b9f456SAndroid Build Coastguard Worker bool __dereferenceable(const const_iterator* __i) const 1332*58b9f456SAndroid Build Coastguard Worker {return __table_.__dereferenceable(&__i->__i_);} 1333*58b9f456SAndroid Build Coastguard Worker bool __decrementable(const const_iterator* __i) const 1334*58b9f456SAndroid Build Coastguard Worker {return __table_.__decrementable(&__i->__i_);} 1335*58b9f456SAndroid Build Coastguard Worker bool __addable(const const_iterator* __i, ptrdiff_t __n) const 1336*58b9f456SAndroid Build Coastguard Worker {return __table_.__addable(&__i->__i_, __n);} 1337*58b9f456SAndroid Build Coastguard Worker bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 1338*58b9f456SAndroid Build Coastguard Worker {return __table_.__addable(&__i->__i_, __n);} 1339*58b9f456SAndroid Build Coastguard Worker 1340*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_DEBUG_LEVEL >= 2 1341*58b9f456SAndroid Build Coastguard Worker 1342*58b9f456SAndroid Build Coastguard Workerprivate: 1343*58b9f456SAndroid Build Coastguard Worker 1344*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_CXX03_LANG 1345*58b9f456SAndroid Build Coastguard Worker __node_holder __construct_node_with_key(const key_type& __k); 1346*58b9f456SAndroid Build Coastguard Worker#endif 1347*58b9f456SAndroid Build Coastguard Worker}; 1348*58b9f456SAndroid Build Coastguard Worker 1349*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1350*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1351*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql) 1352*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 1353*58b9f456SAndroid Build Coastguard Worker{ 1354*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1355*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1356*58b9f456SAndroid Build Coastguard Worker#endif 1357*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1358*58b9f456SAndroid Build Coastguard Worker} 1359*58b9f456SAndroid Build Coastguard Worker 1360*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1361*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1362*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql, 1363*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 1364*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 1365*58b9f456SAndroid Build Coastguard Worker{ 1366*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1367*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1368*58b9f456SAndroid Build Coastguard Worker#endif 1369*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1370*58b9f456SAndroid Build Coastguard Worker} 1371*58b9f456SAndroid Build Coastguard Worker 1372*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1373*58b9f456SAndroid Build Coastguard Workerinline 1374*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1375*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 1376*58b9f456SAndroid Build Coastguard Worker : __table_(typename __table::allocator_type(__a)) 1377*58b9f456SAndroid Build Coastguard Worker{ 1378*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1379*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1380*58b9f456SAndroid Build Coastguard Worker#endif 1381*58b9f456SAndroid Build Coastguard Worker} 1382*58b9f456SAndroid Build Coastguard Worker 1383*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1384*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 1385*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1386*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last) 1387*58b9f456SAndroid Build Coastguard Worker{ 1388*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1389*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1390*58b9f456SAndroid Build Coastguard Worker#endif 1391*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 1392*58b9f456SAndroid Build Coastguard Worker} 1393*58b9f456SAndroid Build Coastguard Worker 1394*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1395*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 1396*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1397*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 1398*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql) 1399*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 1400*58b9f456SAndroid Build Coastguard Worker{ 1401*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1402*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1403*58b9f456SAndroid Build Coastguard Worker#endif 1404*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1405*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 1406*58b9f456SAndroid Build Coastguard Worker} 1407*58b9f456SAndroid Build Coastguard Worker 1408*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1409*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 1410*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1411*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 1412*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 1413*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 1414*58b9f456SAndroid Build Coastguard Worker{ 1415*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1416*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1417*58b9f456SAndroid Build Coastguard Worker#endif 1418*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1419*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 1420*58b9f456SAndroid Build Coastguard Worker} 1421*58b9f456SAndroid Build Coastguard Worker 1422*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1423*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1424*58b9f456SAndroid Build Coastguard Worker const unordered_map& __u) 1425*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_) 1426*58b9f456SAndroid Build Coastguard Worker{ 1427*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1428*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1429*58b9f456SAndroid Build Coastguard Worker#endif 1430*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 1431*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 1432*58b9f456SAndroid Build Coastguard Worker} 1433*58b9f456SAndroid Build Coastguard Worker 1434*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1435*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1436*58b9f456SAndroid Build Coastguard Worker const unordered_map& __u, const allocator_type& __a) 1437*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_, typename __table::allocator_type(__a)) 1438*58b9f456SAndroid Build Coastguard Worker{ 1439*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1440*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1441*58b9f456SAndroid Build Coastguard Worker#endif 1442*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 1443*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 1444*58b9f456SAndroid Build Coastguard Worker} 1445*58b9f456SAndroid Build Coastguard Worker 1446*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1447*58b9f456SAndroid Build Coastguard Worker 1448*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1449*58b9f456SAndroid Build Coastguard Workerinline 1450*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1451*58b9f456SAndroid Build Coastguard Worker unordered_map&& __u) 1452*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 1453*58b9f456SAndroid Build Coastguard Worker : __table_(_VSTD::move(__u.__table_)) 1454*58b9f456SAndroid Build Coastguard Worker{ 1455*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1456*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1457*58b9f456SAndroid Build Coastguard Worker __get_db()->swap(this, &__u); 1458*58b9f456SAndroid Build Coastguard Worker#endif 1459*58b9f456SAndroid Build Coastguard Worker} 1460*58b9f456SAndroid Build Coastguard Worker 1461*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1462*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1463*58b9f456SAndroid Build Coastguard Worker unordered_map&& __u, const allocator_type& __a) 1464*58b9f456SAndroid Build Coastguard Worker : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) 1465*58b9f456SAndroid Build Coastguard Worker{ 1466*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1467*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1468*58b9f456SAndroid Build Coastguard Worker#endif 1469*58b9f456SAndroid Build Coastguard Worker if (__a != __u.get_allocator()) 1470*58b9f456SAndroid Build Coastguard Worker { 1471*58b9f456SAndroid Build Coastguard Worker iterator __i = __u.begin(); 1472*58b9f456SAndroid Build Coastguard Worker while (__u.size() != 0) { 1473*58b9f456SAndroid Build Coastguard Worker __table_.__emplace_unique( 1474*58b9f456SAndroid Build Coastguard Worker __u.__table_.remove((__i++).__i_)->__value_.__move()); 1475*58b9f456SAndroid Build Coastguard Worker } 1476*58b9f456SAndroid Build Coastguard Worker } 1477*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1478*58b9f456SAndroid Build Coastguard Worker else 1479*58b9f456SAndroid Build Coastguard Worker __get_db()->swap(this, &__u); 1480*58b9f456SAndroid Build Coastguard Worker#endif 1481*58b9f456SAndroid Build Coastguard Worker} 1482*58b9f456SAndroid Build Coastguard Worker 1483*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1484*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1485*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il) 1486*58b9f456SAndroid Build Coastguard Worker{ 1487*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1488*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1489*58b9f456SAndroid Build Coastguard Worker#endif 1490*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 1491*58b9f456SAndroid Build Coastguard Worker} 1492*58b9f456SAndroid Build Coastguard Worker 1493*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1494*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1495*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1496*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql) 1497*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 1498*58b9f456SAndroid Build Coastguard Worker{ 1499*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1500*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1501*58b9f456SAndroid Build Coastguard Worker#endif 1502*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1503*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 1504*58b9f456SAndroid Build Coastguard Worker} 1505*58b9f456SAndroid Build Coastguard Worker 1506*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1507*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( 1508*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1509*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, const allocator_type& __a) 1510*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 1511*58b9f456SAndroid Build Coastguard Worker{ 1512*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1513*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1514*58b9f456SAndroid Build Coastguard Worker#endif 1515*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 1516*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 1517*58b9f456SAndroid Build Coastguard Worker} 1518*58b9f456SAndroid Build Coastguard Worker 1519*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1520*58b9f456SAndroid Build Coastguard Workerinline 1521*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& 1522*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) 1523*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 1524*58b9f456SAndroid Build Coastguard Worker{ 1525*58b9f456SAndroid Build Coastguard Worker __table_ = _VSTD::move(__u.__table_); 1526*58b9f456SAndroid Build Coastguard Worker return *this; 1527*58b9f456SAndroid Build Coastguard Worker} 1528*58b9f456SAndroid Build Coastguard Worker 1529*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1530*58b9f456SAndroid Build Coastguard Workerinline 1531*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& 1532*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( 1533*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il) 1534*58b9f456SAndroid Build Coastguard Worker{ 1535*58b9f456SAndroid Build Coastguard Worker __table_.__assign_unique(__il.begin(), __il.end()); 1536*58b9f456SAndroid Build Coastguard Worker return *this; 1537*58b9f456SAndroid Build Coastguard Worker} 1538*58b9f456SAndroid Build Coastguard Worker 1539*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1540*58b9f456SAndroid Build Coastguard Worker 1541*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1542*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 1543*58b9f456SAndroid Build Coastguard Workerinline 1544*58b9f456SAndroid Build Coastguard Workervoid 1545*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 1546*58b9f456SAndroid Build Coastguard Worker _InputIterator __last) 1547*58b9f456SAndroid Build Coastguard Worker{ 1548*58b9f456SAndroid Build Coastguard Worker for (; __first != __last; ++__first) 1549*58b9f456SAndroid Build Coastguard Worker __table_.__insert_unique(*__first); 1550*58b9f456SAndroid Build Coastguard Worker} 1551*58b9f456SAndroid Build Coastguard Worker 1552*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1553*58b9f456SAndroid Build Coastguard Worker 1554*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1555*58b9f456SAndroid Build Coastguard Worker_Tp& 1556*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) 1557*58b9f456SAndroid Build Coastguard Worker{ 1558*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique_key_args(__k, 1559*58b9f456SAndroid Build Coastguard Worker std::piecewise_construct, std::forward_as_tuple(__k), 1560*58b9f456SAndroid Build Coastguard Worker std::forward_as_tuple()).first->__get_value().second; 1561*58b9f456SAndroid Build Coastguard Worker} 1562*58b9f456SAndroid Build Coastguard Worker 1563*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1564*58b9f456SAndroid Build Coastguard Worker_Tp& 1565*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) 1566*58b9f456SAndroid Build Coastguard Worker{ 1567*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_unique_key_args(__k, 1568*58b9f456SAndroid Build Coastguard Worker std::piecewise_construct, std::forward_as_tuple(std::move(__k)), 1569*58b9f456SAndroid Build Coastguard Worker std::forward_as_tuple()).first->__get_value().second; 1570*58b9f456SAndroid Build Coastguard Worker} 1571*58b9f456SAndroid Build Coastguard Worker#else // _LIBCPP_CXX03_LANG 1572*58b9f456SAndroid Build Coastguard Worker 1573*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1574*58b9f456SAndroid Build Coastguard Workertypename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder 1575*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) 1576*58b9f456SAndroid Build Coastguard Worker{ 1577*58b9f456SAndroid Build Coastguard Worker __node_allocator& __na = __table_.__node_alloc(); 1578*58b9f456SAndroid Build Coastguard Worker __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); 1579*58b9f456SAndroid Build Coastguard Worker __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().first), __k); 1580*58b9f456SAndroid Build Coastguard Worker __h.get_deleter().__first_constructed = true; 1581*58b9f456SAndroid Build Coastguard Worker __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second)); 1582*58b9f456SAndroid Build Coastguard Worker __h.get_deleter().__second_constructed = true; 1583*58b9f456SAndroid Build Coastguard Worker return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 1584*58b9f456SAndroid Build Coastguard Worker} 1585*58b9f456SAndroid Build Coastguard Worker 1586*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1587*58b9f456SAndroid Build Coastguard Worker_Tp& 1588*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) 1589*58b9f456SAndroid Build Coastguard Worker{ 1590*58b9f456SAndroid Build Coastguard Worker iterator __i = find(__k); 1591*58b9f456SAndroid Build Coastguard Worker if (__i != end()) 1592*58b9f456SAndroid Build Coastguard Worker return __i->second; 1593*58b9f456SAndroid Build Coastguard Worker __node_holder __h = __construct_node_with_key(__k); 1594*58b9f456SAndroid Build Coastguard Worker pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get()); 1595*58b9f456SAndroid Build Coastguard Worker __h.release(); 1596*58b9f456SAndroid Build Coastguard Worker return __r.first->second; 1597*58b9f456SAndroid Build Coastguard Worker} 1598*58b9f456SAndroid Build Coastguard Worker 1599*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_MODE 1600*58b9f456SAndroid Build Coastguard Worker 1601*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1602*58b9f456SAndroid Build Coastguard Worker_Tp& 1603*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) 1604*58b9f456SAndroid Build Coastguard Worker{ 1605*58b9f456SAndroid Build Coastguard Worker iterator __i = find(__k); 1606*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS 1607*58b9f456SAndroid Build Coastguard Worker if (__i == end()) 1608*58b9f456SAndroid Build Coastguard Worker throw out_of_range("unordered_map::at: key not found"); 1609*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_NO_EXCEPTIONS 1610*58b9f456SAndroid Build Coastguard Worker return __i->second; 1611*58b9f456SAndroid Build Coastguard Worker} 1612*58b9f456SAndroid Build Coastguard Worker 1613*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1614*58b9f456SAndroid Build Coastguard Workerconst _Tp& 1615*58b9f456SAndroid Build Coastguard Workerunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const 1616*58b9f456SAndroid Build Coastguard Worker{ 1617*58b9f456SAndroid Build Coastguard Worker const_iterator __i = find(__k); 1618*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS 1619*58b9f456SAndroid Build Coastguard Worker if (__i == end()) 1620*58b9f456SAndroid Build Coastguard Worker throw out_of_range("unordered_map::at: key not found"); 1621*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_NO_EXCEPTIONS 1622*58b9f456SAndroid Build Coastguard Worker return __i->second; 1623*58b9f456SAndroid Build Coastguard Worker} 1624*58b9f456SAndroid Build Coastguard Worker 1625*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1626*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1627*58b9f456SAndroid Build Coastguard Workervoid 1628*58b9f456SAndroid Build Coastguard Workerswap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 1629*58b9f456SAndroid Build Coastguard Worker unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 1630*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 1631*58b9f456SAndroid Build Coastguard Worker{ 1632*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 1633*58b9f456SAndroid Build Coastguard Worker} 1634*58b9f456SAndroid Build Coastguard Worker 1635*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17 1636*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate> 1637*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1638*58b9f456SAndroid Build Coastguard Workervoid erase_if(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) 1639*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); } 1640*58b9f456SAndroid Build Coastguard Worker#endif 1641*58b9f456SAndroid Build Coastguard Worker 1642*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1643*58b9f456SAndroid Build Coastguard Workerbool 1644*58b9f456SAndroid Build Coastguard Workeroperator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 1645*58b9f456SAndroid Build Coastguard Worker const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 1646*58b9f456SAndroid Build Coastguard Worker{ 1647*58b9f456SAndroid Build Coastguard Worker if (__x.size() != __y.size()) 1648*58b9f456SAndroid Build Coastguard Worker return false; 1649*58b9f456SAndroid Build Coastguard Worker typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator 1650*58b9f456SAndroid Build Coastguard Worker const_iterator; 1651*58b9f456SAndroid Build Coastguard Worker for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); 1652*58b9f456SAndroid Build Coastguard Worker __i != __ex; ++__i) 1653*58b9f456SAndroid Build Coastguard Worker { 1654*58b9f456SAndroid Build Coastguard Worker const_iterator __j = __y.find(__i->first); 1655*58b9f456SAndroid Build Coastguard Worker if (__j == __ey || !(*__i == *__j)) 1656*58b9f456SAndroid Build Coastguard Worker return false; 1657*58b9f456SAndroid Build Coastguard Worker } 1658*58b9f456SAndroid Build Coastguard Worker return true; 1659*58b9f456SAndroid Build Coastguard Worker} 1660*58b9f456SAndroid Build Coastguard Worker 1661*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 1662*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1663*58b9f456SAndroid Build Coastguard Workerbool 1664*58b9f456SAndroid Build Coastguard Workeroperator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 1665*58b9f456SAndroid Build Coastguard Worker const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 1666*58b9f456SAndroid Build Coastguard Worker{ 1667*58b9f456SAndroid Build Coastguard Worker return !(__x == __y); 1668*58b9f456SAndroid Build Coastguard Worker} 1669*58b9f456SAndroid Build Coastguard Worker 1670*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, 1671*58b9f456SAndroid Build Coastguard Worker class _Alloc = allocator<pair<const _Key, _Tp> > > 1672*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS unordered_multimap 1673*58b9f456SAndroid Build Coastguard Worker{ 1674*58b9f456SAndroid Build Coastguard Workerpublic: 1675*58b9f456SAndroid Build Coastguard Worker // types 1676*58b9f456SAndroid Build Coastguard Worker typedef _Key key_type; 1677*58b9f456SAndroid Build Coastguard Worker typedef _Tp mapped_type; 1678*58b9f456SAndroid Build Coastguard Worker typedef _Hash hasher; 1679*58b9f456SAndroid Build Coastguard Worker typedef _Pred key_equal; 1680*58b9f456SAndroid Build Coastguard Worker typedef _Alloc allocator_type; 1681*58b9f456SAndroid Build Coastguard Worker typedef pair<const key_type, mapped_type> value_type; 1682*58b9f456SAndroid Build Coastguard Worker typedef value_type& reference; 1683*58b9f456SAndroid Build Coastguard Worker typedef const value_type& const_reference; 1684*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<value_type, typename allocator_type::value_type>::value), 1685*58b9f456SAndroid Build Coastguard Worker "Invalid allocator::value_type"); 1686*58b9f456SAndroid Build Coastguard Worker static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); 1687*58b9f456SAndroid Build Coastguard Worker 1688*58b9f456SAndroid Build Coastguard Workerprivate: 1689*58b9f456SAndroid Build Coastguard Worker typedef __hash_value_type<key_type, mapped_type> __value_type; 1690*58b9f456SAndroid Build Coastguard Worker typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; 1691*58b9f456SAndroid Build Coastguard Worker typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; 1692*58b9f456SAndroid Build Coastguard Worker typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, 1693*58b9f456SAndroid Build Coastguard Worker __value_type>::type __allocator_type; 1694*58b9f456SAndroid Build Coastguard Worker 1695*58b9f456SAndroid Build Coastguard Worker typedef __hash_table<__value_type, __hasher, 1696*58b9f456SAndroid Build Coastguard Worker __key_equal, __allocator_type> __table; 1697*58b9f456SAndroid Build Coastguard Worker 1698*58b9f456SAndroid Build Coastguard Worker __table __table_; 1699*58b9f456SAndroid Build Coastguard Worker 1700*58b9f456SAndroid Build Coastguard Worker typedef typename __table::_NodeTypes _NodeTypes; 1701*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_traits __node_traits; 1702*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node_allocator __node_allocator; 1703*58b9f456SAndroid Build Coastguard Worker typedef typename __table::__node __node; 1704*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_node_destructor<__node_allocator> _Dp; 1705*58b9f456SAndroid Build Coastguard Worker typedef unique_ptr<__node, _Dp> __node_holder; 1706*58b9f456SAndroid Build Coastguard Worker typedef allocator_traits<allocator_type> __alloc_traits; 1707*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<typename __node_traits::size_type, 1708*58b9f456SAndroid Build Coastguard Worker typename __alloc_traits::size_type>::value), 1709*58b9f456SAndroid Build Coastguard Worker "Allocator uses different size_type for different types"); 1710*58b9f456SAndroid Build Coastguard Workerpublic: 1711*58b9f456SAndroid Build Coastguard Worker typedef typename __alloc_traits::pointer pointer; 1712*58b9f456SAndroid Build Coastguard Worker typedef typename __alloc_traits::const_pointer const_pointer; 1713*58b9f456SAndroid Build Coastguard Worker typedef typename __table::size_type size_type; 1714*58b9f456SAndroid Build Coastguard Worker typedef typename __table::difference_type difference_type; 1715*58b9f456SAndroid Build Coastguard Worker 1716*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_iterator<typename __table::iterator> iterator; 1717*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; 1718*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; 1719*58b9f456SAndroid Build Coastguard Worker typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; 1720*58b9f456SAndroid Build Coastguard Worker 1721*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 1722*58b9f456SAndroid Build Coastguard Worker typedef __map_node_handle<__node, allocator_type> node_type; 1723*58b9f456SAndroid Build Coastguard Worker#endif 1724*58b9f456SAndroid Build Coastguard Worker 1725*58b9f456SAndroid Build Coastguard Worker template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> 1726*58b9f456SAndroid Build Coastguard Worker friend class _LIBCPP_TEMPLATE_VIS unordered_map; 1727*58b9f456SAndroid Build Coastguard Worker template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> 1728*58b9f456SAndroid Build Coastguard Worker friend class _LIBCPP_TEMPLATE_VIS unordered_multimap; 1729*58b9f456SAndroid Build Coastguard Worker 1730*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1731*58b9f456SAndroid Build Coastguard Worker unordered_multimap() 1732*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) 1733*58b9f456SAndroid Build Coastguard Worker { 1734*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 1735*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 1736*58b9f456SAndroid Build Coastguard Worker#endif 1737*58b9f456SAndroid Build Coastguard Worker } 1738*58b9f456SAndroid Build Coastguard Worker explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(), 1739*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 1740*58b9f456SAndroid Build Coastguard Worker unordered_multimap(size_type __n, const hasher& __hf, 1741*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, 1742*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 1743*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1744*58b9f456SAndroid Build Coastguard Worker unordered_multimap(_InputIterator __first, _InputIterator __last); 1745*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1746*58b9f456SAndroid Build Coastguard Worker unordered_multimap(_InputIterator __first, _InputIterator __last, 1747*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf = hasher(), 1748*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 1749*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1750*58b9f456SAndroid Build Coastguard Worker unordered_multimap(_InputIterator __first, _InputIterator __last, 1751*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, 1752*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, 1753*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 1754*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1755*58b9f456SAndroid Build Coastguard Worker explicit unordered_multimap(const allocator_type& __a); 1756*58b9f456SAndroid Build Coastguard Worker unordered_multimap(const unordered_multimap& __u); 1757*58b9f456SAndroid Build Coastguard Worker unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); 1758*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1759*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1760*58b9f456SAndroid Build Coastguard Worker unordered_multimap(unordered_multimap&& __u) 1761*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); 1762*58b9f456SAndroid Build Coastguard Worker unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); 1763*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> __il); 1764*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> __il, size_type __n, 1765*58b9f456SAndroid Build Coastguard Worker const hasher& __hf = hasher(), 1766*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql = key_equal()); 1767*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> __il, size_type __n, 1768*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, 1769*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a); 1770*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1771*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11 1772*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1773*58b9f456SAndroid Build Coastguard Worker unordered_multimap(size_type __n, const allocator_type& __a) 1774*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__n, hasher(), key_equal(), __a) {} 1775*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1776*58b9f456SAndroid Build Coastguard Worker unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a) 1777*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__n, __hf, key_equal(), __a) {} 1778*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1779*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1780*58b9f456SAndroid Build Coastguard Worker unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) 1781*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {} 1782*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1783*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1784*58b9f456SAndroid Build Coastguard Worker unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 1785*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 1786*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {} 1787*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1788*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) 1789*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {} 1790*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1791*58b9f456SAndroid Build Coastguard Worker unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1792*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 1793*58b9f456SAndroid Build Coastguard Worker : unordered_multimap(__il, __n, __hf, key_equal(), __a) {} 1794*58b9f456SAndroid Build Coastguard Worker#endif 1795*58b9f456SAndroid Build Coastguard Worker // ~unordered_multimap() = default; 1796*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1797*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(const unordered_multimap& __u) 1798*58b9f456SAndroid Build Coastguard Worker { 1799*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1800*58b9f456SAndroid Build Coastguard Worker __table_ = __u.__table_; 1801*58b9f456SAndroid Build Coastguard Worker#else 1802*58b9f456SAndroid Build Coastguard Worker if (this != &__u) { 1803*58b9f456SAndroid Build Coastguard Worker __table_.clear(); 1804*58b9f456SAndroid Build Coastguard Worker __table_.hash_function() = __u.__table_.hash_function(); 1805*58b9f456SAndroid Build Coastguard Worker __table_.key_eq() = __u.__table_.key_eq(); 1806*58b9f456SAndroid Build Coastguard Worker __table_.max_load_factor() = __u.__table_.max_load_factor(); 1807*58b9f456SAndroid Build Coastguard Worker __table_.__copy_assign_alloc(__u.__table_); 1808*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 1809*58b9f456SAndroid Build Coastguard Worker } 1810*58b9f456SAndroid Build Coastguard Worker#endif 1811*58b9f456SAndroid Build Coastguard Worker return *this; 1812*58b9f456SAndroid Build Coastguard Worker } 1813*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1814*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1815*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(unordered_multimap&& __u) 1816*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); 1817*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1818*58b9f456SAndroid Build Coastguard Worker unordered_multimap& operator=(initializer_list<value_type> __il); 1819*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1820*58b9f456SAndroid Build Coastguard Worker 1821*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1822*58b9f456SAndroid Build Coastguard Worker allocator_type get_allocator() const _NOEXCEPT 1823*58b9f456SAndroid Build Coastguard Worker {return allocator_type(__table_.__node_alloc());} 1824*58b9f456SAndroid Build Coastguard Worker 1825*58b9f456SAndroid Build Coastguard Worker _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 1826*58b9f456SAndroid Build Coastguard Worker bool empty() const _NOEXCEPT {return __table_.size() == 0;} 1827*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1828*58b9f456SAndroid Build Coastguard Worker size_type size() const _NOEXCEPT {return __table_.size();} 1829*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1830*58b9f456SAndroid Build Coastguard Worker size_type max_size() const _NOEXCEPT {return __table_.max_size();} 1831*58b9f456SAndroid Build Coastguard Worker 1832*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1833*58b9f456SAndroid Build Coastguard Worker iterator begin() _NOEXCEPT {return __table_.begin();} 1834*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1835*58b9f456SAndroid Build Coastguard Worker iterator end() _NOEXCEPT {return __table_.end();} 1836*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1837*58b9f456SAndroid Build Coastguard Worker const_iterator begin() const _NOEXCEPT {return __table_.begin();} 1838*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1839*58b9f456SAndroid Build Coastguard Worker const_iterator end() const _NOEXCEPT {return __table_.end();} 1840*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1841*58b9f456SAndroid Build Coastguard Worker const_iterator cbegin() const _NOEXCEPT {return __table_.begin();} 1842*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1843*58b9f456SAndroid Build Coastguard Worker const_iterator cend() const _NOEXCEPT {return __table_.end();} 1844*58b9f456SAndroid Build Coastguard Worker 1845*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1846*58b9f456SAndroid Build Coastguard Worker iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} 1847*58b9f456SAndroid Build Coastguard Worker 1848*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1849*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, const value_type& __x) 1850*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_multi(__p.__i_, __x);} 1851*58b9f456SAndroid Build Coastguard Worker 1852*58b9f456SAndroid Build Coastguard Worker template <class _InputIterator> 1853*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1854*58b9f456SAndroid Build Coastguard Worker void insert(_InputIterator __first, _InputIterator __last); 1855*58b9f456SAndroid Build Coastguard Worker 1856*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1857*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1858*58b9f456SAndroid Build Coastguard Worker void insert(initializer_list<value_type> __il) 1859*58b9f456SAndroid Build Coastguard Worker {insert(__il.begin(), __il.end());} 1860*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1861*58b9f456SAndroid Build Coastguard Worker iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} 1862*58b9f456SAndroid Build Coastguard Worker 1863*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1864*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, value_type&& __x) 1865*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_multi(__p.__i_, _VSTD::move(__x));} 1866*58b9f456SAndroid Build Coastguard Worker 1867*58b9f456SAndroid Build Coastguard Worker template <class _Pp, 1868*58b9f456SAndroid Build Coastguard Worker class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> 1869*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1870*58b9f456SAndroid Build Coastguard Worker iterator insert(_Pp&& __x) 1871*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));} 1872*58b9f456SAndroid Build Coastguard Worker 1873*58b9f456SAndroid Build Coastguard Worker template <class _Pp, 1874*58b9f456SAndroid Build Coastguard Worker class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> 1875*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1876*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __p, _Pp&& __x) 1877*58b9f456SAndroid Build Coastguard Worker {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));} 1878*58b9f456SAndroid Build Coastguard Worker 1879*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1880*58b9f456SAndroid Build Coastguard Worker iterator emplace(_Args&&... __args) { 1881*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...); 1882*58b9f456SAndroid Build Coastguard Worker } 1883*58b9f456SAndroid Build Coastguard Worker 1884*58b9f456SAndroid Build Coastguard Worker template <class... _Args> 1885*58b9f456SAndroid Build Coastguard Worker iterator emplace_hint(const_iterator __p, _Args&&... __args) { 1886*58b9f456SAndroid Build Coastguard Worker return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_Args>(__args)...); 1887*58b9f456SAndroid Build Coastguard Worker } 1888*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1889*58b9f456SAndroid Build Coastguard Worker 1890*58b9f456SAndroid Build Coastguard Worker 1891*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1892*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} 1893*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1894*58b9f456SAndroid Build Coastguard Worker iterator erase(iterator __p) {return __table_.erase(__p.__i_);} 1895*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1896*58b9f456SAndroid Build Coastguard Worker size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} 1897*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1898*58b9f456SAndroid Build Coastguard Worker iterator erase(const_iterator __first, const_iterator __last) 1899*58b9f456SAndroid Build Coastguard Worker {return __table_.erase(__first.__i_, __last.__i_);} 1900*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1901*58b9f456SAndroid Build Coastguard Worker void clear() _NOEXCEPT {__table_.clear();} 1902*58b9f456SAndroid Build Coastguard Worker 1903*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 1904*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1905*58b9f456SAndroid Build Coastguard Worker iterator insert(node_type&& __nh) 1906*58b9f456SAndroid Build Coastguard Worker { 1907*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1908*58b9f456SAndroid Build Coastguard Worker "node_type with incompatible allocator passed to unordered_multimap::insert()"); 1909*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_insert_multi<node_type>( 1910*58b9f456SAndroid Build Coastguard Worker _VSTD::move(__nh)); 1911*58b9f456SAndroid Build Coastguard Worker } 1912*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1913*58b9f456SAndroid Build Coastguard Worker iterator insert(const_iterator __hint, node_type&& __nh) 1914*58b9f456SAndroid Build Coastguard Worker { 1915*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 1916*58b9f456SAndroid Build Coastguard Worker "node_type with incompatible allocator passed to unordered_multimap::insert()"); 1917*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_insert_multi<node_type>( 1918*58b9f456SAndroid Build Coastguard Worker __hint.__i_, _VSTD::move(__nh)); 1919*58b9f456SAndroid Build Coastguard Worker } 1920*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1921*58b9f456SAndroid Build Coastguard Worker node_type extract(key_type const& __key) 1922*58b9f456SAndroid Build Coastguard Worker { 1923*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_extract<node_type>(__key); 1924*58b9f456SAndroid Build Coastguard Worker } 1925*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1926*58b9f456SAndroid Build Coastguard Worker node_type extract(const_iterator __it) 1927*58b9f456SAndroid Build Coastguard Worker { 1928*58b9f456SAndroid Build Coastguard Worker return __table_.template __node_handle_extract<node_type>( 1929*58b9f456SAndroid Build Coastguard Worker __it.__i_); 1930*58b9f456SAndroid Build Coastguard Worker } 1931*58b9f456SAndroid Build Coastguard Worker 1932*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1933*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1934*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source) 1935*58b9f456SAndroid Build Coastguard Worker { 1936*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1937*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1938*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_multi(__source.__table_); 1939*58b9f456SAndroid Build Coastguard Worker } 1940*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1941*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1942*58b9f456SAndroid Build Coastguard Worker void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) 1943*58b9f456SAndroid Build Coastguard Worker { 1944*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1945*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1946*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_multi(__source.__table_); 1947*58b9f456SAndroid Build Coastguard Worker } 1948*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1949*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1950*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source) 1951*58b9f456SAndroid Build Coastguard Worker { 1952*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1953*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1954*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_multi(__source.__table_); 1955*58b9f456SAndroid Build Coastguard Worker } 1956*58b9f456SAndroid Build Coastguard Worker template <class _H2, class _P2> 1957*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1958*58b9f456SAndroid Build Coastguard Worker void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source) 1959*58b9f456SAndroid Build Coastguard Worker { 1960*58b9f456SAndroid Build Coastguard Worker _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1961*58b9f456SAndroid Build Coastguard Worker "merging container with incompatible allocator"); 1962*58b9f456SAndroid Build Coastguard Worker return __table_.__node_handle_merge_multi(__source.__table_); 1963*58b9f456SAndroid Build Coastguard Worker } 1964*58b9f456SAndroid Build Coastguard Worker#endif 1965*58b9f456SAndroid Build Coastguard Worker 1966*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1967*58b9f456SAndroid Build Coastguard Worker void swap(unordered_multimap& __u) 1968*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(__is_nothrow_swappable<__table>::value) 1969*58b9f456SAndroid Build Coastguard Worker {__table_.swap(__u.__table_);} 1970*58b9f456SAndroid Build Coastguard Worker 1971*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1972*58b9f456SAndroid Build Coastguard Worker hasher hash_function() const 1973*58b9f456SAndroid Build Coastguard Worker {return __table_.hash_function().hash_function();} 1974*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1975*58b9f456SAndroid Build Coastguard Worker key_equal key_eq() const 1976*58b9f456SAndroid Build Coastguard Worker {return __table_.key_eq().key_eq();} 1977*58b9f456SAndroid Build Coastguard Worker 1978*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1979*58b9f456SAndroid Build Coastguard Worker iterator find(const key_type& __k) {return __table_.find(__k);} 1980*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1981*58b9f456SAndroid Build Coastguard Worker const_iterator find(const key_type& __k) const {return __table_.find(__k);} 1982*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1983*58b9f456SAndroid Build Coastguard Worker size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} 1984*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1985*58b9f456SAndroid Build Coastguard Worker pair<iterator, iterator> equal_range(const key_type& __k) 1986*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_multi(__k);} 1987*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1988*58b9f456SAndroid Build Coastguard Worker pair<const_iterator, const_iterator> equal_range(const key_type& __k) const 1989*58b9f456SAndroid Build Coastguard Worker {return __table_.__equal_range_multi(__k);} 1990*58b9f456SAndroid Build Coastguard Worker 1991*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1992*58b9f456SAndroid Build Coastguard Worker size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} 1993*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1994*58b9f456SAndroid Build Coastguard Worker size_type max_bucket_count() const _NOEXCEPT 1995*58b9f456SAndroid Build Coastguard Worker {return __table_.max_bucket_count();} 1996*58b9f456SAndroid Build Coastguard Worker 1997*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1998*58b9f456SAndroid Build Coastguard Worker size_type bucket_size(size_type __n) const 1999*58b9f456SAndroid Build Coastguard Worker {return __table_.bucket_size(__n);} 2000*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2001*58b9f456SAndroid Build Coastguard Worker size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} 2002*58b9f456SAndroid Build Coastguard Worker 2003*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2004*58b9f456SAndroid Build Coastguard Worker local_iterator begin(size_type __n) {return __table_.begin(__n);} 2005*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2006*58b9f456SAndroid Build Coastguard Worker local_iterator end(size_type __n) {return __table_.end(__n);} 2007*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2008*58b9f456SAndroid Build Coastguard Worker const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} 2009*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2010*58b9f456SAndroid Build Coastguard Worker const_local_iterator end(size_type __n) const {return __table_.cend(__n);} 2011*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2012*58b9f456SAndroid Build Coastguard Worker const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} 2013*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2014*58b9f456SAndroid Build Coastguard Worker const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} 2015*58b9f456SAndroid Build Coastguard Worker 2016*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2017*58b9f456SAndroid Build Coastguard Worker float load_factor() const _NOEXCEPT {return __table_.load_factor();} 2018*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2019*58b9f456SAndroid Build Coastguard Worker float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();} 2020*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2021*58b9f456SAndroid Build Coastguard Worker void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} 2022*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2023*58b9f456SAndroid Build Coastguard Worker void rehash(size_type __n) {__table_.rehash(__n);} 2024*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 2025*58b9f456SAndroid Build Coastguard Worker void reserve(size_type __n) {__table_.reserve(__n);} 2026*58b9f456SAndroid Build Coastguard Worker 2027*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2028*58b9f456SAndroid Build Coastguard Worker 2029*58b9f456SAndroid Build Coastguard Worker bool __dereferenceable(const const_iterator* __i) const 2030*58b9f456SAndroid Build Coastguard Worker {return __table_.__dereferenceable(&__i->__i_);} 2031*58b9f456SAndroid Build Coastguard Worker bool __decrementable(const const_iterator* __i) const 2032*58b9f456SAndroid Build Coastguard Worker {return __table_.__decrementable(&__i->__i_);} 2033*58b9f456SAndroid Build Coastguard Worker bool __addable(const const_iterator* __i, ptrdiff_t __n) const 2034*58b9f456SAndroid Build Coastguard Worker {return __table_.__addable(&__i->__i_, __n);} 2035*58b9f456SAndroid Build Coastguard Worker bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const 2036*58b9f456SAndroid Build Coastguard Worker {return __table_.__addable(&__i->__i_, __n);} 2037*58b9f456SAndroid Build Coastguard Worker 2038*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_DEBUG_LEVEL >= 2 2039*58b9f456SAndroid Build Coastguard Worker 2040*58b9f456SAndroid Build Coastguard Worker 2041*58b9f456SAndroid Build Coastguard Worker}; 2042*58b9f456SAndroid Build Coastguard Worker 2043*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2044*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2045*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql) 2046*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 2047*58b9f456SAndroid Build Coastguard Worker{ 2048*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2049*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2050*58b9f456SAndroid Build Coastguard Worker#endif 2051*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2052*58b9f456SAndroid Build Coastguard Worker} 2053*58b9f456SAndroid Build Coastguard Worker 2054*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2055*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2056*58b9f456SAndroid Build Coastguard Worker size_type __n, const hasher& __hf, const key_equal& __eql, 2057*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 2058*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 2059*58b9f456SAndroid Build Coastguard Worker{ 2060*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2061*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2062*58b9f456SAndroid Build Coastguard Worker#endif 2063*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2064*58b9f456SAndroid Build Coastguard Worker} 2065*58b9f456SAndroid Build Coastguard Worker 2066*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2067*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 2068*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2069*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last) 2070*58b9f456SAndroid Build Coastguard Worker{ 2071*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2072*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2073*58b9f456SAndroid Build Coastguard Worker#endif 2074*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 2075*58b9f456SAndroid Build Coastguard Worker} 2076*58b9f456SAndroid Build Coastguard Worker 2077*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2078*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 2079*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2080*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 2081*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql) 2082*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 2083*58b9f456SAndroid Build Coastguard Worker{ 2084*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2085*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2086*58b9f456SAndroid Build Coastguard Worker#endif 2087*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2088*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 2089*58b9f456SAndroid Build Coastguard Worker} 2090*58b9f456SAndroid Build Coastguard Worker 2091*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2092*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 2093*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2094*58b9f456SAndroid Build Coastguard Worker _InputIterator __first, _InputIterator __last, size_type __n, 2095*58b9f456SAndroid Build Coastguard Worker const hasher& __hf, const key_equal& __eql, const allocator_type& __a) 2096*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 2097*58b9f456SAndroid Build Coastguard Worker{ 2098*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2099*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2100*58b9f456SAndroid Build Coastguard Worker#endif 2101*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2102*58b9f456SAndroid Build Coastguard Worker insert(__first, __last); 2103*58b9f456SAndroid Build Coastguard Worker} 2104*58b9f456SAndroid Build Coastguard Worker 2105*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2106*58b9f456SAndroid Build Coastguard Workerinline 2107*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2108*58b9f456SAndroid Build Coastguard Worker const allocator_type& __a) 2109*58b9f456SAndroid Build Coastguard Worker : __table_(typename __table::allocator_type(__a)) 2110*58b9f456SAndroid Build Coastguard Worker{ 2111*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2112*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2113*58b9f456SAndroid Build Coastguard Worker#endif 2114*58b9f456SAndroid Build Coastguard Worker} 2115*58b9f456SAndroid Build Coastguard Worker 2116*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2117*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2118*58b9f456SAndroid Build Coastguard Worker const unordered_multimap& __u) 2119*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_) 2120*58b9f456SAndroid Build Coastguard Worker{ 2121*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2122*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2123*58b9f456SAndroid Build Coastguard Worker#endif 2124*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 2125*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 2126*58b9f456SAndroid Build Coastguard Worker} 2127*58b9f456SAndroid Build Coastguard Worker 2128*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2129*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2130*58b9f456SAndroid Build Coastguard Worker const unordered_multimap& __u, const allocator_type& __a) 2131*58b9f456SAndroid Build Coastguard Worker : __table_(__u.__table_, typename __table::allocator_type(__a)) 2132*58b9f456SAndroid Build Coastguard Worker{ 2133*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2134*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2135*58b9f456SAndroid Build Coastguard Worker#endif 2136*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__u.bucket_count()); 2137*58b9f456SAndroid Build Coastguard Worker insert(__u.begin(), __u.end()); 2138*58b9f456SAndroid Build Coastguard Worker} 2139*58b9f456SAndroid Build Coastguard Worker 2140*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 2141*58b9f456SAndroid Build Coastguard Worker 2142*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2143*58b9f456SAndroid Build Coastguard Workerinline 2144*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2145*58b9f456SAndroid Build Coastguard Worker unordered_multimap&& __u) 2146*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) 2147*58b9f456SAndroid Build Coastguard Worker : __table_(_VSTD::move(__u.__table_)) 2148*58b9f456SAndroid Build Coastguard Worker{ 2149*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2150*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2151*58b9f456SAndroid Build Coastguard Worker __get_db()->swap(this, &__u); 2152*58b9f456SAndroid Build Coastguard Worker#endif 2153*58b9f456SAndroid Build Coastguard Worker} 2154*58b9f456SAndroid Build Coastguard Worker 2155*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2156*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2157*58b9f456SAndroid Build Coastguard Worker unordered_multimap&& __u, const allocator_type& __a) 2158*58b9f456SAndroid Build Coastguard Worker : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) 2159*58b9f456SAndroid Build Coastguard Worker{ 2160*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2161*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2162*58b9f456SAndroid Build Coastguard Worker#endif 2163*58b9f456SAndroid Build Coastguard Worker if (__a != __u.get_allocator()) 2164*58b9f456SAndroid Build Coastguard Worker { 2165*58b9f456SAndroid Build Coastguard Worker iterator __i = __u.begin(); 2166*58b9f456SAndroid Build Coastguard Worker while (__u.size() != 0) 2167*58b9f456SAndroid Build Coastguard Worker { 2168*58b9f456SAndroid Build Coastguard Worker __table_.__insert_multi( 2169*58b9f456SAndroid Build Coastguard Worker __u.__table_.remove((__i++).__i_)->__value_.__move()); 2170*58b9f456SAndroid Build Coastguard Worker } 2171*58b9f456SAndroid Build Coastguard Worker } 2172*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2173*58b9f456SAndroid Build Coastguard Worker else 2174*58b9f456SAndroid Build Coastguard Worker __get_db()->swap(this, &__u); 2175*58b9f456SAndroid Build Coastguard Worker#endif 2176*58b9f456SAndroid Build Coastguard Worker} 2177*58b9f456SAndroid Build Coastguard Worker 2178*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2179*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2180*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il) 2181*58b9f456SAndroid Build Coastguard Worker{ 2182*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2183*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2184*58b9f456SAndroid Build Coastguard Worker#endif 2185*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 2186*58b9f456SAndroid Build Coastguard Worker} 2187*58b9f456SAndroid Build Coastguard Worker 2188*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2189*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2190*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il, size_type __n, const hasher& __hf, 2191*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql) 2192*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql) 2193*58b9f456SAndroid Build Coastguard Worker{ 2194*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2195*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2196*58b9f456SAndroid Build Coastguard Worker#endif 2197*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2198*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 2199*58b9f456SAndroid Build Coastguard Worker} 2200*58b9f456SAndroid Build Coastguard Worker 2201*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2202*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( 2203*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il, size_type __n, const hasher& __hf, 2204*58b9f456SAndroid Build Coastguard Worker const key_equal& __eql, const allocator_type& __a) 2205*58b9f456SAndroid Build Coastguard Worker : __table_(__hf, __eql, typename __table::allocator_type(__a)) 2206*58b9f456SAndroid Build Coastguard Worker{ 2207*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_DEBUG_LEVEL >= 2 2208*58b9f456SAndroid Build Coastguard Worker __get_db()->__insert_c(this); 2209*58b9f456SAndroid Build Coastguard Worker#endif 2210*58b9f456SAndroid Build Coastguard Worker __table_.rehash(__n); 2211*58b9f456SAndroid Build Coastguard Worker insert(__il.begin(), __il.end()); 2212*58b9f456SAndroid Build Coastguard Worker} 2213*58b9f456SAndroid Build Coastguard Worker 2214*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2215*58b9f456SAndroid Build Coastguard Workerinline 2216*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& 2217*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u) 2218*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(is_nothrow_move_assignable<__table>::value) 2219*58b9f456SAndroid Build Coastguard Worker{ 2220*58b9f456SAndroid Build Coastguard Worker __table_ = _VSTD::move(__u.__table_); 2221*58b9f456SAndroid Build Coastguard Worker return *this; 2222*58b9f456SAndroid Build Coastguard Worker} 2223*58b9f456SAndroid Build Coastguard Worker 2224*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2225*58b9f456SAndroid Build Coastguard Workerinline 2226*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& 2227*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( 2228*58b9f456SAndroid Build Coastguard Worker initializer_list<value_type> __il) 2229*58b9f456SAndroid Build Coastguard Worker{ 2230*58b9f456SAndroid Build Coastguard Worker __table_.__assign_multi(__il.begin(), __il.end()); 2231*58b9f456SAndroid Build Coastguard Worker return *this; 2232*58b9f456SAndroid Build Coastguard Worker} 2233*58b9f456SAndroid Build Coastguard Worker 2234*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 2235*58b9f456SAndroid Build Coastguard Worker 2236*58b9f456SAndroid Build Coastguard Worker 2237*58b9f456SAndroid Build Coastguard Worker 2238*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2239*58b9f456SAndroid Build Coastguard Workertemplate <class _InputIterator> 2240*58b9f456SAndroid Build Coastguard Workerinline 2241*58b9f456SAndroid Build Coastguard Workervoid 2242*58b9f456SAndroid Build Coastguard Workerunordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, 2243*58b9f456SAndroid Build Coastguard Worker _InputIterator __last) 2244*58b9f456SAndroid Build Coastguard Worker{ 2245*58b9f456SAndroid Build Coastguard Worker for (; __first != __last; ++__first) 2246*58b9f456SAndroid Build Coastguard Worker __table_.__insert_multi(*__first); 2247*58b9f456SAndroid Build Coastguard Worker} 2248*58b9f456SAndroid Build Coastguard Worker 2249*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2250*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 2251*58b9f456SAndroid Build Coastguard Workervoid 2252*58b9f456SAndroid Build Coastguard Workerswap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 2253*58b9f456SAndroid Build Coastguard Worker unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 2254*58b9f456SAndroid Build Coastguard Worker _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 2255*58b9f456SAndroid Build Coastguard Worker{ 2256*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 2257*58b9f456SAndroid Build Coastguard Worker} 2258*58b9f456SAndroid Build Coastguard Worker 2259*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17 2260*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate> 2261*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 2262*58b9f456SAndroid Build Coastguard Workervoid erase_if(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __c, _Predicate __pred) 2263*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); } 2264*58b9f456SAndroid Build Coastguard Worker#endif 2265*58b9f456SAndroid Build Coastguard Worker 2266*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2267*58b9f456SAndroid Build Coastguard Workerbool 2268*58b9f456SAndroid Build Coastguard Workeroperator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 2269*58b9f456SAndroid Build Coastguard Worker const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 2270*58b9f456SAndroid Build Coastguard Worker{ 2271*58b9f456SAndroid Build Coastguard Worker if (__x.size() != __y.size()) 2272*58b9f456SAndroid Build Coastguard Worker return false; 2273*58b9f456SAndroid Build Coastguard Worker typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator 2274*58b9f456SAndroid Build Coastguard Worker const_iterator; 2275*58b9f456SAndroid Build Coastguard Worker typedef pair<const_iterator, const_iterator> _EqRng; 2276*58b9f456SAndroid Build Coastguard Worker for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) 2277*58b9f456SAndroid Build Coastguard Worker { 2278*58b9f456SAndroid Build Coastguard Worker _EqRng __xeq = __x.equal_range(__i->first); 2279*58b9f456SAndroid Build Coastguard Worker _EqRng __yeq = __y.equal_range(__i->first); 2280*58b9f456SAndroid Build Coastguard Worker if (_VSTD::distance(__xeq.first, __xeq.second) != 2281*58b9f456SAndroid Build Coastguard Worker _VSTD::distance(__yeq.first, __yeq.second) || 2282*58b9f456SAndroid Build Coastguard Worker !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) 2283*58b9f456SAndroid Build Coastguard Worker return false; 2284*58b9f456SAndroid Build Coastguard Worker __i = __xeq.second; 2285*58b9f456SAndroid Build Coastguard Worker } 2286*58b9f456SAndroid Build Coastguard Worker return true; 2287*58b9f456SAndroid Build Coastguard Worker} 2288*58b9f456SAndroid Build Coastguard Worker 2289*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> 2290*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 2291*58b9f456SAndroid Build Coastguard Workerbool 2292*58b9f456SAndroid Build Coastguard Workeroperator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, 2293*58b9f456SAndroid Build Coastguard Worker const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) 2294*58b9f456SAndroid Build Coastguard Worker{ 2295*58b9f456SAndroid Build Coastguard Worker return !(__x == __y); 2296*58b9f456SAndroid Build Coastguard Worker} 2297*58b9f456SAndroid Build Coastguard Worker 2298*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD 2299*58b9f456SAndroid Build Coastguard Worker 2300*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_UNORDERED_MAP 2301