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