Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / libstdc++-v3 / include / bits / stl_multimap.h
blob3c8e7d739e776e4c4a33c4dd308278a93d2ab3c6
1 // Multimap implementation -*- C++ -*-
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 // Free Software Foundation, Inc.
5 //
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 2, or (at your option)
10 // any later version.
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 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
33 * Copyright (c) 1994
34 * Hewlett-Packard Company
36 * Permission to use, copy, modify, distribute and sell this software
37 * and its documentation for any purpose is hereby granted without fee,
38 * provided that the above copyright notice appear in all copies and
39 * that both that copyright notice and this permission notice appear
40 * in supporting documentation. Hewlett-Packard Company makes no
41 * representations about the suitability of this software for any
42 * purpose. It is provided "as is" without express or implied warranty.
45 * Copyright (c) 1996,1997
46 * Silicon Graphics Computer Systems, Inc.
48 * Permission to use, copy, modify, distribute and sell this software
49 * and its documentation for any purpose is hereby granted without fee,
50 * provided that the above copyright notice appear in all copies and
51 * that both that copyright notice and this permission notice appear
52 * in supporting documentation. Silicon Graphics makes no
53 * representations about the suitability of this software for any
54 * purpose. It is provided "as is" without express or implied warranty.
57 /** @file stl_multimap.h
58 * This is an internal header file, included by other library headers.
59 * You should not attempt to use it directly.
62 #ifndef _STL_MULTIMAP_H
63 #define _STL_MULTIMAP_H 1
65 #include <bits/concept_check.h>
66 #include <initializer_list>
68 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
70 /**
71 * @brief A standard container made up of (key,value) pairs, which can be
72 * retrieved based on a key, in logarithmic time.
74 * @ingroup associative_containers
76 * Meets the requirements of a <a href="tables.html#65">container</a>, a
77 * <a href="tables.html#66">reversible container</a>, and an
78 * <a href="tables.html#69">associative container</a> (using equivalent
79 * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type
80 * is T, and the value_type is std::pair<const Key,T>.
82 * Multimaps support bidirectional iterators.
84 * The private tree data is declared exactly the same way for map and
85 * multimap; the distinction is made entirely in how the tree functions are
86 * called (*_unique versus *_equal, same as the standard).
88 template <typename _Key, typename _Tp,
89 typename _Compare = std::less<_Key>,
90 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
91 class multimap
93 public:
94 typedef _Key key_type;
95 typedef _Tp mapped_type;
96 typedef std::pair<const _Key, _Tp> value_type;
97 typedef _Compare key_compare;
98 typedef _Alloc allocator_type;
100 private:
101 // concept requirements
102 typedef typename _Alloc::value_type _Alloc_value_type;
103 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
104 __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
105 _BinaryFunctionConcept)
106 __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
108 public:
109 class value_compare
110 : public std::binary_function<value_type, value_type, bool>
112 friend class multimap<_Key, _Tp, _Compare, _Alloc>;
113 protected:
114 _Compare comp;
116 value_compare(_Compare __c)
117 : comp(__c) { }
119 public:
120 bool operator()(const value_type& __x, const value_type& __y) const
121 { return comp(__x.first, __y.first); }
124 private:
125 /// This turns a red-black tree into a [multi]map.
126 typedef typename _Alloc::template rebind<value_type>::other
127 _Pair_alloc_type;
129 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
130 key_compare, _Pair_alloc_type> _Rep_type;
131 /// The actual tree structure.
132 _Rep_type _M_t;
134 public:
135 // many of these are specified differently in ISO, but the following are
136 // "functionally equivalent"
137 typedef typename _Pair_alloc_type::pointer pointer;
138 typedef typename _Pair_alloc_type::const_pointer const_pointer;
139 typedef typename _Pair_alloc_type::reference reference;
140 typedef typename _Pair_alloc_type::const_reference const_reference;
141 typedef typename _Rep_type::iterator iterator;
142 typedef typename _Rep_type::const_iterator const_iterator;
143 typedef typename _Rep_type::size_type size_type;
144 typedef typename _Rep_type::difference_type difference_type;
145 typedef typename _Rep_type::reverse_iterator reverse_iterator;
146 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
148 // [23.3.2] construct/copy/destroy
149 // (get_allocator() is also listed in this section)
151 * @brief Default constructor creates no elements.
153 multimap()
154 : _M_t() { }
157 * @brief Creates a %multimap with no elements.
158 * @param comp A comparison object.
159 * @param a An allocator object.
161 explicit
162 multimap(const _Compare& __comp,
163 const allocator_type& __a = allocator_type())
164 : _M_t(__comp, __a) { }
167 * @brief %Multimap copy constructor.
168 * @param x A %multimap of identical element and allocator types.
170 * The newly-created %multimap uses a copy of the allocation object
171 * used by @a x.
173 multimap(const multimap& __x)
174 : _M_t(__x._M_t) { }
176 #ifdef __GXX_EXPERIMENTAL_CXX0X__
178 * @brief %Multimap move constructor.
179 * @param x A %multimap of identical element and allocator types.
181 * The newly-created %multimap contains the exact contents of @a x.
182 * The contents of @a x are a valid, but unspecified %multimap.
184 multimap(multimap&& __x)
185 : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
188 * @brief Builds a %multimap from an initializer_list.
189 * @param l An initializer_list.
190 * @param comp A comparison functor.
191 * @param a An allocator object.
193 * Create a %multimap consisting of copies of the elements from
194 * the initializer_list. This is linear in N if the list is already
195 * sorted, and NlogN otherwise (where N is @a __l.size()).
197 multimap(initializer_list<value_type> __l,
198 const _Compare& __comp = _Compare(),
199 const allocator_type& __a = allocator_type())
200 : _M_t(__comp, __a)
201 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
202 #endif
205 * @brief Builds a %multimap from a range.
206 * @param first An input iterator.
207 * @param last An input iterator.
209 * Create a %multimap consisting of copies of the elements from
210 * [first,last). This is linear in N if the range is already sorted,
211 * and NlogN otherwise (where N is distance(first,last)).
213 template<typename _InputIterator>
214 multimap(_InputIterator __first, _InputIterator __last)
215 : _M_t()
216 { _M_t._M_insert_equal(__first, __last); }
219 * @brief Builds a %multimap from a range.
220 * @param first An input iterator.
221 * @param last An input iterator.
222 * @param comp A comparison functor.
223 * @param a An allocator object.
225 * Create a %multimap consisting of copies of the elements from
226 * [first,last). This is linear in N if the range is already sorted,
227 * and NlogN otherwise (where N is distance(first,last)).
229 template<typename _InputIterator>
230 multimap(_InputIterator __first, _InputIterator __last,
231 const _Compare& __comp,
232 const allocator_type& __a = allocator_type())
233 : _M_t(__comp, __a)
234 { _M_t._M_insert_equal(__first, __last); }
236 // FIXME There is no dtor declared, but we should have something generated
237 // by Doxygen. I don't know what tags to add to this paragraph to make
238 // that happen:
240 * The dtor only erases the elements, and note that if the elements
241 * themselves are pointers, the pointed-to memory is not touched in any
242 * way. Managing the pointer is the user's responsibility.
246 * @brief %Multimap assignment operator.
247 * @param x A %multimap of identical element and allocator types.
249 * All the elements of @a x are copied, but unlike the copy constructor,
250 * the allocator object is not copied.
252 multimap&
253 operator=(const multimap& __x)
255 _M_t = __x._M_t;
256 return *this;
259 #ifdef __GXX_EXPERIMENTAL_CXX0X__
261 * @brief %Multimap move assignment operator.
262 * @param x A %multimap of identical element and allocator types.
264 * The contents of @a x are moved into this multimap (without copying).
265 * @a x is a valid, but unspecified multimap.
267 multimap&
268 operator=(multimap&& __x)
270 // NB: DR 675.
271 this->clear();
272 this->swap(__x);
273 return *this;
277 * @brief %Multimap list assignment operator.
278 * @param l An initializer_list.
280 * This function fills a %multimap with copies of the elements
281 * in the initializer list @a l.
283 * Note that the assignment completely changes the %multimap and
284 * that the resulting %multimap's size is the same as the number
285 * of elements assigned. Old data may be lost.
287 multimap&
288 operator=(initializer_list<value_type> __l)
290 this->clear();
291 this->insert(__l.begin(), __l.end());
292 return *this;
294 #endif
296 /// Get a copy of the memory allocation object.
297 allocator_type
298 get_allocator() const
299 { return _M_t.get_allocator(); }
301 // iterators
303 * Returns a read/write iterator that points to the first pair in the
304 * %multimap. Iteration is done in ascending order according to the
305 * keys.
307 iterator
308 begin()
309 { return _M_t.begin(); }
312 * Returns a read-only (constant) iterator that points to the first pair
313 * in the %multimap. Iteration is done in ascending order according to
314 * the keys.
316 const_iterator
317 begin() const
318 { return _M_t.begin(); }
321 * Returns a read/write iterator that points one past the last pair in
322 * the %multimap. Iteration is done in ascending order according to the
323 * keys.
325 iterator
326 end()
327 { return _M_t.end(); }
330 * Returns a read-only (constant) iterator that points one past the last
331 * pair in the %multimap. Iteration is done in ascending order according
332 * to the keys.
334 const_iterator
335 end() const
336 { return _M_t.end(); }
339 * Returns a read/write reverse iterator that points to the last pair in
340 * the %multimap. Iteration is done in descending order according to the
341 * keys.
343 reverse_iterator
344 rbegin()
345 { return _M_t.rbegin(); }
348 * Returns a read-only (constant) reverse iterator that points to the
349 * last pair in the %multimap. Iteration is done in descending order
350 * according to the keys.
352 const_reverse_iterator
353 rbegin() const
354 { return _M_t.rbegin(); }
357 * Returns a read/write reverse iterator that points to one before the
358 * first pair in the %multimap. Iteration is done in descending order
359 * according to the keys.
361 reverse_iterator
362 rend()
363 { return _M_t.rend(); }
366 * Returns a read-only (constant) reverse iterator that points to one
367 * before the first pair in the %multimap. Iteration is done in
368 * descending order according to the keys.
370 const_reverse_iterator
371 rend() const
372 { return _M_t.rend(); }
374 #ifdef __GXX_EXPERIMENTAL_CXX0X__
376 * Returns a read-only (constant) iterator that points to the first pair
377 * in the %multimap. Iteration is done in ascending order according to
378 * the keys.
380 const_iterator
381 cbegin() const
382 { return _M_t.begin(); }
385 * Returns a read-only (constant) iterator that points one past the last
386 * pair in the %multimap. Iteration is done in ascending order according
387 * to the keys.
389 const_iterator
390 cend() const
391 { return _M_t.end(); }
394 * Returns a read-only (constant) reverse iterator that points to the
395 * last pair in the %multimap. Iteration is done in descending order
396 * according to the keys.
398 const_reverse_iterator
399 crbegin() const
400 { return _M_t.rbegin(); }
403 * Returns a read-only (constant) reverse iterator that points to one
404 * before the first pair in the %multimap. Iteration is done in
405 * descending order according to the keys.
407 const_reverse_iterator
408 crend() const
409 { return _M_t.rend(); }
410 #endif
412 // capacity
413 /** Returns true if the %multimap is empty. */
414 bool
415 empty() const
416 { return _M_t.empty(); }
418 /** Returns the size of the %multimap. */
419 size_type
420 size() const
421 { return _M_t.size(); }
423 /** Returns the maximum size of the %multimap. */
424 size_type
425 max_size() const
426 { return _M_t.max_size(); }
428 // modifiers
430 * @brief Inserts a std::pair into the %multimap.
431 * @param x Pair to be inserted (see std::make_pair for easy creation
432 * of pairs).
433 * @return An iterator that points to the inserted (key,value) pair.
435 * This function inserts a (key, value) pair into the %multimap.
436 * Contrary to a std::map the %multimap does not rely on unique keys and
437 * thus multiple pairs with the same key can be inserted.
439 * Insertion requires logarithmic time.
441 iterator
442 insert(const value_type& __x)
443 { return _M_t._M_insert_equal(__x); }
446 * @brief Inserts a std::pair into the %multimap.
447 * @param position An iterator that serves as a hint as to where the
448 * pair should be inserted.
449 * @param x Pair to be inserted (see std::make_pair for easy creation
450 * of pairs).
451 * @return An iterator that points to the inserted (key,value) pair.
453 * This function inserts a (key, value) pair into the %multimap.
454 * Contrary to a std::map the %multimap does not rely on unique keys and
455 * thus multiple pairs with the same key can be inserted.
456 * Note that the first parameter is only a hint and can potentially
457 * improve the performance of the insertion process. A bad hint would
458 * cause no gains in efficiency.
460 * For more on "hinting," see:
461 * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
463 * Insertion requires logarithmic time (if the hint is not taken).
465 iterator
466 insert(iterator __position, const value_type& __x)
467 { return _M_t._M_insert_equal_(__position, __x); }
470 * @brief A template function that attempts to insert a range
471 * of elements.
472 * @param first Iterator pointing to the start of the range to be
473 * inserted.
474 * @param last Iterator pointing to the end of the range.
476 * Complexity similar to that of the range constructor.
478 template<typename _InputIterator>
479 void
480 insert(_InputIterator __first, _InputIterator __last)
481 { _M_t._M_insert_equal(__first, __last); }
483 #ifdef __GXX_EXPERIMENTAL_CXX0X__
485 * @brief Attempts to insert a list of std::pairs into the %multimap.
486 * @param list A std::initializer_list<value_type> of pairs to be
487 * inserted.
489 * Complexity similar to that of the range constructor.
491 void
492 insert(initializer_list<value_type> __l)
493 { this->insert(__l.begin(), __l.end()); }
494 #endif
497 * @brief Erases an element from a %multimap.
498 * @param position An iterator pointing to the element to be erased.
500 * This function erases an element, pointed to by the given iterator,
501 * from a %multimap. Note that this function only erases the element,
502 * and that if the element is itself a pointer, the pointed-to memory is
503 * not touched in any way. Managing the pointer is the user's
504 * responsibility.
506 void
507 erase(iterator __position)
508 { _M_t.erase(__position); }
511 * @brief Erases elements according to the provided key.
512 * @param x Key of element to be erased.
513 * @return The number of elements erased.
515 * This function erases all elements located by the given key from a
516 * %multimap.
517 * Note that this function only erases the element, and that if
518 * the element is itself a pointer, the pointed-to memory is not touched
519 * in any way. Managing the pointer is the user's responsibility.
521 size_type
522 erase(const key_type& __x)
523 { return _M_t.erase(__x); }
526 * @brief Erases a [first,last) range of elements from a %multimap.
527 * @param first Iterator pointing to the start of the range to be
528 * erased.
529 * @param last Iterator pointing to the end of the range to be erased.
531 * This function erases a sequence of elements from a %multimap.
532 * Note that this function only erases the elements, and that if
533 * the elements themselves are pointers, the pointed-to memory is not
534 * touched in any way. Managing the pointer is the user's responsibility.
536 void
537 erase(iterator __first, iterator __last)
538 { _M_t.erase(__first, __last); }
541 * @brief Swaps data with another %multimap.
542 * @param x A %multimap of the same element and allocator types.
544 * This exchanges the elements between two multimaps in constant time.
545 * (It is only swapping a pointer, an integer, and an instance of
546 * the @c Compare type (which itself is often stateless and empty), so it
547 * should be quite fast.)
548 * Note that the global std::swap() function is specialized such that
549 * std::swap(m1,m2) will feed to this function.
551 void
552 #ifdef __GXX_EXPERIMENTAL_CXX0X__
553 swap(multimap&& __x)
554 #else
555 swap(multimap& __x)
556 #endif
557 { _M_t.swap(__x._M_t); }
560 * Erases all elements in a %multimap. Note that this function only
561 * erases the elements, and that if the elements themselves are pointers,
562 * the pointed-to memory is not touched in any way. Managing the pointer
563 * is the user's responsibility.
565 void
566 clear()
567 { _M_t.clear(); }
569 // observers
571 * Returns the key comparison object out of which the %multimap
572 * was constructed.
574 key_compare
575 key_comp() const
576 { return _M_t.key_comp(); }
579 * Returns a value comparison object, built from the key comparison
580 * object out of which the %multimap was constructed.
582 value_compare
583 value_comp() const
584 { return value_compare(_M_t.key_comp()); }
586 // multimap operations
588 * @brief Tries to locate an element in a %multimap.
589 * @param x Key of (key, value) pair to be located.
590 * @return Iterator pointing to sought-after element,
591 * or end() if not found.
593 * This function takes a key and tries to locate the element with which
594 * the key matches. If successful the function returns an iterator
595 * pointing to the sought after %pair. If unsuccessful it returns the
596 * past-the-end ( @c end() ) iterator.
598 iterator
599 find(const key_type& __x)
600 { return _M_t.find(__x); }
603 * @brief Tries to locate an element in a %multimap.
604 * @param x Key of (key, value) pair to be located.
605 * @return Read-only (constant) iterator pointing to sought-after
606 * element, or end() if not found.
608 * This function takes a key and tries to locate the element with which
609 * the key matches. If successful the function returns a constant
610 * iterator pointing to the sought after %pair. If unsuccessful it
611 * returns the past-the-end ( @c end() ) iterator.
613 const_iterator
614 find(const key_type& __x) const
615 { return _M_t.find(__x); }
618 * @brief Finds the number of elements with given key.
619 * @param x Key of (key, value) pairs to be located.
620 * @return Number of elements with specified key.
622 size_type
623 count(const key_type& __x) const
624 { return _M_t.count(__x); }
627 * @brief Finds the beginning of a subsequence matching given key.
628 * @param x Key of (key, value) pair to be located.
629 * @return Iterator pointing to first element equal to or greater
630 * than key, or end().
632 * This function returns the first element of a subsequence of elements
633 * that matches the given key. If unsuccessful it returns an iterator
634 * pointing to the first element that has a greater value than given key
635 * or end() if no such element exists.
637 iterator
638 lower_bound(const key_type& __x)
639 { return _M_t.lower_bound(__x); }
642 * @brief Finds the beginning of a subsequence matching given key.
643 * @param x Key of (key, value) pair to be located.
644 * @return Read-only (constant) iterator pointing to first element
645 * equal to or greater than key, or end().
647 * This function returns the first element of a subsequence of elements
648 * that matches the given key. If unsuccessful the iterator will point
649 * to the next greatest element or, if no such greater element exists, to
650 * end().
652 const_iterator
653 lower_bound(const key_type& __x) const
654 { return _M_t.lower_bound(__x); }
657 * @brief Finds the end of a subsequence matching given key.
658 * @param x Key of (key, value) pair to be located.
659 * @return Iterator pointing to the first element
660 * greater than key, or end().
662 iterator
663 upper_bound(const key_type& __x)
664 { return _M_t.upper_bound(__x); }
667 * @brief Finds the end of a subsequence matching given key.
668 * @param x Key of (key, value) pair to be located.
669 * @return Read-only (constant) iterator pointing to first iterator
670 * greater than key, or end().
672 const_iterator
673 upper_bound(const key_type& __x) const
674 { return _M_t.upper_bound(__x); }
677 * @brief Finds a subsequence matching given key.
678 * @param x Key of (key, value) pairs to be located.
679 * @return Pair of iterators that possibly points to the subsequence
680 * matching given key.
682 * This function is equivalent to
683 * @code
684 * std::make_pair(c.lower_bound(val),
685 * c.upper_bound(val))
686 * @endcode
687 * (but is faster than making the calls separately).
689 std::pair<iterator, iterator>
690 equal_range(const key_type& __x)
691 { return _M_t.equal_range(__x); }
694 * @brief Finds a subsequence matching given key.
695 * @param x Key of (key, value) pairs to be located.
696 * @return Pair of read-only (constant) iterators that possibly points
697 * to the subsequence matching given key.
699 * This function is equivalent to
700 * @code
701 * std::make_pair(c.lower_bound(val),
702 * c.upper_bound(val))
703 * @endcode
704 * (but is faster than making the calls separately).
706 std::pair<const_iterator, const_iterator>
707 equal_range(const key_type& __x) const
708 { return _M_t.equal_range(__x); }
710 template<typename _K1, typename _T1, typename _C1, typename _A1>
711 friend bool
712 operator==(const multimap<_K1, _T1, _C1, _A1>&,
713 const multimap<_K1, _T1, _C1, _A1>&);
715 template<typename _K1, typename _T1, typename _C1, typename _A1>
716 friend bool
717 operator<(const multimap<_K1, _T1, _C1, _A1>&,
718 const multimap<_K1, _T1, _C1, _A1>&);
722 * @brief Multimap equality comparison.
723 * @param x A %multimap.
724 * @param y A %multimap of the same type as @a x.
725 * @return True iff the size and elements of the maps are equal.
727 * This is an equivalence relation. It is linear in the size of the
728 * multimaps. Multimaps are considered equivalent if their sizes are equal,
729 * and if corresponding elements compare equal.
731 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
732 inline bool
733 operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
734 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
735 { return __x._M_t == __y._M_t; }
738 * @brief Multimap ordering relation.
739 * @param x A %multimap.
740 * @param y A %multimap of the same type as @a x.
741 * @return True iff @a x is lexicographically less than @a y.
743 * This is a total ordering relation. It is linear in the size of the
744 * multimaps. The elements must be comparable with @c <.
746 * See std::lexicographical_compare() for how the determination is made.
748 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
749 inline bool
750 operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
751 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
752 { return __x._M_t < __y._M_t; }
754 /// Based on operator==
755 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
756 inline bool
757 operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
758 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
759 { return !(__x == __y); }
761 /// Based on operator<
762 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
763 inline bool
764 operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
765 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
766 { return __y < __x; }
768 /// Based on operator<
769 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
770 inline bool
771 operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
772 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
773 { return !(__y < __x); }
775 /// Based on operator<
776 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
777 inline bool
778 operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
779 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
780 { return !(__x < __y); }
782 /// See std::multimap::swap().
783 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
784 inline void
785 swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
786 multimap<_Key, _Tp, _Compare, _Alloc>& __y)
787 { __x.swap(__y); }
789 #ifdef __GXX_EXPERIMENTAL_CXX0X__
790 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
791 inline void
792 swap(multimap<_Key, _Tp, _Compare, _Alloc>&& __x,
793 multimap<_Key, _Tp, _Compare, _Alloc>& __y)
794 { __x.swap(__y); }
796 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
797 inline void
798 swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
799 multimap<_Key, _Tp, _Compare, _Alloc>&& __y)
800 { __x.swap(__y); }
801 #endif
803 _GLIBCXX_END_NESTED_NAMESPACE
805 #endif /* _STL_MULTIMAP_H */