1 // Debugging unordered_map/unordered_multimap implementation -*- C++ -*-
3 // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
26 /** @file debug/unordered_map
27 * This file is a GNU debug extension to the Standard C++ Library.
30 #ifndef _GLIBCXX_DEBUG_UNORDERED_MAP
31 #define _GLIBCXX_DEBUG_UNORDERED_MAP 1
33 #ifndef __GXX_EXPERIMENTAL_CXX0X__
34 # include <bits/c++0x_warning.h>
36 # include <unordered_map>
38 #include <debug/safe_unordered_container.h>
39 #include <debug/safe_iterator.h>
40 #include <debug/safe_local_iterator.h>
42 namespace std _GLIBCXX_VISIBILITY(default)
46 /// Class std::unordered_map with safety/checking/debug instrumentation.
47 template<typename _Key, typename _Tp,
48 typename _Hash = std::hash<_Key>,
49 typename _Pred = std::equal_to<_Key>,
50 typename _Alloc = std::allocator<_Key> >
52 : public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
53 public __gnu_debug::_Safe_unordered_container<unordered_map<_Key, _Tp,
54 _Hash, _Pred, _Alloc> >
56 typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash,
58 typedef __gnu_debug::_Safe_unordered_container<unordered_map> _Safe_base;
59 typedef typename _Base::const_iterator _Base_const_iterator;
60 typedef typename _Base::iterator _Base_iterator;
61 typedef typename _Base::const_local_iterator _Base_const_local_iterator;
62 typedef typename _Base::local_iterator _Base_local_iterator;
65 typedef typename _Base::size_type size_type;
66 typedef typename _Base::hasher hasher;
67 typedef typename _Base::key_equal key_equal;
68 typedef typename _Base::allocator_type allocator_type;
70 typedef typename _Base::key_type key_type;
71 typedef typename _Base::value_type value_type;
73 typedef __gnu_debug::_Safe_iterator<_Base_iterator,
74 unordered_map> iterator;
75 typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,
76 unordered_map> const_iterator;
77 typedef __gnu_debug::_Safe_local_iterator<_Base_local_iterator,
78 unordered_map> local_iterator;
79 typedef __gnu_debug::_Safe_local_iterator<_Base_const_local_iterator,
80 unordered_map> const_local_iterator;
83 unordered_map(size_type __n = 10,
84 const hasher& __hf = hasher(),
85 const key_equal& __eql = key_equal(),
86 const allocator_type& __a = allocator_type())
87 : _Base(__n, __hf, __eql, __a) { }
89 template<typename _InputIterator>
90 unordered_map(_InputIterator __first, _InputIterator __last,
92 const hasher& __hf = hasher(),
93 const key_equal& __eql = key_equal(),
94 const allocator_type& __a = allocator_type())
95 : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
97 __gnu_debug::__base(__last), __n,
100 unordered_map(const unordered_map& __x)
103 unordered_map(const _Base& __x)
106 unordered_map(unordered_map&& __x)
107 : _Base(std::move(__x)) { }
109 unordered_map(initializer_list<value_type> __l,
111 const hasher& __hf = hasher(),
112 const key_equal& __eql = key_equal(),
113 const allocator_type& __a = allocator_type())
114 : _Base(__l, __n, __hf, __eql, __a) { }
116 ~unordered_map() noexcept { }
119 operator=(const unordered_map& __x)
121 *static_cast<_Base*>(this) = __x;
122 this->_M_invalidate_all();
127 operator=(unordered_map&& __x)
137 operator=(initializer_list<value_type> __l)
145 swap(unordered_map& __x)
148 _Safe_base::_M_swap(__x);
155 this->_M_invalidate_all();
160 { return iterator(_Base::begin(), this); }
163 begin() const noexcept
164 { return const_iterator(_Base::begin(), this); }
168 { return iterator(_Base::end(), this); }
172 { return const_iterator(_Base::end(), this); }
175 cbegin() const noexcept
176 { return const_iterator(_Base::begin(), this); }
179 cend() const noexcept
180 { return const_iterator(_Base::end(), this); }
185 { return local_iterator(_Base::begin(__b), __b, this); }
189 { return local_iterator(_Base::end(__b), __b, this); }
192 begin(size_type __b) const
193 { return const_local_iterator(_Base::begin(__b), __b, this); }
196 end(size_type __b) const
197 { return const_local_iterator(_Base::end(__b), __b, this); }
200 cbegin(size_type __b) const
201 { return const_local_iterator(_Base::cbegin(__b), __b, this); }
204 cend(size_type __b) const
205 { return const_local_iterator(_Base::cend(__b), __b, this); }
207 template<typename... _Args>
208 std::pair<iterator, bool>
209 emplace(_Args&&... __args)
211 size_type __bucket_count = this->bucket_count();
212 std::pair<_Base_iterator, bool> __res
213 = _Base::emplace(std::forward<_Args>(__args)...);
214 _M_check_rehashed(__bucket_count);
215 return std::make_pair(iterator(__res.first, this), __res.second);
218 template<typename... _Args>
220 emplace_hint(const_iterator __hint, _Args&&... __args)
222 __glibcxx_check_insert(__hint);
223 size_type __bucket_count = this->bucket_count();
224 _Base_iterator __it = _Base::emplace_hint(__hint.base(),
225 std::forward<_Args>(__args)...);
226 _M_check_rehashed(__bucket_count);
227 return iterator(__it, this);
230 std::pair<iterator, bool>
231 insert(const value_type& __obj)
233 size_type __bucket_count = this->bucket_count();
234 std::pair<_Base_iterator, bool> __res = _Base::insert(__obj);
235 _M_check_rehashed(__bucket_count);
236 return std::make_pair(iterator(__res.first, this), __res.second);
240 insert(const_iterator __hint, const value_type& __obj)
242 __glibcxx_check_insert(__hint);
243 size_type __bucket_count = this->bucket_count();
244 _Base_iterator __it = _Base::insert(__hint.base(), __obj);
245 _M_check_rehashed(__bucket_count);
246 return iterator(__it, this);
249 template<typename _Pair, typename = typename
250 std::enable_if<std::is_convertible<_Pair,
251 value_type>::value>::type>
252 std::pair<iterator, bool>
253 insert(_Pair&& __obj)
255 size_type __bucket_count = this->bucket_count();
256 std::pair<_Base_iterator, bool> __res =
257 _Base::insert(std::forward<_Pair>(__obj));
258 _M_check_rehashed(__bucket_count);
259 return std::make_pair(iterator(__res.first, this), __res.second);
262 template<typename _Pair, typename = typename
263 std::enable_if<std::is_convertible<_Pair,
264 value_type>::value>::type>
266 insert(const_iterator __hint, _Pair&& __obj)
268 __glibcxx_check_insert(__hint);
269 size_type __bucket_count = this->bucket_count();
270 _Base_iterator __it =
271 _Base::insert(__hint.base(), std::forward<_Pair>(__obj));
272 _M_check_rehashed(__bucket_count);
273 return iterator(__it, this);
277 insert(std::initializer_list<value_type> __l)
279 size_type __bucket_count = this->bucket_count();
281 _M_check_rehashed(__bucket_count);
284 template<typename _InputIterator>
286 insert(_InputIterator __first, _InputIterator __last)
288 __glibcxx_check_valid_range(__first, __last);
289 size_type __bucket_count = this->bucket_count();
290 _Base::insert(__gnu_debug::__base(__first),
291 __gnu_debug::__base(__last));
292 _M_check_rehashed(__bucket_count);
296 find(const key_type& __key)
297 { return iterator(_Base::find(__key), this); }
300 find(const key_type& __key) const
301 { return const_iterator(_Base::find(__key), this); }
303 std::pair<iterator, iterator>
304 equal_range(const key_type& __key)
306 std::pair<_Base_iterator, _Base_iterator> __res =
307 _Base::equal_range(__key);
308 return std::make_pair(iterator(__res.first, this),
309 iterator(__res.second, this));
312 std::pair<const_iterator, const_iterator>
313 equal_range(const key_type& __key) const
315 std::pair<_Base_const_iterator, _Base_const_iterator> __res =
316 _Base::equal_range(__key);
317 return std::make_pair(const_iterator(__res.first, this),
318 const_iterator(__res.second, this));
322 erase(const key_type& __key)
325 _Base_iterator __victim(_Base::find(__key));
326 if (__victim != _Base::end())
328 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
329 { return __it == __victim; });
330 _Base_local_iterator __local_victim = _S_to_local(__victim);
331 this->_M_invalidate_local_if(
332 [__local_victim](_Base_const_local_iterator __it)
333 { return __it == __local_victim; });
334 size_type __bucket_count = this->bucket_count();
335 _Base::erase(__victim);
336 _M_check_rehashed(__bucket_count);
343 erase(const_iterator __it)
345 __glibcxx_check_erase(__it);
346 _Base_const_iterator __victim = __it.base();
347 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
348 { return __it == __victim; });
349 _Base_const_local_iterator __local_victim = _S_to_local(__victim);
350 this->_M_invalidate_local_if(
351 [__local_victim](_Base_const_local_iterator __it)
352 { return __it == __local_victim; });
353 size_type __bucket_count = this->bucket_count();
354 _Base_iterator __next = _Base::erase(__it.base());
355 _M_check_rehashed(__bucket_count);
356 return iterator(__next, this);
361 { return erase(const_iterator(__it)); }
364 erase(const_iterator __first, const_iterator __last)
366 __glibcxx_check_erase_range(__first, __last);
367 for (_Base_const_iterator __tmp = __first.base();
368 __tmp != __last.base(); ++__tmp)
370 _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
371 _M_message(__gnu_debug::__msg_valid_range)
372 ._M_iterator(__first, "first")
373 ._M_iterator(__last, "last"));
374 this->_M_invalidate_if([__tmp](_Base_const_iterator __it)
375 { return __it == __tmp; });
376 _Base_const_local_iterator __local_tmp = _S_to_local(__tmp);
377 this->_M_invalidate_local_if(
378 [__local_tmp](_Base_const_local_iterator __it)
379 { return __it == __local_tmp; });
381 size_type __bucket_count = this->bucket_count();
382 _Base_iterator __next = _Base::erase(__first.base(), __last.base());
383 _M_check_rehashed(__bucket_count);
384 return iterator(__next, this);
388 _M_base() noexcept { return *this; }
391 _M_base() const noexcept { return *this; }
395 _M_invalidate_locals()
397 _Base_local_iterator __local_end = _Base::end(0);
398 this->_M_invalidate_local_if(
399 [__local_end](_Base_const_local_iterator __it)
400 { return __it != __local_end; });
406 _Base_iterator __end = _Base::end();
407 this->_M_invalidate_if([__end](_Base_const_iterator __it)
408 { return __it != __end; });
409 _M_invalidate_locals();
413 _M_check_rehashed(size_type __prev_count)
415 if (__prev_count != this->bucket_count())
416 _M_invalidate_locals();
419 static _Base_local_iterator
420 _S_to_local(_Base_iterator __it)
422 // The returned local iterator will not be incremented so we don't
423 // need to compute __it's node bucket
424 return _Base_local_iterator(__it._M_cur, 0, 0);
427 static _Base_const_local_iterator
428 _S_to_local(_Base_const_iterator __it)
430 // The returned local iterator will not be incremented so we don't
431 // need to compute __it's node bucket
432 return _Base_const_local_iterator(__it._M_cur, 0, 0);
436 template<typename _Key, typename _Tp, typename _Hash,
437 typename _Pred, typename _Alloc>
439 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
440 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
443 template<typename _Key, typename _Tp, typename _Hash,
444 typename _Pred, typename _Alloc>
446 operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
447 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
448 { return __x._M_equal(__y); }
450 template<typename _Key, typename _Tp, typename _Hash,
451 typename _Pred, typename _Alloc>
453 operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
454 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
455 { return !(__x == __y); }
458 /// Class std::unordered_multimap with safety/checking/debug instrumentation.
459 template<typename _Key, typename _Tp,
460 typename _Hash = std::hash<_Key>,
461 typename _Pred = std::equal_to<_Key>,
462 typename _Alloc = std::allocator<_Key> >
463 class unordered_multimap
464 : public _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
466 public __gnu_debug::_Safe_unordered_container<unordered_multimap<_Key,
467 _Tp, _Hash, _Pred, _Alloc> >
469 typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
470 _Pred, _Alloc> _Base;
471 typedef __gnu_debug::_Safe_unordered_container<unordered_multimap>
473 typedef typename _Base::const_iterator _Base_const_iterator;
474 typedef typename _Base::iterator _Base_iterator;
475 typedef typename _Base::const_local_iterator _Base_const_local_iterator;
476 typedef typename _Base::local_iterator _Base_local_iterator;
479 typedef typename _Base::size_type size_type;
480 typedef typename _Base::hasher hasher;
481 typedef typename _Base::key_equal key_equal;
482 typedef typename _Base::allocator_type allocator_type;
484 typedef typename _Base::key_type key_type;
485 typedef typename _Base::value_type value_type;
487 typedef __gnu_debug::_Safe_iterator<_Base_iterator,
488 unordered_multimap> iterator;
489 typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,
490 unordered_multimap> const_iterator;
491 typedef __gnu_debug::_Safe_local_iterator<
492 _Base_local_iterator, unordered_multimap> local_iterator;
493 typedef __gnu_debug::_Safe_local_iterator<
494 _Base_const_local_iterator, unordered_multimap> const_local_iterator;
497 unordered_multimap(size_type __n = 10,
498 const hasher& __hf = hasher(),
499 const key_equal& __eql = key_equal(),
500 const allocator_type& __a = allocator_type())
501 : _Base(__n, __hf, __eql, __a) { }
503 template<typename _InputIterator>
504 unordered_multimap(_InputIterator __first, _InputIterator __last,
506 const hasher& __hf = hasher(),
507 const key_equal& __eql = key_equal(),
508 const allocator_type& __a = allocator_type())
509 : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
511 __gnu_debug::__base(__last), __n,
512 __hf, __eql, __a) { }
514 unordered_multimap(const unordered_multimap& __x)
517 unordered_multimap(const _Base& __x)
520 unordered_multimap(unordered_multimap&& __x)
521 : _Base(std::move(__x)) { }
523 unordered_multimap(initializer_list<value_type> __l,
525 const hasher& __hf = hasher(),
526 const key_equal& __eql = key_equal(),
527 const allocator_type& __a = allocator_type())
528 : _Base(__l, __n, __hf, __eql, __a) { }
530 ~unordered_multimap() noexcept { }
533 operator=(const unordered_multimap& __x)
535 *static_cast<_Base*>(this) = __x;
536 this->_M_invalidate_all();
541 operator=(unordered_multimap&& __x)
551 operator=(initializer_list<value_type> __l)
559 swap(unordered_multimap& __x)
562 _Safe_base::_M_swap(__x);
569 this->_M_invalidate_all();
574 { return iterator(_Base::begin(), this); }
577 begin() const noexcept
578 { return const_iterator(_Base::begin(), this); }
582 { return iterator(_Base::end(), this); }
586 { return const_iterator(_Base::end(), this); }
589 cbegin() const noexcept
590 { return const_iterator(_Base::begin(), this); }
593 cend() const noexcept
594 { return const_iterator(_Base::end(), this); }
599 { return local_iterator(_Base::begin(__b), __b, this); }
603 { return local_iterator(_Base::end(__b), __b, this); }
606 begin(size_type __b) const
607 { return const_local_iterator(_Base::begin(__b), __b, this); }
610 end(size_type __b) const
611 { return const_local_iterator(_Base::end(__b), __b, this); }
614 cbegin(size_type __b) const
615 { return const_local_iterator(_Base::cbegin(__b), __b, this); }
618 cend(size_type __b) const
619 { return const_local_iterator(_Base::cend(__b), __b, this); }
621 template<typename... _Args>
623 emplace(_Args&&... __args)
625 size_type __bucket_count = this->bucket_count();
627 = _Base::emplace(std::forward<_Args>(__args)...);
628 _M_check_rehashed(__bucket_count);
629 return iterator(__it, this);
632 template<typename... _Args>
634 emplace_hint(const_iterator __hint, _Args&&... __args)
636 __glibcxx_check_insert(__hint);
637 size_type __bucket_count = this->bucket_count();
638 _Base_iterator __it = _Base::emplace_hint(__hint.base(),
639 std::forward<_Args>(__args)...);
640 _M_check_rehashed(__bucket_count);
641 return iterator(__it, this);
645 insert(const value_type& __obj)
647 size_type __bucket_count = this->bucket_count();
648 _Base_iterator __it = _Base::insert(__obj);
649 _M_check_rehashed(__bucket_count);
650 return iterator(__it, this);
654 insert(const_iterator __hint, const value_type& __obj)
656 __glibcxx_check_insert(__hint);
657 size_type __bucket_count = this->bucket_count();
658 _Base_iterator __it = _Base::insert(__hint.base(), __obj);
659 _M_check_rehashed(__bucket_count);
660 return iterator(__it, this);
663 template<typename _Pair, typename = typename
664 std::enable_if<std::is_convertible<_Pair,
665 value_type>::value>::type>
667 insert(_Pair&& __obj)
669 size_type __bucket_count = this->bucket_count();
670 _Base_iterator __it = _Base::insert(std::forward<_Pair>(__obj));
671 _M_check_rehashed(__bucket_count);
672 return iterator(__it, this);
675 template<typename _Pair, typename = typename
676 std::enable_if<std::is_convertible<_Pair,
677 value_type>::value>::type>
679 insert(const_iterator __hint, _Pair&& __obj)
681 __glibcxx_check_insert(__hint);
682 size_type __bucket_count = this->bucket_count();
683 _Base_iterator __it =
684 _Base::insert(__hint.base(), std::forward<_Pair>(__obj));
685 _M_check_rehashed(__bucket_count);
686 return iterator(__it, this);
690 insert(std::initializer_list<value_type> __l)
691 { _Base::insert(__l); }
693 template<typename _InputIterator>
695 insert(_InputIterator __first, _InputIterator __last)
697 __glibcxx_check_valid_range(__first, __last);
698 size_type __bucket_count = this->bucket_count();
699 _Base::insert(__gnu_debug::__base(__first),
700 __gnu_debug::__base(__last));
701 _M_check_rehashed(__bucket_count);
705 find(const key_type& __key)
706 { return iterator(_Base::find(__key), this); }
709 find(const key_type& __key) const
710 { return const_iterator(_Base::find(__key), this); }
712 std::pair<iterator, iterator>
713 equal_range(const key_type& __key)
715 std::pair<_Base_iterator, _Base_iterator> __res =
716 _Base::equal_range(__key);
717 return std::make_pair(iterator(__res.first, this),
718 iterator(__res.second, this));
721 std::pair<const_iterator, const_iterator>
722 equal_range(const key_type& __key) const
724 std::pair<_Base_const_iterator, _Base_const_iterator> __res =
725 _Base::equal_range(__key);
726 return std::make_pair(const_iterator(__res.first, this),
727 const_iterator(__res.second, this));
731 erase(const key_type& __key)
734 size_type __bucket_count = this->bucket_count();
735 std::pair<_Base_iterator, _Base_iterator> __pair =
736 _Base::equal_range(__key);
737 for (_Base_iterator __victim = __pair.first; __victim != __pair.second;)
739 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
740 { return __it == __victim; });
741 _Base_local_iterator __local_victim = _S_to_local(__victim);
742 this->_M_invalidate_local_if(
743 [__local_victim](_Base_const_local_iterator __it)
744 { return __it == __local_victim; });
745 _Base::erase(__victim++);
748 _M_check_rehashed(__bucket_count);
753 erase(const_iterator __it)
755 __glibcxx_check_erase(__it);
756 _Base_const_iterator __victim = __it.base();
757 this->_M_invalidate_if([__victim](_Base_const_iterator __it)
758 { return __it == __victim; });
759 _Base_const_local_iterator __local_victim = _S_to_local(__victim);
760 this->_M_invalidate_local_if(
761 [__local_victim](_Base_const_local_iterator __it)
762 { return __it == __local_victim; });
763 size_type __bucket_count = this->bucket_count();
764 _Base_iterator __next = _Base::erase(__it.base());
765 _M_check_rehashed(__bucket_count);
766 return iterator(__next, this);
771 { return erase(const_iterator(__it)); }
774 erase(const_iterator __first, const_iterator __last)
776 __glibcxx_check_erase_range(__first, __last);
777 for (_Base_const_iterator __tmp = __first.base();
778 __tmp != __last.base(); ++__tmp)
780 _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
781 _M_message(__gnu_debug::__msg_valid_range)
782 ._M_iterator(__first, "first")
783 ._M_iterator(__last, "last"));
784 this->_M_invalidate_if([__tmp](_Base_const_iterator __it)
785 { return __it == __tmp; });
786 _Base_const_local_iterator __local_tmp = _S_to_local(__tmp);
787 this->_M_invalidate_local_if(
788 [__local_tmp](_Base_const_local_iterator __it)
789 { return __it == __local_tmp; });
791 size_type __bucket_count = this->bucket_count();
792 _Base_iterator __next = _Base::erase(__first.base(), __last.base());
793 _M_check_rehashed(__bucket_count);
794 return iterator(__next, this);
798 _M_base() noexcept { return *this; }
801 _M_base() const noexcept { return *this; }
805 _M_invalidate_locals()
807 _Base_local_iterator __local_end = _Base::end(0);
808 this->_M_invalidate_local_if(
809 [__local_end](_Base_const_local_iterator __it)
810 { return __it != __local_end; });
816 _Base_iterator __end = _Base::end();
817 this->_M_invalidate_if([__end](_Base_const_iterator __it)
818 { return __it != __end; });
819 _M_invalidate_locals();
823 _M_check_rehashed(size_type __prev_count)
825 if (__prev_count != this->bucket_count())
826 _M_invalidate_locals();
829 static _Base_local_iterator
830 _S_to_local(_Base_iterator __it)
832 // The returned local iterator will not be incremented so we don't
833 // need to compute __it's node bucket
834 return _Base_local_iterator(__it._M_cur, 0, 0);
837 static _Base_const_local_iterator
838 _S_to_local(_Base_const_iterator __it)
840 // The returned local iterator will not be incremented so we don't
841 // need to compute __it's node bucket
842 return _Base_const_local_iterator(__it._M_cur, 0, 0);
846 template<typename _Key, typename _Tp, typename _Hash,
847 typename _Pred, typename _Alloc>
849 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
850 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
853 template<typename _Key, typename _Tp, typename _Hash,
854 typename _Pred, typename _Alloc>
856 operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
857 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
858 { return __x._M_equal(__y); }
860 template<typename _Key, typename _Tp, typename _Hash,
861 typename _Pred, typename _Alloc>
863 operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
864 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
865 { return !(__x == __y); }
867 } // namespace __debug
870 #endif // __GXX_EXPERIMENTAL_CXX0X__