1 // Multimap implementation -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
4 // 2011 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/>.
29 * Hewlett-Packard Company
31 * Permission to use, copy, modify, distribute and sell this software
32 * and its documentation for any purpose is hereby granted without fee,
33 * provided that the above copyright notice appear in all copies and
34 * that both that copyright notice and this permission notice appear
35 * in supporting documentation. Hewlett-Packard Company makes no
36 * representations about the suitability of this software for any
37 * purpose. It is provided "as is" without express or implied warranty.
40 * Copyright (c) 1996,1997
41 * Silicon Graphics Computer Systems, Inc.
43 * Permission to use, copy, modify, distribute and sell this software
44 * and its documentation for any purpose is hereby granted without fee,
45 * provided that the above copyright notice appear in all copies and
46 * that both that copyright notice and this permission notice appear
47 * in supporting documentation. Silicon Graphics makes no
48 * representations about the suitability of this software for any
49 * purpose. It is provided "as is" without express or implied warranty.
52 /** @file bits/stl_multimap.h
53 * This is an internal header file, included by other library headers.
54 * Do not attempt to use it directly. @headername{map}
57 #ifndef _STL_MULTIMAP_H
58 #define _STL_MULTIMAP_H 1
60 #include <bits/concept_check.h>
61 #include <initializer_list>
63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
68 * @brief A standard container made up of (key,value) pairs, which can be
69 * retrieved based on a key, in logarithmic time.
71 * @ingroup associative_containers
73 * Meets the requirements of a <a href="tables.html#65">container</a>, a
74 * <a href="tables.html#66">reversible container</a>, and an
75 * <a href="tables.html#69">associative container</a> (using equivalent
76 * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type
77 * is T, and the value_type is std::pair<const Key,T>.
79 * Multimaps support bidirectional iterators.
81 * The private tree data is declared exactly the same way for map and
82 * multimap; the distinction is made entirely in how the tree functions are
83 * called (*_unique versus *_equal, same as the standard).
85 template <typename _Key, typename _Tp,
86 typename _Compare = std::less<_Key>,
87 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
91 typedef _Key key_type;
92 typedef _Tp mapped_type;
93 typedef std::pair<const _Key, _Tp> value_type;
94 typedef _Compare key_compare;
95 typedef _Alloc allocator_type;
98 // concept requirements
99 typedef typename _Alloc::value_type _Alloc_value_type;
100 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
101 __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
102 _BinaryFunctionConcept)
103 __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
107 : public std::binary_function<value_type, value_type, bool>
109 friend class multimap<_Key, _Tp, _Compare, _Alloc>;
113 value_compare(_Compare __c)
117 bool operator()(const value_type& __x, const value_type& __y) const
118 { return comp(__x.first, __y.first); }
122 /// This turns a red-black tree into a [multi]map.
123 typedef typename _Alloc::template rebind<value_type>::other
126 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
127 key_compare, _Pair_alloc_type> _Rep_type;
128 /// The actual tree structure.
132 // many of these are specified differently in ISO, but the following are
133 // "functionally equivalent"
134 typedef typename _Pair_alloc_type::pointer pointer;
135 typedef typename _Pair_alloc_type::const_pointer const_pointer;
136 typedef typename _Pair_alloc_type::reference reference;
137 typedef typename _Pair_alloc_type::const_reference const_reference;
138 typedef typename _Rep_type::iterator iterator;
139 typedef typename _Rep_type::const_iterator const_iterator;
140 typedef typename _Rep_type::size_type size_type;
141 typedef typename _Rep_type::difference_type difference_type;
142 typedef typename _Rep_type::reverse_iterator reverse_iterator;
143 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
145 // [23.3.2] construct/copy/destroy
146 // (get_allocator() is also listed in this section)
148 * @brief Default constructor creates no elements.
154 * @brief Creates a %multimap with no elements.
155 * @param __comp A comparison object.
156 * @param __a An allocator object.
159 multimap(const _Compare& __comp,
160 const allocator_type& __a = allocator_type())
161 : _M_t(__comp, _Pair_alloc_type(__a)) { }
164 * @brief %Multimap copy constructor.
165 * @param __x A %multimap of identical element and allocator types.
167 * The newly-created %multimap uses a copy of the allocation object
170 multimap(const multimap& __x)
173 #ifdef __GXX_EXPERIMENTAL_CXX0X__
175 * @brief %Multimap move constructor.
176 * @param __x A %multimap of identical element and allocator types.
178 * The newly-created %multimap contains the exact contents of @a __x.
179 * The contents of @a __x are a valid, but unspecified %multimap.
181 multimap(multimap&& __x)
182 noexcept(is_nothrow_copy_constructible<_Compare>::value)
183 : _M_t(std::move(__x._M_t)) { }
186 * @brief Builds a %multimap from an initializer_list.
187 * @param __l An initializer_list.
188 * @param __comp A comparison functor.
189 * @param __a An allocator object.
191 * Create a %multimap consisting of copies of the elements from
192 * the initializer_list. This is linear in N if the list is already
193 * sorted, and NlogN otherwise (where N is @a __l.size()).
195 multimap(initializer_list<value_type> __l,
196 const _Compare& __comp = _Compare(),
197 const allocator_type& __a = allocator_type())
198 : _M_t(__comp, _Pair_alloc_type(__a))
199 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
203 * @brief Builds a %multimap from a range.
204 * @param __first An input iterator.
205 * @param __last An input iterator.
207 * Create a %multimap consisting of copies of the elements from
208 * [__first,__last). This is linear in N if the range is already sorted,
209 * and NlogN otherwise (where N is distance(__first,__last)).
211 template<typename _InputIterator>
212 multimap(_InputIterator __first, _InputIterator __last)
214 { _M_t._M_insert_equal(__first, __last); }
217 * @brief Builds a %multimap from a range.
218 * @param __first An input iterator.
219 * @param __last An input iterator.
220 * @param __comp A comparison functor.
221 * @param __a An allocator object.
223 * Create a %multimap consisting of copies of the elements from
224 * [__first,__last). This is linear in N if the range is already sorted,
225 * and NlogN otherwise (where N is distance(__first,__last)).
227 template<typename _InputIterator>
228 multimap(_InputIterator __first, _InputIterator __last,
229 const _Compare& __comp,
230 const allocator_type& __a = allocator_type())
231 : _M_t(__comp, _Pair_alloc_type(__a))
232 { _M_t._M_insert_equal(__first, __last); }
234 // FIXME There is no dtor declared, but we should have something generated
235 // by Doxygen. I don't know what tags to add to this paragraph to make
238 * The dtor only erases the elements, and note that if the elements
239 * themselves are pointers, the pointed-to memory is not touched in any
240 * way. Managing the pointer is the user's responsibility.
244 * @brief %Multimap assignment operator.
245 * @param __x A %multimap of identical element and allocator types.
247 * All the elements of @a __x are copied, but unlike the copy
248 * constructor, the allocator object is not copied.
251 operator=(const multimap& __x)
257 #ifdef __GXX_EXPERIMENTAL_CXX0X__
259 * @brief %Multimap move assignment operator.
260 * @param __x A %multimap of identical element and allocator types.
262 * The contents of @a __x are moved into this multimap (without copying).
263 * @a __x is a valid, but unspecified multimap.
266 operator=(multimap&& __x)
276 * @brief %Multimap list assignment operator.
277 * @param __l An initializer_list.
279 * This function fills a %multimap with copies of the elements
280 * in the initializer list @a __l.
282 * Note that the assignment completely changes the %multimap and
283 * that the resulting %multimap's size is the same as the number
284 * of elements assigned. Old data may be lost.
287 operator=(initializer_list<value_type> __l)
290 this->insert(__l.begin(), __l.end());
295 /// Get a copy of the memory allocation object.
297 get_allocator() const _GLIBCXX_NOEXCEPT
298 { return allocator_type(_M_t.get_allocator()); }
302 * Returns a read/write iterator that points to the first pair in the
303 * %multimap. Iteration is done in ascending order according to the
307 begin() _GLIBCXX_NOEXCEPT
308 { return _M_t.begin(); }
311 * Returns a read-only (constant) iterator that points to the first pair
312 * in the %multimap. Iteration is done in ascending order according to
316 begin() const _GLIBCXX_NOEXCEPT
317 { return _M_t.begin(); }
320 * Returns a read/write iterator that points one past the last pair in
321 * the %multimap. Iteration is done in ascending order according to the
325 end() _GLIBCXX_NOEXCEPT
326 { return _M_t.end(); }
329 * Returns a read-only (constant) iterator that points one past the last
330 * pair in the %multimap. Iteration is done in ascending order according
334 end() const _GLIBCXX_NOEXCEPT
335 { return _M_t.end(); }
338 * Returns a read/write reverse iterator that points to the last pair in
339 * the %multimap. Iteration is done in descending order according to the
343 rbegin() _GLIBCXX_NOEXCEPT
344 { return _M_t.rbegin(); }
347 * Returns a read-only (constant) reverse iterator that points to the
348 * last pair in the %multimap. Iteration is done in descending order
349 * according to the keys.
351 const_reverse_iterator
352 rbegin() const _GLIBCXX_NOEXCEPT
353 { return _M_t.rbegin(); }
356 * Returns a read/write reverse iterator that points to one before the
357 * first pair in the %multimap. Iteration is done in descending order
358 * according to the keys.
361 rend() _GLIBCXX_NOEXCEPT
362 { return _M_t.rend(); }
365 * Returns a read-only (constant) reverse iterator that points to one
366 * before the first pair in the %multimap. Iteration is done in
367 * descending order according to the keys.
369 const_reverse_iterator
370 rend() const _GLIBCXX_NOEXCEPT
371 { return _M_t.rend(); }
373 #ifdef __GXX_EXPERIMENTAL_CXX0X__
375 * Returns a read-only (constant) iterator that points to the first pair
376 * in the %multimap. Iteration is done in ascending order according to
380 cbegin() const noexcept
381 { return _M_t.begin(); }
384 * Returns a read-only (constant) iterator that points one past the last
385 * pair in the %multimap. Iteration is done in ascending order according
389 cend() const noexcept
390 { return _M_t.end(); }
393 * Returns a read-only (constant) reverse iterator that points to the
394 * last pair in the %multimap. Iteration is done in descending order
395 * according to the keys.
397 const_reverse_iterator
398 crbegin() const noexcept
399 { return _M_t.rbegin(); }
402 * Returns a read-only (constant) reverse iterator that points to one
403 * before the first pair in the %multimap. Iteration is done in
404 * descending order according to the keys.
406 const_reverse_iterator
407 crend() const noexcept
408 { return _M_t.rend(); }
412 /** Returns true if the %multimap is empty. */
414 empty() const _GLIBCXX_NOEXCEPT
415 { return _M_t.empty(); }
417 /** Returns the size of the %multimap. */
419 size() const _GLIBCXX_NOEXCEPT
420 { return _M_t.size(); }
422 /** Returns the maximum size of the %multimap. */
424 max_size() const _GLIBCXX_NOEXCEPT
425 { return _M_t.max_size(); }
429 * @brief Inserts a std::pair into the %multimap.
430 * @param __x Pair to be inserted (see std::make_pair for easy creation
432 * @return An iterator that points to the inserted (key,value) pair.
434 * This function inserts a (key, value) pair into the %multimap.
435 * Contrary to a std::map the %multimap does not rely on unique keys and
436 * thus multiple pairs with the same key can be inserted.
438 * Insertion requires logarithmic time.
441 insert(const value_type& __x)
442 { return _M_t._M_insert_equal(__x); }
444 #ifdef __GXX_EXPERIMENTAL_CXX0X__
445 template<typename _Pair, typename = typename
446 std::enable_if<std::is_convertible<_Pair,
447 value_type>::value>::type>
450 { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
454 * @brief Inserts a std::pair into the %multimap.
455 * @param __position An iterator that serves as a hint as to where the
456 * pair should be inserted.
457 * @param __x Pair to be inserted (see std::make_pair for easy creation
459 * @return An iterator that points to the inserted (key,value) pair.
461 * This function inserts a (key, value) pair into the %multimap.
462 * Contrary to a std::map the %multimap does not rely on unique keys and
463 * thus multiple pairs with the same key can be inserted.
464 * Note that the first parameter is only a hint and can potentially
465 * improve the performance of the insertion process. A bad hint would
466 * cause no gains in efficiency.
468 * For more on @a hinting, see:
469 * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
471 * Insertion requires logarithmic time (if the hint is not taken).
474 #ifdef __GXX_EXPERIMENTAL_CXX0X__
475 insert(const_iterator __position, const value_type& __x)
477 insert(iterator __position, const value_type& __x)
479 { return _M_t._M_insert_equal_(__position, __x); }
481 #ifdef __GXX_EXPERIMENTAL_CXX0X__
482 template<typename _Pair, typename = typename
483 std::enable_if<std::is_convertible<_Pair,
484 value_type>::value>::type>
486 insert(const_iterator __position, _Pair&& __x)
487 { return _M_t._M_insert_equal_(__position,
488 std::forward<_Pair>(__x)); }
492 * @brief A template function that attempts to insert a range
494 * @param __first Iterator pointing to the start of the range to be
496 * @param __last Iterator pointing to the end of the range.
498 * Complexity similar to that of the range constructor.
500 template<typename _InputIterator>
502 insert(_InputIterator __first, _InputIterator __last)
503 { _M_t._M_insert_equal(__first, __last); }
505 #ifdef __GXX_EXPERIMENTAL_CXX0X__
507 * @brief Attempts to insert a list of std::pairs into the %multimap.
508 * @param __l A std::initializer_list<value_type> of pairs to be
511 * Complexity similar to that of the range constructor.
514 insert(initializer_list<value_type> __l)
515 { this->insert(__l.begin(), __l.end()); }
518 #ifdef __GXX_EXPERIMENTAL_CXX0X__
519 // _GLIBCXX_RESOLVE_LIB_DEFECTS
520 // DR 130. Associative erase should return an iterator.
522 * @brief Erases an element from a %multimap.
523 * @param __position An iterator pointing to the element to be erased.
524 * @return An iterator pointing to the element immediately following
525 * @a position prior to the element being erased. If no such
526 * element exists, end() is returned.
528 * This function erases an element, pointed to by the given iterator,
529 * from a %multimap. Note that this function only erases the element,
530 * and that if the element is itself a pointer, the pointed-to memory is
531 * not touched in any way. Managing the pointer is the user's
535 erase(const_iterator __position)
536 { return _M_t.erase(__position); }
539 * @brief Erases an element from a %multimap.
540 * @param __position An iterator pointing to the element to be erased.
542 * This function erases an element, pointed to by the given iterator,
543 * from a %multimap. Note that this function only erases the element,
544 * and that if the element is itself a pointer, the pointed-to memory is
545 * not touched in any way. Managing the pointer is the user's
549 erase(iterator __position)
550 { _M_t.erase(__position); }
554 * @brief Erases elements according to the provided key.
555 * @param __x Key of element to be erased.
556 * @return The number of elements erased.
558 * This function erases all elements located by the given key from a
560 * Note that this function only erases the element, and that if
561 * the element is itself a pointer, the pointed-to memory is not touched
562 * in any way. Managing the pointer is the user's responsibility.
565 erase(const key_type& __x)
566 { return _M_t.erase(__x); }
568 #ifdef __GXX_EXPERIMENTAL_CXX0X__
569 // _GLIBCXX_RESOLVE_LIB_DEFECTS
570 // DR 130. Associative erase should return an iterator.
572 * @brief Erases a [first,last) range of elements from a %multimap.
573 * @param __first Iterator pointing to the start of the range to be
575 * @param __last Iterator pointing to the end of the range to be
577 * @return The iterator @a __last.
579 * This function erases a sequence of elements from a %multimap.
580 * Note that this function only erases the elements, and that if
581 * the elements themselves are pointers, the pointed-to memory is not
582 * touched in any way. Managing the pointer is the user's
586 erase(const_iterator __first, const_iterator __last)
587 { return _M_t.erase(__first, __last); }
589 // _GLIBCXX_RESOLVE_LIB_DEFECTS
590 // DR 130. Associative erase should return an iterator.
592 * @brief Erases a [first,last) range of elements from a %multimap.
593 * @param __first Iterator pointing to the start of the range to be
595 * @param __last Iterator pointing to the end of the range to
598 * This function erases a sequence of elements from a %multimap.
599 * Note that this function only erases the elements, and that if
600 * the elements themselves are pointers, the pointed-to memory is not
601 * touched in any way. Managing the pointer is the user's
605 erase(iterator __first, iterator __last)
606 { _M_t.erase(__first, __last); }
610 * @brief Swaps data with another %multimap.
611 * @param __x A %multimap of the same element and allocator types.
613 * This exchanges the elements between two multimaps in constant time.
614 * (It is only swapping a pointer, an integer, and an instance of
615 * the @c Compare type (which itself is often stateless and empty), so it
616 * should be quite fast.)
617 * Note that the global std::swap() function is specialized such that
618 * std::swap(m1,m2) will feed to this function.
622 { _M_t.swap(__x._M_t); }
625 * Erases all elements in a %multimap. Note that this function only
626 * erases the elements, and that if the elements themselves are pointers,
627 * the pointed-to memory is not touched in any way. Managing the pointer
628 * is the user's responsibility.
631 clear() _GLIBCXX_NOEXCEPT
636 * Returns the key comparison object out of which the %multimap
641 { return _M_t.key_comp(); }
644 * Returns a value comparison object, built from the key comparison
645 * object out of which the %multimap was constructed.
649 { return value_compare(_M_t.key_comp()); }
651 // multimap operations
653 * @brief Tries to locate an element in a %multimap.
654 * @param __x Key of (key, value) pair to be located.
655 * @return Iterator pointing to sought-after element,
656 * or end() if not found.
658 * This function takes a key and tries to locate the element with which
659 * the key matches. If successful the function returns an iterator
660 * pointing to the sought after %pair. If unsuccessful it returns the
661 * past-the-end ( @c end() ) iterator.
664 find(const key_type& __x)
665 { return _M_t.find(__x); }
668 * @brief Tries to locate an element in a %multimap.
669 * @param __x Key of (key, value) pair to be located.
670 * @return Read-only (constant) iterator pointing to sought-after
671 * element, or end() if not found.
673 * This function takes a key and tries to locate the element with which
674 * the key matches. If successful the function returns a constant
675 * iterator pointing to the sought after %pair. If unsuccessful it
676 * returns the past-the-end ( @c end() ) iterator.
679 find(const key_type& __x) const
680 { return _M_t.find(__x); }
683 * @brief Finds the number of elements with given key.
684 * @param __x Key of (key, value) pairs to be located.
685 * @return Number of elements with specified key.
688 count(const key_type& __x) const
689 { return _M_t.count(__x); }
692 * @brief Finds the beginning of a subsequence matching given key.
693 * @param __x Key of (key, value) pair to be located.
694 * @return Iterator pointing to first element equal to or greater
695 * than key, or end().
697 * This function returns the first element of a subsequence of elements
698 * that matches the given key. If unsuccessful it returns an iterator
699 * pointing to the first element that has a greater value than given key
700 * or end() if no such element exists.
703 lower_bound(const key_type& __x)
704 { return _M_t.lower_bound(__x); }
707 * @brief Finds the beginning of a subsequence matching given key.
708 * @param __x Key of (key, value) pair to be located.
709 * @return Read-only (constant) iterator pointing to first element
710 * equal to or greater than key, or end().
712 * This function returns the first element of a subsequence of
713 * elements that matches the given key. If unsuccessful the
714 * iterator will point to the next greatest element or, if no
715 * such greater element exists, to end().
718 lower_bound(const key_type& __x) const
719 { return _M_t.lower_bound(__x); }
722 * @brief Finds the end of a subsequence matching given key.
723 * @param __x Key of (key, value) pair to be located.
724 * @return Iterator pointing to the first element
725 * greater than key, or end().
728 upper_bound(const key_type& __x)
729 { return _M_t.upper_bound(__x); }
732 * @brief Finds the end of a subsequence matching given key.
733 * @param __x Key of (key, value) pair to be located.
734 * @return Read-only (constant) iterator pointing to first iterator
735 * greater than key, or end().
738 upper_bound(const key_type& __x) const
739 { return _M_t.upper_bound(__x); }
742 * @brief Finds a subsequence matching given key.
743 * @param __x Key of (key, value) pairs to be located.
744 * @return Pair of iterators that possibly points to the subsequence
745 * matching given key.
747 * This function is equivalent to
749 * std::make_pair(c.lower_bound(val),
750 * c.upper_bound(val))
752 * (but is faster than making the calls separately).
754 std::pair<iterator, iterator>
755 equal_range(const key_type& __x)
756 { return _M_t.equal_range(__x); }
759 * @brief Finds a subsequence matching given key.
760 * @param __x Key of (key, value) pairs to be located.
761 * @return Pair of read-only (constant) iterators that possibly points
762 * to the subsequence matching given key.
764 * This function is equivalent to
766 * std::make_pair(c.lower_bound(val),
767 * c.upper_bound(val))
769 * (but is faster than making the calls separately).
771 std::pair<const_iterator, const_iterator>
772 equal_range(const key_type& __x) const
773 { return _M_t.equal_range(__x); }
775 template<typename _K1, typename _T1, typename _C1, typename _A1>
777 operator==(const multimap<_K1, _T1, _C1, _A1>&,
778 const multimap<_K1, _T1, _C1, _A1>&);
780 template<typename _K1, typename _T1, typename _C1, typename _A1>
782 operator<(const multimap<_K1, _T1, _C1, _A1>&,
783 const multimap<_K1, _T1, _C1, _A1>&);
787 * @brief Multimap equality comparison.
788 * @param __x A %multimap.
789 * @param __y A %multimap of the same type as @a __x.
790 * @return True iff the size and elements of the maps are equal.
792 * This is an equivalence relation. It is linear in the size of the
793 * multimaps. Multimaps are considered equivalent if their sizes are equal,
794 * and if corresponding elements compare equal.
796 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
798 operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
799 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
800 { return __x._M_t == __y._M_t; }
803 * @brief Multimap ordering relation.
804 * @param __x A %multimap.
805 * @param __y A %multimap of the same type as @a __x.
806 * @return True iff @a x is lexicographically less than @a y.
808 * This is a total ordering relation. It is linear in the size of the
809 * multimaps. The elements must be comparable with @c <.
811 * See std::lexicographical_compare() for how the determination is made.
813 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
815 operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
816 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
817 { return __x._M_t < __y._M_t; }
819 /// Based on operator==
820 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
822 operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
823 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
824 { return !(__x == __y); }
826 /// Based on operator<
827 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
829 operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
830 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
831 { return __y < __x; }
833 /// Based on operator<
834 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
836 operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
837 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
838 { return !(__y < __x); }
840 /// Based on operator<
841 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
843 operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
844 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
845 { return !(__x < __y); }
847 /// See std::multimap::swap().
848 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
850 swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
851 multimap<_Key, _Tp, _Compare, _Alloc>& __y)
854 _GLIBCXX_END_NAMESPACE_CONTAINER
857 #endif /* _STL_MULTIMAP_H */