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