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