]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/bits/stl_multiset.h
Makefile.am (install-freestanding-headers): Install c++0x_warning.h.
[thirdparty/gcc.git] / libstdc++-v3 / include / bits / stl_multiset.h
1 // Multiset implementation -*- C++ -*-
2
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
4 // 2011 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 3, or (at your option)
10 // any later version.
11
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.
16
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.
20
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/>.
25
26 /*
27 *
28 * Copyright (c) 1994
29 * Hewlett-Packard Company
30 *
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.
38 *
39 *
40 * Copyright (c) 1996
41 * Silicon Graphics Computer Systems, Inc.
42 *
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.
50 */
51
52 /** @file bits/stl_multiset.h
53 * This is an internal header file, included by other library headers.
54 * Do not attempt to use it directly. @headername{set}
55 */
56
57 #ifndef _STL_MULTISET_H
58 #define _STL_MULTISET_H 1
59
60 #include <bits/concept_check.h>
61 #ifdef __GXX_EXPERIMENTAL_CXX0X__
62 #include <initializer_list>
63 #endif
64
65 namespace std _GLIBCXX_VISIBILITY(default)
66 {
67 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
68
69 /**
70 * @brief A standard container made up of elements, which can be retrieved
71 * in logarithmic time.
72 *
73 * @ingroup associative_containers
74 *
75 * Meets the requirements of a <a href="tables.html#65">container</a>, a
76 * <a href="tables.html#66">reversible container</a>, and an
77 * <a href="tables.html#69">associative container</a> (using equivalent
78 * keys). For a @c multiset<Key> the key_type and value_type are Key.
79 *
80 * Multisets support bidirectional iterators.
81 *
82 * The private tree data is declared exactly the same way for set and
83 * multiset; the distinction is made entirely in how the tree functions are
84 * called (*_unique versus *_equal, same as the standard).
85 */
86 template <typename _Key, typename _Compare = std::less<_Key>,
87 typename _Alloc = std::allocator<_Key> >
88 class multiset
89 {
90 // concept requirements
91 typedef typename _Alloc::value_type _Alloc_value_type;
92 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
93 __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
94 _BinaryFunctionConcept)
95 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
96
97 public:
98 // typedefs:
99 typedef _Key key_type;
100 typedef _Key value_type;
101 typedef _Compare key_compare;
102 typedef _Compare value_compare;
103 typedef _Alloc allocator_type;
104
105 private:
106 /// This turns a red-black tree into a [multi]set.
107 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
108
109 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
110 key_compare, _Key_alloc_type> _Rep_type;
111 /// The actual tree structure.
112 _Rep_type _M_t;
113
114 public:
115 typedef typename _Key_alloc_type::pointer pointer;
116 typedef typename _Key_alloc_type::const_pointer const_pointer;
117 typedef typename _Key_alloc_type::reference reference;
118 typedef typename _Key_alloc_type::const_reference const_reference;
119 // _GLIBCXX_RESOLVE_LIB_DEFECTS
120 // DR 103. set::iterator is required to be modifiable,
121 // but this allows modification of keys.
122 typedef typename _Rep_type::const_iterator iterator;
123 typedef typename _Rep_type::const_iterator const_iterator;
124 typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
125 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
126 typedef typename _Rep_type::size_type size_type;
127 typedef typename _Rep_type::difference_type difference_type;
128
129 // allocation/deallocation
130 /**
131 * @brief Default constructor creates no elements.
132 */
133 multiset()
134 : _M_t() { }
135
136 /**
137 * @brief Creates a %multiset with no elements.
138 * @param __comp Comparator to use.
139 * @param __a An allocator object.
140 */
141 explicit
142 multiset(const _Compare& __comp,
143 const allocator_type& __a = allocator_type())
144 : _M_t(__comp, _Key_alloc_type(__a)) { }
145
146 /**
147 * @brief Builds a %multiset from a range.
148 * @param __first An input iterator.
149 * @param __last An input iterator.
150 *
151 * Create a %multiset consisting of copies of the elements from
152 * [first,last). This is linear in N if the range is already sorted,
153 * and NlogN otherwise (where N is distance(__first,__last)).
154 */
155 template<typename _InputIterator>
156 multiset(_InputIterator __first, _InputIterator __last)
157 : _M_t()
158 { _M_t._M_insert_equal(__first, __last); }
159
160 /**
161 * @brief Builds a %multiset from a range.
162 * @param __first An input iterator.
163 * @param __last An input iterator.
164 * @param __comp A comparison functor.
165 * @param __a An allocator object.
166 *
167 * Create a %multiset consisting of copies of the elements from
168 * [__first,__last). This is linear in N if the range is already sorted,
169 * and NlogN otherwise (where N is distance(__first,__last)).
170 */
171 template<typename _InputIterator>
172 multiset(_InputIterator __first, _InputIterator __last,
173 const _Compare& __comp,
174 const allocator_type& __a = allocator_type())
175 : _M_t(__comp, _Key_alloc_type(__a))
176 { _M_t._M_insert_equal(__first, __last); }
177
178 /**
179 * @brief %Multiset copy constructor.
180 * @param __x A %multiset of identical element and allocator types.
181 *
182 * The newly-created %multiset uses a copy of the allocation object used
183 * by @a __x.
184 */
185 multiset(const multiset& __x)
186 : _M_t(__x._M_t) { }
187
188 #ifdef __GXX_EXPERIMENTAL_CXX0X__
189 /**
190 * @brief %Multiset move constructor.
191 * @param __x A %multiset of identical element and allocator types.
192 *
193 * The newly-created %multiset contains the exact contents of @a __x.
194 * The contents of @a __x are a valid, but unspecified %multiset.
195 */
196 multiset(multiset&& __x)
197 noexcept(is_nothrow_copy_constructible<_Compare>::value)
198 : _M_t(std::move(__x._M_t)) { }
199
200 /**
201 * @brief Builds a %multiset from an initializer_list.
202 * @param __l An initializer_list.
203 * @param __comp A comparison functor.
204 * @param __a An allocator object.
205 *
206 * Create a %multiset consisting of copies of the elements from
207 * the list. This is linear in N if the list is already sorted,
208 * and NlogN otherwise (where N is @a __l.size()).
209 */
210 multiset(initializer_list<value_type> __l,
211 const _Compare& __comp = _Compare(),
212 const allocator_type& __a = allocator_type())
213 : _M_t(__comp, _Key_alloc_type(__a))
214 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
215 #endif
216
217 /**
218 * @brief %Multiset assignment operator.
219 * @param __x A %multiset of identical element and allocator types.
220 *
221 * All the elements of @a __x are copied, but unlike the copy
222 * constructor, the allocator object is not copied.
223 */
224 multiset&
225 operator=(const multiset& __x)
226 {
227 _M_t = __x._M_t;
228 return *this;
229 }
230
231 #ifdef __GXX_EXPERIMENTAL_CXX0X__
232 /**
233 * @brief %Multiset move assignment operator.
234 * @param __x A %multiset of identical element and allocator types.
235 *
236 * The contents of @a __x are moved into this %multiset
237 * (without copying). @a __x is a valid, but unspecified
238 * %multiset.
239 */
240 multiset&
241 operator=(multiset&& __x)
242 {
243 // NB: DR 1204.
244 // NB: DR 675.
245 this->clear();
246 this->swap(__x);
247 return *this;
248 }
249
250 /**
251 * @brief %Multiset list assignment operator.
252 * @param __l An initializer_list.
253 *
254 * This function fills a %multiset with copies of the elements in the
255 * initializer list @a __l.
256 *
257 * Note that the assignment completely changes the %multiset and
258 * that the resulting %multiset's size is the same as the number
259 * of elements assigned. Old data may be lost.
260 */
261 multiset&
262 operator=(initializer_list<value_type> __l)
263 {
264 this->clear();
265 this->insert(__l.begin(), __l.end());
266 return *this;
267 }
268 #endif
269
270 // accessors:
271
272 /// Returns the comparison object.
273 key_compare
274 key_comp() const
275 { return _M_t.key_comp(); }
276 /// Returns the comparison object.
277 value_compare
278 value_comp() const
279 { return _M_t.key_comp(); }
280 /// Returns the memory allocation object.
281 allocator_type
282 get_allocator() const _GLIBCXX_NOEXCEPT
283 { return allocator_type(_M_t.get_allocator()); }
284
285 /**
286 * Returns a read-only (constant) iterator that points to the first
287 * element in the %multiset. Iteration is done in ascending order
288 * according to the keys.
289 */
290 iterator
291 begin() const _GLIBCXX_NOEXCEPT
292 { return _M_t.begin(); }
293
294 /**
295 * Returns a read-only (constant) iterator that points one past the last
296 * element in the %multiset. Iteration is done in ascending order
297 * according to the keys.
298 */
299 iterator
300 end() const _GLIBCXX_NOEXCEPT
301 { return _M_t.end(); }
302
303 /**
304 * Returns a read-only (constant) reverse iterator that points to the
305 * last element in the %multiset. Iteration is done in descending order
306 * according to the keys.
307 */
308 reverse_iterator
309 rbegin() const _GLIBCXX_NOEXCEPT
310 { return _M_t.rbegin(); }
311
312 /**
313 * Returns a read-only (constant) reverse iterator that points to the
314 * last element in the %multiset. Iteration is done in descending order
315 * according to the keys.
316 */
317 reverse_iterator
318 rend() const _GLIBCXX_NOEXCEPT
319 { return _M_t.rend(); }
320
321 #ifdef __GXX_EXPERIMENTAL_CXX0X__
322 /**
323 * Returns a read-only (constant) iterator that points to the first
324 * element in the %multiset. Iteration is done in ascending order
325 * according to the keys.
326 */
327 iterator
328 cbegin() const noexcept
329 { return _M_t.begin(); }
330
331 /**
332 * Returns a read-only (constant) iterator that points one past the last
333 * element in the %multiset. Iteration is done in ascending order
334 * according to the keys.
335 */
336 iterator
337 cend() const noexcept
338 { return _M_t.end(); }
339
340 /**
341 * Returns a read-only (constant) reverse iterator that points to the
342 * last element in the %multiset. Iteration is done in descending order
343 * according to the keys.
344 */
345 reverse_iterator
346 crbegin() const noexcept
347 { return _M_t.rbegin(); }
348
349 /**
350 * Returns a read-only (constant) reverse iterator that points to the
351 * last element in the %multiset. Iteration is done in descending order
352 * according to the keys.
353 */
354 reverse_iterator
355 crend() const noexcept
356 { return _M_t.rend(); }
357 #endif
358
359 /// Returns true if the %set is empty.
360 bool
361 empty() const _GLIBCXX_NOEXCEPT
362 { return _M_t.empty(); }
363
364 /// Returns the size of the %set.
365 size_type
366 size() const _GLIBCXX_NOEXCEPT
367 { return _M_t.size(); }
368
369 /// Returns the maximum size of the %set.
370 size_type
371 max_size() const _GLIBCXX_NOEXCEPT
372 { return _M_t.max_size(); }
373
374 /**
375 * @brief Swaps data with another %multiset.
376 * @param __x A %multiset of the same element and allocator types.
377 *
378 * This exchanges the elements between two multisets in constant time.
379 * (It is only swapping a pointer, an integer, and an instance of the @c
380 * Compare type (which itself is often stateless and empty), so it should
381 * be quite fast.)
382 * Note that the global std::swap() function is specialized such that
383 * std::swap(s1,s2) will feed to this function.
384 */
385 void
386 swap(multiset& __x)
387 { _M_t.swap(__x._M_t); }
388
389 // insert/erase
390 /**
391 * @brief Inserts an element into the %multiset.
392 * @param __x Element to be inserted.
393 * @return An iterator that points to the inserted element.
394 *
395 * This function inserts an element into the %multiset. Contrary
396 * to a std::set the %multiset does not rely on unique keys and thus
397 * multiple copies of the same element can be inserted.
398 *
399 * Insertion requires logarithmic time.
400 */
401 iterator
402 insert(const value_type& __x)
403 { return _M_t._M_insert_equal(__x); }
404
405 #ifdef __GXX_EXPERIMENTAL_CXX0X__
406 iterator
407 insert(value_type&& __x)
408 { return _M_t._M_insert_equal(std::move(__x)); }
409 #endif
410
411 /**
412 * @brief Inserts an element into the %multiset.
413 * @param __position An iterator that serves as a hint as to where the
414 * element should be inserted.
415 * @param __x Element to be inserted.
416 * @return An iterator that points to the inserted element.
417 *
418 * This function inserts an element into the %multiset. Contrary
419 * to a std::set the %multiset does not rely on unique keys and thus
420 * multiple copies of the same element can be inserted.
421 *
422 * Note that the first parameter is only a hint and can potentially
423 * improve the performance of the insertion process. A bad hint would
424 * cause no gains in efficiency.
425 *
426 * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
427 * for more on @a hinting.
428 *
429 * Insertion requires logarithmic time (if the hint is not taken).
430 */
431 iterator
432 insert(const_iterator __position, const value_type& __x)
433 { return _M_t._M_insert_equal_(__position, __x); }
434
435 #ifdef __GXX_EXPERIMENTAL_CXX0X__
436 iterator
437 insert(const_iterator __position, value_type&& __x)
438 { return _M_t._M_insert_equal_(__position, std::move(__x)); }
439 #endif
440
441 /**
442 * @brief A template function that tries to insert a range of elements.
443 * @param __first Iterator pointing to the start of the range to be
444 * inserted.
445 * @param __last Iterator pointing to the end of the range.
446 *
447 * Complexity similar to that of the range constructor.
448 */
449 template<typename _InputIterator>
450 void
451 insert(_InputIterator __first, _InputIterator __last)
452 { _M_t._M_insert_equal(__first, __last); }
453
454 #ifdef __GXX_EXPERIMENTAL_CXX0X__
455 /**
456 * @brief Attempts to insert a list of elements into the %multiset.
457 * @param __l A std::initializer_list<value_type> of elements
458 * to be inserted.
459 *
460 * Complexity similar to that of the range constructor.
461 */
462 void
463 insert(initializer_list<value_type> __l)
464 { this->insert(__l.begin(), __l.end()); }
465 #endif
466
467 #ifdef __GXX_EXPERIMENTAL_CXX0X__
468 // _GLIBCXX_RESOLVE_LIB_DEFECTS
469 // DR 130. Associative erase should return an iterator.
470 /**
471 * @brief Erases an element from a %multiset.
472 * @param __position An iterator pointing to the element to be erased.
473 * @return An iterator pointing to the element immediately following
474 * @a position prior to the element being erased. If no such
475 * element exists, end() is returned.
476 *
477 * This function erases an element, pointed to by the given iterator,
478 * from a %multiset. Note that this function only erases the element,
479 * and that if the element is itself a pointer, the pointed-to memory is
480 * not touched in any way. Managing the pointer is the user's
481 * responsibility.
482 */
483 iterator
484 erase(const_iterator __position)
485 { return _M_t.erase(__position); }
486 #else
487 /**
488 * @brief Erases an element from a %multiset.
489 * @param __position An iterator pointing to the element to be erased.
490 *
491 * This function erases an element, pointed to by the given iterator,
492 * from a %multiset. Note that this function only erases the element,
493 * and that if the element is itself a pointer, the pointed-to memory is
494 * not touched in any way. Managing the pointer is the user's
495 * responsibility.
496 */
497 void
498 erase(iterator __position)
499 { _M_t.erase(__position); }
500 #endif
501
502 /**
503 * @brief Erases elements according to the provided key.
504 * @param __x Key of element to be erased.
505 * @return The number of elements erased.
506 *
507 * This function erases all elements located by the given key from a
508 * %multiset.
509 * Note that this function only erases the element, and that if
510 * the element is itself a pointer, the pointed-to memory is not touched
511 * in any way. Managing the pointer is the user's responsibility.
512 */
513 size_type
514 erase(const key_type& __x)
515 { return _M_t.erase(__x); }
516
517 #ifdef __GXX_EXPERIMENTAL_CXX0X__
518 // _GLIBCXX_RESOLVE_LIB_DEFECTS
519 // DR 130. Associative erase should return an iterator.
520 /**
521 * @brief Erases a [first,last) range of elements from a %multiset.
522 * @param __first Iterator pointing to the start of the range to be
523 * erased.
524 * @param __last Iterator pointing to the end of the range to
525 * be erased.
526 * @return The iterator @a last.
527 *
528 * This function erases a sequence of elements from a %multiset.
529 * Note that this function only erases the elements, and that if
530 * the elements themselves are pointers, the pointed-to memory is not
531 * touched in any way. Managing the pointer is the user's
532 * responsibility.
533 */
534 iterator
535 erase(const_iterator __first, const_iterator __last)
536 { return _M_t.erase(__first, __last); }
537 #else
538 /**
539 * @brief Erases a [first,last) range of elements from a %multiset.
540 * @param first Iterator pointing to the start of the range to be
541 * erased.
542 * @param last Iterator pointing to the end of the range to be erased.
543 *
544 * This function erases a sequence of elements from a %multiset.
545 * Note that this function only erases the elements, and that if
546 * the elements themselves are pointers, the pointed-to memory is not
547 * touched in any way. Managing the pointer is the user's
548 * responsibility.
549 */
550 void
551 erase(iterator __first, iterator __last)
552 { _M_t.erase(__first, __last); }
553 #endif
554
555 /**
556 * Erases all elements in a %multiset. Note that this function only
557 * erases the elements, and that if the elements themselves are pointers,
558 * the pointed-to memory is not touched in any way. Managing the pointer
559 * is the user's responsibility.
560 */
561 void
562 clear() _GLIBCXX_NOEXCEPT
563 { _M_t.clear(); }
564
565 // multiset operations:
566
567 /**
568 * @brief Finds the number of elements with given key.
569 * @param __x Key of elements to be located.
570 * @return Number of elements with specified key.
571 */
572 size_type
573 count(const key_type& __x) const
574 { return _M_t.count(__x); }
575
576 // _GLIBCXX_RESOLVE_LIB_DEFECTS
577 // 214. set::find() missing const overload
578 //@{
579 /**
580 * @brief Tries to locate an element in a %set.
581 * @param __x Element to be located.
582 * @return Iterator pointing to sought-after element, or end() if not
583 * found.
584 *
585 * This function takes a key and tries to locate the element with which
586 * the key matches. If successful the function returns an iterator
587 * pointing to the sought after element. If unsuccessful it returns the
588 * past-the-end ( @c end() ) iterator.
589 */
590 iterator
591 find(const key_type& __x)
592 { return _M_t.find(__x); }
593
594 const_iterator
595 find(const key_type& __x) const
596 { return _M_t.find(__x); }
597 //@}
598
599 //@{
600 /**
601 * @brief Finds the beginning of a subsequence matching given key.
602 * @param __x Key to be located.
603 * @return Iterator pointing to first element equal to or greater
604 * than key, or end().
605 *
606 * This function returns the first element of a subsequence of elements
607 * that matches the given key. If unsuccessful it returns an iterator
608 * pointing to the first element that has a greater value than given key
609 * or end() if no such element exists.
610 */
611 iterator
612 lower_bound(const key_type& __x)
613 { return _M_t.lower_bound(__x); }
614
615 const_iterator
616 lower_bound(const key_type& __x) const
617 { return _M_t.lower_bound(__x); }
618 //@}
619
620 //@{
621 /**
622 * @brief Finds the end of a subsequence matching given key.
623 * @param __x Key to be located.
624 * @return Iterator pointing to the first element
625 * greater than key, or end().
626 */
627 iterator
628 upper_bound(const key_type& __x)
629 { return _M_t.upper_bound(__x); }
630
631 const_iterator
632 upper_bound(const key_type& __x) const
633 { return _M_t.upper_bound(__x); }
634 //@}
635
636 //@{
637 /**
638 * @brief Finds a subsequence matching given key.
639 * @param __x Key to be located.
640 * @return Pair of iterators that possibly points to the subsequence
641 * matching given key.
642 *
643 * This function is equivalent to
644 * @code
645 * std::make_pair(c.lower_bound(val),
646 * c.upper_bound(val))
647 * @endcode
648 * (but is faster than making the calls separately).
649 *
650 * This function probably only makes sense for multisets.
651 */
652 std::pair<iterator, iterator>
653 equal_range(const key_type& __x)
654 { return _M_t.equal_range(__x); }
655
656 std::pair<const_iterator, const_iterator>
657 equal_range(const key_type& __x) const
658 { return _M_t.equal_range(__x); }
659 //@}
660
661 template<typename _K1, typename _C1, typename _A1>
662 friend bool
663 operator==(const multiset<_K1, _C1, _A1>&,
664 const multiset<_K1, _C1, _A1>&);
665
666 template<typename _K1, typename _C1, typename _A1>
667 friend bool
668 operator< (const multiset<_K1, _C1, _A1>&,
669 const multiset<_K1, _C1, _A1>&);
670 };
671
672 /**
673 * @brief Multiset equality comparison.
674 * @param __x A %multiset.
675 * @param __y A %multiset of the same type as @a __x.
676 * @return True iff the size and elements of the multisets are equal.
677 *
678 * This is an equivalence relation. It is linear in the size of the
679 * multisets.
680 * Multisets are considered equivalent if their sizes are equal, and if
681 * corresponding elements compare equal.
682 */
683 template<typename _Key, typename _Compare, typename _Alloc>
684 inline bool
685 operator==(const multiset<_Key, _Compare, _Alloc>& __x,
686 const multiset<_Key, _Compare, _Alloc>& __y)
687 { return __x._M_t == __y._M_t; }
688
689 /**
690 * @brief Multiset ordering relation.
691 * @param __x A %multiset.
692 * @param __y A %multiset of the same type as @a __x.
693 * @return True iff @a __x is lexicographically less than @a __y.
694 *
695 * This is a total ordering relation. It is linear in the size of the
696 * maps. The elements must be comparable with @c <.
697 *
698 * See std::lexicographical_compare() for how the determination is made.
699 */
700 template<typename _Key, typename _Compare, typename _Alloc>
701 inline bool
702 operator<(const multiset<_Key, _Compare, _Alloc>& __x,
703 const multiset<_Key, _Compare, _Alloc>& __y)
704 { return __x._M_t < __y._M_t; }
705
706 /// Returns !(x == y).
707 template<typename _Key, typename _Compare, typename _Alloc>
708 inline bool
709 operator!=(const multiset<_Key, _Compare, _Alloc>& __x,
710 const multiset<_Key, _Compare, _Alloc>& __y)
711 { return !(__x == __y); }
712
713 /// Returns y < x.
714 template<typename _Key, typename _Compare, typename _Alloc>
715 inline bool
716 operator>(const multiset<_Key,_Compare,_Alloc>& __x,
717 const multiset<_Key,_Compare,_Alloc>& __y)
718 { return __y < __x; }
719
720 /// Returns !(y < x)
721 template<typename _Key, typename _Compare, typename _Alloc>
722 inline bool
723 operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
724 const multiset<_Key, _Compare, _Alloc>& __y)
725 { return !(__y < __x); }
726
727 /// Returns !(x < y)
728 template<typename _Key, typename _Compare, typename _Alloc>
729 inline bool
730 operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
731 const multiset<_Key, _Compare, _Alloc>& __y)
732 { return !(__x < __y); }
733
734 /// See std::multiset::swap().
735 template<typename _Key, typename _Compare, typename _Alloc>
736 inline void
737 swap(multiset<_Key, _Compare, _Alloc>& __x,
738 multiset<_Key, _Compare, _Alloc>& __y)
739 { __x.swap(__y); }
740
741 _GLIBCXX_END_NAMESPACE_CONTAINER
742 } // namespace std
743
744 #endif /* _STL_MULTISET_H */