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