Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===-------------------------- hash_map ----------------------------------===// |
| 3 | // |
Howard Hinnant | 5b08a8a | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | 412dbeb | 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 | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_HASH_MAP |
| 12 | #define _LIBCPP_HASH_MAP |
| 13 | |
| 14 | /* |
| 15 | |
| 16 | hash_map synopsis |
| 17 | |
| 18 | namespace __gnu_cxx |
| 19 | { |
| 20 | |
| 21 | template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, |
| 22 | class Alloc = allocator<pair<const Key, T>>> |
| 23 | class hash_map |
| 24 | { |
| 25 | public: |
| 26 | // types |
| 27 | typedef Key key_type; |
| 28 | typedef T mapped_type; |
| 29 | typedef Hash hasher; |
| 30 | typedef Pred key_equal; |
| 31 | typedef Alloc allocator_type; |
| 32 | typedef pair<const key_type, mapped_type> value_type; |
| 33 | typedef value_type& reference; |
| 34 | typedef const value_type& const_reference; |
| 35 | typedef typename allocator_traits<allocator_type>::pointer pointer; |
| 36 | typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; |
| 37 | typedef typename allocator_traits<allocator_type>::size_type size_type; |
| 38 | typedef typename allocator_traits<allocator_type>::difference_type difference_type; |
| 39 | |
| 40 | typedef /unspecified/ iterator; |
| 41 | typedef /unspecified/ const_iterator; |
| 42 | |
| 43 | explicit hash_map(size_type n = 193, const hasher& hf = hasher(), |
| 44 | const key_equal& eql = key_equal(), |
| 45 | const allocator_type& a = allocator_type()); |
| 46 | template <class InputIterator> |
| 47 | hash_map(InputIterator f, InputIterator l, |
| 48 | size_type n = 193, const hasher& hf = hasher(), |
| 49 | const key_equal& eql = key_equal(), |
| 50 | const allocator_type& a = allocator_type()); |
| 51 | hash_map(const hash_map&); |
| 52 | ~hash_map(); |
| 53 | hash_map& operator=(const hash_map&); |
| 54 | |
| 55 | allocator_type get_allocator() const; |
| 56 | |
| 57 | bool empty() const; |
| 58 | size_type size() const; |
| 59 | size_type max_size() const; |
| 60 | |
| 61 | iterator begin(); |
| 62 | iterator end(); |
| 63 | const_iterator begin() const; |
| 64 | const_iterator end() const; |
| 65 | |
| 66 | pair<iterator, bool> insert(const value_type& obj); |
| 67 | template <class InputIterator> |
| 68 | void insert(InputIterator first, InputIterator last); |
| 69 | |
| 70 | void erase(const_iterator position); |
| 71 | size_type erase(const key_type& k); |
| 72 | void erase(const_iterator first, const_iterator last); |
| 73 | void clear(); |
| 74 | |
| 75 | void swap(hash_map&); |
| 76 | |
| 77 | hasher hash_funct() const; |
| 78 | key_equal key_eq() const; |
| 79 | |
| 80 | iterator find(const key_type& k); |
| 81 | const_iterator find(const key_type& k) const; |
| 82 | size_type count(const key_type& k) const; |
| 83 | pair<iterator, iterator> equal_range(const key_type& k); |
| 84 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 85 | |
| 86 | mapped_type& operator[](const key_type& k); |
| 87 | |
| 88 | size_type bucket_count() const; |
| 89 | size_type max_bucket_count() const; |
| 90 | |
| 91 | size_type elems_in_bucket(size_type n) const; |
| 92 | |
| 93 | void resize(size_type n); |
| 94 | }; |
| 95 | |
| 96 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 97 | void swap(hash_map<Key, T, Hash, Pred, Alloc>& x, |
| 98 | hash_map<Key, T, Hash, Pred, Alloc>& y); |
| 99 | |
| 100 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 101 | bool |
| 102 | operator==(const hash_map<Key, T, Hash, Pred, Alloc>& x, |
| 103 | const hash_map<Key, T, Hash, Pred, Alloc>& y); |
| 104 | |
| 105 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 106 | bool |
| 107 | operator!=(const hash_map<Key, T, Hash, Pred, Alloc>& x, |
| 108 | const hash_map<Key, T, Hash, Pred, Alloc>& y); |
| 109 | |
| 110 | template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, |
| 111 | class Alloc = allocator<pair<const Key, T>>> |
| 112 | class hash_multimap |
| 113 | { |
| 114 | public: |
| 115 | // types |
| 116 | typedef Key key_type; |
| 117 | typedef T mapped_type; |
| 118 | typedef Hash hasher; |
| 119 | typedef Pred key_equal; |
| 120 | typedef Alloc allocator_type; |
| 121 | typedef pair<const key_type, mapped_type> value_type; |
| 122 | typedef value_type& reference; |
| 123 | typedef const value_type& const_reference; |
| 124 | typedef typename allocator_traits<allocator_type>::pointer pointer; |
| 125 | typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; |
| 126 | typedef typename allocator_traits<allocator_type>::size_type size_type; |
| 127 | typedef typename allocator_traits<allocator_type>::difference_type difference_type; |
| 128 | |
| 129 | typedef /unspecified/ iterator; |
| 130 | typedef /unspecified/ const_iterator; |
| 131 | |
| 132 | explicit hash_multimap(size_type n = 193, const hasher& hf = hasher(), |
| 133 | const key_equal& eql = key_equal(), |
| 134 | const allocator_type& a = allocator_type()); |
| 135 | template <class InputIterator> |
| 136 | hash_multimap(InputIterator f, InputIterator l, |
| 137 | size_type n = 193, const hasher& hf = hasher(), |
| 138 | const key_equal& eql = key_equal(), |
| 139 | const allocator_type& a = allocator_type()); |
| 140 | explicit hash_multimap(const allocator_type&); |
| 141 | hash_multimap(const hash_multimap&); |
| 142 | ~hash_multimap(); |
| 143 | hash_multimap& operator=(const hash_multimap&); |
| 144 | |
| 145 | allocator_type get_allocator() const; |
| 146 | |
| 147 | bool empty() const; |
| 148 | size_type size() const; |
| 149 | size_type max_size() const; |
| 150 | |
| 151 | iterator begin(); |
| 152 | iterator end(); |
| 153 | const_iterator begin() const; |
| 154 | const_iterator end() const; |
| 155 | |
| 156 | iterator insert(const value_type& obj); |
| 157 | template <class InputIterator> |
| 158 | void insert(InputIterator first, InputIterator last); |
| 159 | |
| 160 | void erase(const_iterator position); |
| 161 | size_type erase(const key_type& k); |
| 162 | void erase(const_iterator first, const_iterator last); |
| 163 | void clear(); |
| 164 | |
| 165 | void swap(hash_multimap&); |
| 166 | |
| 167 | hasher hash_funct() const; |
| 168 | key_equal key_eq() const; |
| 169 | |
| 170 | iterator find(const key_type& k); |
| 171 | const_iterator find(const key_type& k) const; |
| 172 | size_type count(const key_type& k) const; |
| 173 | pair<iterator, iterator> equal_range(const key_type& k); |
| 174 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 175 | |
| 176 | size_type bucket_count() const; |
| 177 | size_type max_bucket_count() const; |
| 178 | |
| 179 | size_type elems_in_bucket(size_type n) const; |
| 180 | |
| 181 | void resize(size_type n); |
| 182 | }; |
| 183 | |
| 184 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 185 | void swap(hash_multimap<Key, T, Hash, Pred, Alloc>& x, |
| 186 | hash_multimap<Key, T, Hash, Pred, Alloc>& y); |
| 187 | |
| 188 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 189 | bool |
| 190 | operator==(const hash_multimap<Key, T, Hash, Pred, Alloc>& x, |
| 191 | const hash_multimap<Key, T, Hash, Pred, Alloc>& y); |
| 192 | |
| 193 | template <class Key, class T, class Hash, class Pred, class Alloc> |
| 194 | bool |
| 195 | operator!=(const hash_multimap<Key, T, Hash, Pred, Alloc>& x, |
| 196 | const hash_multimap<Key, T, Hash, Pred, Alloc>& y); |
| 197 | |
| 198 | } // __gnu_cxx |
| 199 | |
| 200 | */ |
| 201 | |
| 202 | #include <__config> |
| 203 | #include <__hash_table> |
| 204 | #include <functional> |
| 205 | #include <stdexcept> |
| 206 | |
Howard Hinnant | 1dba445 | 2011-07-24 23:59:50 +0000 | [diff] [blame^] | 207 | #if __DEPRECATED |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 208 | #warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map> |
Howard Hinnant | 1dba445 | 2011-07-24 23:59:50 +0000 | [diff] [blame^] | 209 | #endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 210 | |
| 211 | #pragma GCC system_header |
| 212 | |
| 213 | namespace __gnu_cxx { |
| 214 | |
| 215 | using namespace std; |
| 216 | |
| 217 | template <class _Tp, class _Hash, bool = is_empty<_Hash>::value> |
| 218 | class __hash_map_hasher |
| 219 | : private _Hash |
| 220 | { |
| 221 | public: |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 222 | _LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {} |
| 223 | _LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {} |
| 224 | _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;} |
| 225 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 226 | size_t operator()(const _Tp& __x) const |
| 227 | {return static_cast<const _Hash&>(*this)(__x.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 228 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 229 | size_t operator()(const typename _Tp::first_type& __x) const |
| 230 | {return static_cast<const _Hash&>(*this)(__x);} |
| 231 | }; |
| 232 | |
| 233 | template <class _Tp, class _Hash> |
| 234 | class __hash_map_hasher<_Tp, _Hash, false> |
| 235 | { |
| 236 | _Hash __hash_; |
| 237 | public: |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 238 | _LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {} |
| 239 | _LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {} |
| 240 | _LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;} |
| 241 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 242 | size_t operator()(const _Tp& __x) const |
| 243 | {return __hash_(__x.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 244 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 245 | size_t operator()(const typename _Tp::first_type& __x) const |
| 246 | {return __hash_(__x);} |
| 247 | }; |
| 248 | |
| 249 | template <class _Tp, class _Pred, bool = is_empty<_Pred>::value> |
| 250 | class __hash_map_equal |
| 251 | : private _Pred |
| 252 | { |
| 253 | public: |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 254 | _LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {} |
| 255 | _LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {} |
| 256 | _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;} |
| 257 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 258 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 259 | {return static_cast<const _Pred&>(*this)(__x.first, __y.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 260 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 261 | bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const |
| 262 | {return static_cast<const _Pred&>(*this)(__x, __y.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 263 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 264 | bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const |
| 265 | {return static_cast<const _Pred&>(*this)(__x.first, __y);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 266 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 267 | bool operator()(const typename _Tp::first_type& __x, |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 268 | const typename _Tp::first_type& __y) const |
| 269 | {return static_cast<const _Pred&>(*this)(__x, __y);} |
| 270 | }; |
| 271 | |
| 272 | template <class _Tp, class _Pred> |
| 273 | class __hash_map_equal<_Tp, _Pred, false> |
| 274 | { |
| 275 | _Pred __pred_; |
| 276 | public: |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 277 | _LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {} |
| 278 | _LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {} |
| 279 | _LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;} |
| 280 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 281 | bool operator()(const _Tp& __x, const _Tp& __y) const |
| 282 | {return __pred_(__x.first, __y.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 283 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 284 | bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const |
| 285 | {return __pred_(__x, __y.first);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 286 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 287 | bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const |
| 288 | {return __pred_(__x.first, __y);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 289 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 290 | bool operator()(const typename _Tp::first_type& __x, |
| 291 | const typename _Tp::first_type& __y) const |
| 292 | {return __pred_(__x, __y);} |
| 293 | }; |
| 294 | |
| 295 | template <class _Alloc> |
| 296 | class __hash_map_node_destructor |
| 297 | { |
| 298 | typedef _Alloc allocator_type; |
| 299 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 300 | typedef typename __alloc_traits::value_type::value_type value_type; |
| 301 | public: |
| 302 | typedef typename __alloc_traits::pointer pointer; |
| 303 | private: |
| 304 | typedef typename value_type::first_type first_type; |
| 305 | typedef typename value_type::second_type second_type; |
| 306 | |
| 307 | allocator_type& __na_; |
| 308 | |
| 309 | __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); |
| 310 | |
| 311 | public: |
| 312 | bool __first_constructed; |
| 313 | bool __second_constructed; |
| 314 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 315 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 316 | explicit __hash_map_node_destructor(allocator_type& __na) |
| 317 | : __na_(__na), |
| 318 | __first_constructed(false), |
| 319 | __second_constructed(false) |
| 320 | {} |
| 321 | |
Howard Hinnant | 7609c9b | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 322 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 323 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 324 | __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) |
| 325 | : __na_(__x.__na_), |
| 326 | __first_constructed(__x.__value_constructed), |
| 327 | __second_constructed(__x.__value_constructed) |
| 328 | { |
| 329 | __x.__value_constructed = false; |
| 330 | } |
Howard Hinnant | 7609c9b | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 331 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 332 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 333 | __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x) |
| 334 | : __na_(__x.__na_), |
| 335 | __first_constructed(__x.__value_constructed), |
| 336 | __second_constructed(__x.__value_constructed) |
| 337 | { |
| 338 | const_cast<bool&>(__x.__value_constructed) = false; |
| 339 | } |
Howard Hinnant | 7609c9b | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 340 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 341 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 342 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 343 | void operator()(pointer __p) |
| 344 | { |
| 345 | if (__second_constructed) |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 346 | __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second)); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 347 | if (__first_constructed) |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 348 | __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first)); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 349 | if (__p) |
| 350 | __alloc_traits::deallocate(__na_, __p, 1); |
| 351 | } |
| 352 | }; |
| 353 | |
| 354 | template <class _HashIterator> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 355 | class _LIBCPP_VISIBLE __hash_map_iterator |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 356 | { |
| 357 | _HashIterator __i_; |
| 358 | |
| 359 | typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits; |
| 360 | typedef const typename _HashIterator::value_type::first_type key_type; |
| 361 | typedef typename _HashIterator::value_type::second_type mapped_type; |
| 362 | public: |
| 363 | typedef forward_iterator_tag iterator_category; |
| 364 | typedef pair<key_type, mapped_type> value_type; |
| 365 | typedef typename _HashIterator::difference_type difference_type; |
| 366 | typedef value_type& reference; |
| 367 | typedef typename __pointer_traits::template |
| 368 | #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 369 | rebind<value_type> |
| 370 | #else |
| 371 | rebind<value_type>::other |
| 372 | #endif |
| 373 | pointer; |
| 374 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 375 | _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {} |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 376 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 377 | _LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {} |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 378 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 379 | _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();} |
| 380 | _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();} |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 381 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 382 | _LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;} |
| 383 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 384 | __hash_map_iterator operator++(int) |
| 385 | { |
| 386 | __hash_map_iterator __t(*this); |
| 387 | ++(*this); |
| 388 | return __t; |
| 389 | } |
| 390 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 391 | friend _LIBCPP_INLINE_VISIBILITY |
| 392 | bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 393 | {return __x.__i_ == __y.__i_;} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 394 | friend _LIBCPP_INLINE_VISIBILITY |
| 395 | bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 396 | {return __x.__i_ != __y.__i_;} |
| 397 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 398 | template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map; |
| 399 | template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap; |
| 400 | template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator; |
| 401 | template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator; |
| 402 | template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | template <class _HashIterator> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 406 | class _LIBCPP_VISIBLE __hash_map_const_iterator |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 407 | { |
| 408 | _HashIterator __i_; |
| 409 | |
| 410 | typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits; |
| 411 | typedef const typename _HashIterator::value_type::first_type key_type; |
| 412 | typedef typename _HashIterator::value_type::second_type mapped_type; |
| 413 | public: |
| 414 | typedef forward_iterator_tag iterator_category; |
| 415 | typedef pair<key_type, mapped_type> value_type; |
| 416 | typedef typename _HashIterator::difference_type difference_type; |
| 417 | typedef const value_type& reference; |
| 418 | typedef typename __pointer_traits::template |
| 419 | #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 420 | rebind<value_type> |
| 421 | #else |
| 422 | rebind<value_type>::other |
| 423 | #endif |
| 424 | pointer; |
| 425 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 426 | _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {} |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 427 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 428 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 429 | __hash_map_const_iterator(_HashIterator __i) : __i_(__i) {} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 430 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 431 | __hash_map_const_iterator( |
| 432 | __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) |
| 433 | : __i_(__i.__i_) {} |
| 434 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 435 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 436 | reference operator*() const {return *operator->();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 437 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 438 | pointer operator->() const {return (pointer)__i_.operator->();} |
| 439 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 440 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 441 | __hash_map_const_iterator& operator++() {++__i_; return *this;} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 442 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 443 | __hash_map_const_iterator operator++(int) |
| 444 | { |
| 445 | __hash_map_const_iterator __t(*this); |
| 446 | ++(*this); |
| 447 | return __t; |
| 448 | } |
| 449 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 450 | friend _LIBCPP_INLINE_VISIBILITY |
| 451 | bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 452 | {return __x.__i_ == __y.__i_;} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 453 | friend _LIBCPP_INLINE_VISIBILITY |
| 454 | bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 455 | {return __x.__i_ != __y.__i_;} |
| 456 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 457 | template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map; |
| 458 | template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap; |
| 459 | template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator; |
| 460 | template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 461 | }; |
| 462 | |
| 463 | template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, |
| 464 | class _Alloc = allocator<pair<const _Key, _Tp> > > |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 465 | class _LIBCPP_VISIBLE hash_map |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 466 | { |
| 467 | public: |
| 468 | // types |
| 469 | typedef _Key key_type; |
| 470 | typedef _Tp mapped_type; |
| 471 | typedef _Hash hasher; |
| 472 | typedef _Pred key_equal; |
| 473 | typedef _Alloc allocator_type; |
| 474 | typedef pair<const key_type, mapped_type> value_type; |
| 475 | typedef value_type& reference; |
| 476 | typedef const value_type& const_reference; |
| 477 | |
| 478 | private: |
| 479 | typedef pair<key_type, mapped_type> __value_type; |
| 480 | typedef __hash_map_hasher<__value_type, hasher> __hasher; |
| 481 | typedef __hash_map_equal<__value_type, key_equal> __key_equal; |
| 482 | typedef typename allocator_traits<allocator_type>::template |
| 483 | #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 484 | rebind_alloc<__value_type> |
| 485 | #else |
| 486 | rebind_alloc<__value_type>::other |
| 487 | #endif |
| 488 | __allocator_type; |
| 489 | |
| 490 | typedef __hash_table<__value_type, __hasher, |
| 491 | __key_equal, __allocator_type> __table; |
| 492 | |
| 493 | __table __table_; |
| 494 | |
| 495 | typedef typename __table::__node_pointer __node_pointer; |
| 496 | typedef typename __table::__node_const_pointer __node_const_pointer; |
| 497 | typedef typename __table::__node_traits __node_traits; |
| 498 | typedef typename __table::__node_allocator __node_allocator; |
| 499 | typedef typename __table::__node __node; |
| 500 | typedef __hash_map_node_destructor<__node_allocator> _D; |
| 501 | typedef unique_ptr<__node, _D> __node_holder; |
| 502 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 503 | public: |
| 504 | typedef typename __alloc_traits::pointer pointer; |
| 505 | typedef typename __alloc_traits::const_pointer const_pointer; |
| 506 | typedef typename __alloc_traits::size_type size_type; |
| 507 | typedef typename __alloc_traits::difference_type difference_type; |
| 508 | |
| 509 | typedef __hash_map_iterator<typename __table::iterator> iterator; |
| 510 | typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; |
| 511 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 512 | _LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);} |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 513 | explicit hash_map(size_type __n, const hasher& __hf = hasher(), |
| 514 | const key_equal& __eql = key_equal()); |
| 515 | hash_map(size_type __n, const hasher& __hf, |
| 516 | const key_equal& __eql, |
| 517 | const allocator_type& __a); |
| 518 | template <class _InputIterator> |
| 519 | hash_map(_InputIterator __first, _InputIterator __last); |
| 520 | template <class _InputIterator> |
| 521 | hash_map(_InputIterator __first, _InputIterator __last, |
| 522 | size_type __n, const hasher& __hf = hasher(), |
| 523 | const key_equal& __eql = key_equal()); |
| 524 | template <class _InputIterator> |
| 525 | hash_map(_InputIterator __first, _InputIterator __last, |
| 526 | size_type __n, const hasher& __hf, |
| 527 | const key_equal& __eql, |
| 528 | const allocator_type& __a); |
| 529 | hash_map(const hash_map& __u); |
| 530 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 531 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 532 | allocator_type get_allocator() const |
| 533 | {return allocator_type(__table_.__node_alloc());} |
| 534 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 535 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 536 | bool empty() const {return __table_.size() == 0;} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 537 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 538 | size_type size() const {return __table_.size();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 539 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 540 | size_type max_size() const {return __table_.max_size();} |
| 541 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 542 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 543 | iterator begin() {return __table_.begin();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 544 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 545 | iterator end() {return __table_.end();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 546 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 547 | const_iterator begin() const {return __table_.begin();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 548 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 549 | const_iterator end() const {return __table_.end();} |
| 550 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 551 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 552 | pair<iterator, bool> insert(const value_type& __x) |
| 553 | {return __table_.__insert_unique(__x);} |
| 554 | template <class _InputIterator> |
| 555 | void insert(_InputIterator __first, _InputIterator __last); |
| 556 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 557 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 558 | void erase(const_iterator __p) {__table_.erase(__p.__i_);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 559 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 560 | size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 561 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 562 | void erase(const_iterator __first, const_iterator __last) |
| 563 | {__table_.erase(__first.__i_, __last.__i_);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 564 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 565 | void clear() {__table_.clear();} |
| 566 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 567 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 568 | void swap(hash_map& __u) {__table_.swap(__u.__table_);} |
| 569 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 570 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 571 | hasher hash_funct() const |
| 572 | {return __table_.hash_function().hash_function();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 573 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 574 | key_equal key_eq() const |
| 575 | {return __table_.key_eq().key_eq();} |
| 576 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 577 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 578 | iterator find(const key_type& __k) {return __table_.find(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 579 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 580 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 581 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 582 | size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 583 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 584 | pair<iterator, iterator> equal_range(const key_type& __k) |
| 585 | {return __table_.__equal_range_unique(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 586 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 587 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 588 | {return __table_.__equal_range_unique(__k);} |
| 589 | |
| 590 | mapped_type& operator[](const key_type& __k); |
| 591 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 592 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 593 | size_type bucket_count() const {return __table_.bucket_count();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 594 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 595 | size_type max_bucket_count() const {return __table_.max_bucket_count();} |
| 596 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 597 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 598 | size_type elems_in_bucket(size_type __n) const |
| 599 | {return __table_.bucket_size(__n);} |
| 600 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 601 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 602 | void resize(size_type __n) {__table_.rehash(__n);} |
| 603 | |
| 604 | private: |
| 605 | __node_holder __construct_node(const key_type& __k); |
| 606 | }; |
| 607 | |
| 608 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 609 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 610 | size_type __n, const hasher& __hf, const key_equal& __eql) |
| 611 | : __table_(__hf, __eql) |
| 612 | { |
| 613 | __table_.rehash(__n); |
| 614 | } |
| 615 | |
| 616 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 617 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 618 | size_type __n, const hasher& __hf, const key_equal& __eql, |
| 619 | const allocator_type& __a) |
| 620 | : __table_(__hf, __eql, __a) |
| 621 | { |
| 622 | __table_.rehash(__n); |
| 623 | } |
| 624 | |
| 625 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 626 | template <class _InputIterator> |
| 627 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 628 | _InputIterator __first, _InputIterator __last) |
| 629 | { |
| 630 | __table_.rehash(193); |
| 631 | insert(__first, __last); |
| 632 | } |
| 633 | |
| 634 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 635 | template <class _InputIterator> |
| 636 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 637 | _InputIterator __first, _InputIterator __last, size_type __n, |
| 638 | const hasher& __hf, const key_equal& __eql) |
| 639 | : __table_(__hf, __eql) |
| 640 | { |
| 641 | __table_.rehash(__n); |
| 642 | insert(__first, __last); |
| 643 | } |
| 644 | |
| 645 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 646 | template <class _InputIterator> |
| 647 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 648 | _InputIterator __first, _InputIterator __last, size_type __n, |
| 649 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 650 | : __table_(__hf, __eql, __a) |
| 651 | { |
| 652 | __table_.rehash(__n); |
| 653 | insert(__first, __last); |
| 654 | } |
| 655 | |
| 656 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 657 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 658 | const hash_map& __u) |
| 659 | : __table_(__u.__table_) |
| 660 | { |
| 661 | __table_.rehash(__u.bucket_count()); |
| 662 | insert(__u.begin(), __u.end()); |
| 663 | } |
| 664 | |
| 665 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 666 | typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder |
| 667 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) |
| 668 | { |
| 669 | __node_allocator& __na = __table_.__node_alloc(); |
| 670 | __node_holder __h(__node_traits::allocate(__na, 1), _D(__na)); |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 671 | __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 672 | __h.get_deleter().__first_constructed = true; |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 673 | __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 674 | __h.get_deleter().__second_constructed = true; |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 675 | return _VSTD::move(__h); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 679 | template <class _InputIterator> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 680 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 681 | void |
| 682 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, |
| 683 | _InputIterator __last) |
| 684 | { |
| 685 | for (; __first != __last; ++__first) |
| 686 | __table_.__insert_unique(*__first); |
| 687 | } |
| 688 | |
| 689 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 690 | _Tp& |
| 691 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) |
| 692 | { |
| 693 | iterator __i = find(__k); |
| 694 | if (__i != end()) |
| 695 | return __i->second; |
| 696 | __node_holder __h = __construct_node(__k); |
| 697 | pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get()); |
| 698 | __h.release(); |
| 699 | return __r.first->second; |
| 700 | } |
| 701 | |
| 702 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 703 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 704 | void |
| 705 | swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 706 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 707 | { |
| 708 | __x.swap(__y); |
| 709 | } |
| 710 | |
| 711 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 712 | bool |
| 713 | operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 714 | const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 715 | { |
| 716 | if (__x.size() != __y.size()) |
| 717 | return false; |
| 718 | typedef typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator |
| 719 | const_iterator; |
| 720 | for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); |
| 721 | __i != __ex; ++__i) |
| 722 | { |
| 723 | const_iterator __j = __y.find(__i->first); |
| 724 | if (__j == __ey || !(*__i == *__j)) |
| 725 | return false; |
| 726 | } |
| 727 | return true; |
| 728 | } |
| 729 | |
| 730 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 731 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 732 | bool |
| 733 | operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 734 | const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 735 | { |
| 736 | return !(__x == __y); |
| 737 | } |
| 738 | |
| 739 | template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, |
| 740 | class _Alloc = allocator<pair<const _Key, _Tp> > > |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 741 | class _LIBCPP_VISIBLE hash_multimap |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 742 | { |
| 743 | public: |
| 744 | // types |
| 745 | typedef _Key key_type; |
| 746 | typedef _Tp mapped_type; |
| 747 | typedef _Hash hasher; |
| 748 | typedef _Pred key_equal; |
| 749 | typedef _Alloc allocator_type; |
| 750 | typedef pair<const key_type, mapped_type> value_type; |
| 751 | typedef value_type& reference; |
| 752 | typedef const value_type& const_reference; |
| 753 | |
| 754 | private: |
| 755 | typedef pair<key_type, mapped_type> __value_type; |
| 756 | typedef __hash_map_hasher<__value_type, hasher> __hasher; |
| 757 | typedef __hash_map_equal<__value_type, key_equal> __key_equal; |
| 758 | typedef typename allocator_traits<allocator_type>::template |
| 759 | #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 760 | rebind_alloc<__value_type> |
| 761 | #else |
| 762 | rebind_alloc<__value_type>::other |
| 763 | #endif |
| 764 | __allocator_type; |
| 765 | |
| 766 | typedef __hash_table<__value_type, __hasher, |
| 767 | __key_equal, __allocator_type> __table; |
| 768 | |
| 769 | __table __table_; |
| 770 | |
| 771 | typedef typename __table::__node_traits __node_traits; |
| 772 | typedef typename __table::__node_allocator __node_allocator; |
| 773 | typedef typename __table::__node __node; |
| 774 | typedef __hash_map_node_destructor<__node_allocator> _D; |
| 775 | typedef unique_ptr<__node, _D> __node_holder; |
| 776 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 777 | public: |
| 778 | typedef typename __alloc_traits::pointer pointer; |
| 779 | typedef typename __alloc_traits::const_pointer const_pointer; |
| 780 | typedef typename __alloc_traits::size_type size_type; |
| 781 | typedef typename __alloc_traits::difference_type difference_type; |
| 782 | |
| 783 | typedef __hash_map_iterator<typename __table::iterator> iterator; |
| 784 | typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; |
| 785 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 786 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 787 | hash_multimap() {__table_.rehash(193);} |
| 788 | explicit hash_multimap(size_type __n, const hasher& __hf = hasher(), |
| 789 | const key_equal& __eql = key_equal()); |
| 790 | hash_multimap(size_type __n, const hasher& __hf, |
| 791 | const key_equal& __eql, |
| 792 | const allocator_type& __a); |
| 793 | template <class _InputIterator> |
| 794 | hash_multimap(_InputIterator __first, _InputIterator __last); |
| 795 | template <class _InputIterator> |
| 796 | hash_multimap(_InputIterator __first, _InputIterator __last, |
| 797 | size_type __n, const hasher& __hf = hasher(), |
| 798 | const key_equal& __eql = key_equal()); |
| 799 | template <class _InputIterator> |
| 800 | hash_multimap(_InputIterator __first, _InputIterator __last, |
| 801 | size_type __n, const hasher& __hf, |
| 802 | const key_equal& __eql, |
| 803 | const allocator_type& __a); |
| 804 | hash_multimap(const hash_multimap& __u); |
| 805 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 806 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 807 | allocator_type get_allocator() const |
| 808 | {return allocator_type(__table_.__node_alloc());} |
| 809 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 810 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 811 | bool empty() const {return __table_.size() == 0;} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 812 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 813 | size_type size() const {return __table_.size();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 814 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 815 | size_type max_size() const {return __table_.max_size();} |
| 816 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 817 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 818 | iterator begin() {return __table_.begin();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 819 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 820 | iterator end() {return __table_.end();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 821 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 822 | const_iterator begin() const {return __table_.begin();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 823 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 824 | const_iterator end() const {return __table_.end();} |
| 825 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 826 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 827 | iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} |
| 828 | template <class _InputIterator> |
| 829 | void insert(_InputIterator __first, _InputIterator __last); |
| 830 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 831 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 832 | void erase(const_iterator __p) {__table_.erase(__p.__i_);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 833 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 834 | size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 835 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 836 | void erase(const_iterator __first, const_iterator __last) |
| 837 | {__table_.erase(__first.__i_, __last.__i_);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 838 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 839 | void clear() {__table_.clear();} |
| 840 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 841 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 842 | void swap(hash_multimap& __u) {__table_.swap(__u.__table_);} |
| 843 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 844 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 845 | hasher hash_funct() const |
| 846 | {return __table_.hash_function().hash_function();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 847 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 848 | key_equal key_eq() const |
| 849 | {return __table_.key_eq().key_eq();} |
| 850 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 851 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 852 | iterator find(const key_type& __k) {return __table_.find(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 853 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 854 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 855 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 856 | size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 857 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 858 | pair<iterator, iterator> equal_range(const key_type& __k) |
| 859 | {return __table_.__equal_range_multi(__k);} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 860 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 861 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 862 | {return __table_.__equal_range_multi(__k);} |
| 863 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 864 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 865 | size_type bucket_count() const {return __table_.bucket_count();} |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 866 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 867 | size_type max_bucket_count() const {return __table_.max_bucket_count();} |
| 868 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 869 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 870 | size_type elems_in_bucket(size_type __n) const |
| 871 | {return __table_.bucket_size(__n);} |
| 872 | |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 873 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 874 | void resize(size_type __n) {__table_.rehash(__n);} |
| 875 | }; |
| 876 | |
| 877 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 878 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 879 | size_type __n, const hasher& __hf, const key_equal& __eql) |
| 880 | : __table_(__hf, __eql) |
| 881 | { |
| 882 | __table_.rehash(__n); |
| 883 | } |
| 884 | |
| 885 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 886 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 887 | size_type __n, const hasher& __hf, const key_equal& __eql, |
| 888 | const allocator_type& __a) |
| 889 | : __table_(__hf, __eql, __a) |
| 890 | { |
| 891 | __table_.rehash(__n); |
| 892 | } |
| 893 | |
| 894 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 895 | template <class _InputIterator> |
| 896 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 897 | _InputIterator __first, _InputIterator __last) |
| 898 | { |
| 899 | __table_.rehash(193); |
| 900 | insert(__first, __last); |
| 901 | } |
| 902 | |
| 903 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 904 | template <class _InputIterator> |
| 905 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 906 | _InputIterator __first, _InputIterator __last, size_type __n, |
| 907 | const hasher& __hf, const key_equal& __eql) |
| 908 | : __table_(__hf, __eql) |
| 909 | { |
| 910 | __table_.rehash(__n); |
| 911 | insert(__first, __last); |
| 912 | } |
| 913 | |
| 914 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 915 | template <class _InputIterator> |
| 916 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 917 | _InputIterator __first, _InputIterator __last, size_type __n, |
| 918 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 919 | : __table_(__hf, __eql, __a) |
| 920 | { |
| 921 | __table_.rehash(__n); |
| 922 | insert(__first, __last); |
| 923 | } |
| 924 | |
| 925 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 926 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 927 | const hash_multimap& __u) |
| 928 | : __table_(__u.__table_) |
| 929 | { |
| 930 | __table_.rehash(__u.bucket_count()); |
| 931 | insert(__u.begin(), __u.end()); |
| 932 | } |
| 933 | |
| 934 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 935 | template <class _InputIterator> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 936 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 937 | void |
| 938 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, |
| 939 | _InputIterator __last) |
| 940 | { |
| 941 | for (; __first != __last; ++__first) |
| 942 | __table_.__insert_multi(*__first); |
| 943 | } |
| 944 | |
| 945 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 946 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 947 | void |
| 948 | swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 949 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 950 | { |
| 951 | __x.swap(__y); |
| 952 | } |
| 953 | |
| 954 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 955 | bool |
| 956 | operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 957 | const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 958 | { |
| 959 | if (__x.size() != __y.size()) |
| 960 | return false; |
| 961 | typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator |
| 962 | const_iterator; |
| 963 | typedef pair<const_iterator, const_iterator> _EqRng; |
| 964 | for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) |
| 965 | { |
| 966 | _EqRng __xeq = __x.equal_range(__i->first); |
| 967 | _EqRng __yeq = __y.equal_range(__i->first); |
Howard Hinnant | ce48a11 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 968 | if (_VSTD::distance(__xeq.first, __xeq.second) != |
| 969 | _VSTD::distance(__yeq.first, __yeq.second) || |
| 970 | !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 971 | return false; |
| 972 | __i = __xeq.second; |
| 973 | } |
| 974 | return true; |
| 975 | } |
| 976 | |
| 977 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
Howard Hinnant | fb10002 | 2010-09-21 21:28:23 +0000 | [diff] [blame] | 978 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 979 | bool |
| 980 | operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, |
| 981 | const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) |
| 982 | { |
| 983 | return !(__x == __y); |
| 984 | } |
| 985 | |
| 986 | } // __gnu_cxx |
| 987 | |
| 988 | #endif // _LIBCPP_HASH_MAP |