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