libstdc++
|
00001 // Multiset implementation -*- C++ -*- 00002 00003 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 00004 // 2011 Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /* 00027 * 00028 * Copyright (c) 1994 00029 * Hewlett-Packard Company 00030 * 00031 * Permission to use, copy, modify, distribute and sell this software 00032 * and its documentation for any purpose is hereby granted without fee, 00033 * provided that the above copyright notice appear in all copies and 00034 * that both that copyright notice and this permission notice appear 00035 * in supporting documentation. Hewlett-Packard Company makes no 00036 * representations about the suitability of this software for any 00037 * purpose. It is provided "as is" without express or implied warranty. 00038 * 00039 * 00040 * Copyright (c) 1996 00041 * Silicon Graphics Computer Systems, Inc. 00042 * 00043 * Permission to use, copy, modify, distribute and sell this software 00044 * and its documentation for any purpose is hereby granted without fee, 00045 * provided that the above copyright notice appear in all copies and 00046 * that both that copyright notice and this permission notice appear 00047 * in supporting documentation. Silicon Graphics makes no 00048 * representations about the suitability of this software for any 00049 * purpose. It is provided "as is" without express or implied warranty. 00050 */ 00051 00052 /** @file bits/stl_multiset.h 00053 * This is an internal header file, included by other library headers. 00054 * Do not attempt to use it directly. @headername{set} 00055 */ 00056 00057 #ifndef _STL_MULTISET_H 00058 #define _STL_MULTISET_H 1 00059 00060 #include <bits/concept_check.h> 00061 #include <initializer_list> 00062 00063 namespace std _GLIBCXX_VISIBILITY(default) 00064 { 00065 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER 00066 00067 /** 00068 * @brief A standard container made up of elements, which can be retrieved 00069 * in logarithmic time. 00070 * 00071 * @ingroup associative_containers 00072 * 00073 * Meets the requirements of a <a href="tables.html#65">container</a>, a 00074 * <a href="tables.html#66">reversible container</a>, and an 00075 * <a href="tables.html#69">associative container</a> (using equivalent 00076 * keys). For a @c multiset<Key> the key_type and value_type are Key. 00077 * 00078 * Multisets support bidirectional iterators. 00079 * 00080 * The private tree data is declared exactly the same way for set and 00081 * multiset; the distinction is made entirely in how the tree functions are 00082 * called (*_unique versus *_equal, same as the standard). 00083 */ 00084 template <typename _Key, typename _Compare = std::less<_Key>, 00085 typename _Alloc = std::allocator<_Key> > 00086 class multiset 00087 { 00088 // concept requirements 00089 typedef typename _Alloc::value_type _Alloc_value_type; 00090 __glibcxx_class_requires(_Key, _SGIAssignableConcept) 00091 __glibcxx_class_requires4(_Compare, bool, _Key, _Key, 00092 _BinaryFunctionConcept) 00093 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) 00094 00095 public: 00096 // typedefs: 00097 typedef _Key key_type; 00098 typedef _Key value_type; 00099 typedef _Compare key_compare; 00100 typedef _Compare value_compare; 00101 typedef _Alloc allocator_type; 00102 00103 private: 00104 /// This turns a red-black tree into a [multi]set. 00105 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type; 00106 00107 typedef _Rb_tree<key_type, value_type, _Identity<value_type>, 00108 key_compare, _Key_alloc_type> _Rep_type; 00109 /// The actual tree structure. 00110 _Rep_type _M_t; 00111 00112 public: 00113 typedef typename _Key_alloc_type::pointer pointer; 00114 typedef typename _Key_alloc_type::const_pointer const_pointer; 00115 typedef typename _Key_alloc_type::reference reference; 00116 typedef typename _Key_alloc_type::const_reference const_reference; 00117 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00118 // DR 103. set::iterator is required to be modifiable, 00119 // but this allows modification of keys. 00120 typedef typename _Rep_type::const_iterator iterator; 00121 typedef typename _Rep_type::const_iterator const_iterator; 00122 typedef typename _Rep_type::const_reverse_iterator reverse_iterator; 00123 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; 00124 typedef typename _Rep_type::size_type size_type; 00125 typedef typename _Rep_type::difference_type difference_type; 00126 00127 // allocation/deallocation 00128 /** 00129 * @brief Default constructor creates no elements. 00130 */ 00131 multiset() 00132 : _M_t() { } 00133 00134 /** 00135 * @brief Creates a %multiset with no elements. 00136 * @param comp Comparator to use. 00137 * @param a An allocator object. 00138 */ 00139 explicit 00140 multiset(const _Compare& __comp, 00141 const allocator_type& __a = allocator_type()) 00142 : _M_t(__comp, __a) { } 00143 00144 /** 00145 * @brief Builds a %multiset from a range. 00146 * @param first An input iterator. 00147 * @param last An input iterator. 00148 * 00149 * Create a %multiset consisting of copies of the elements from 00150 * [first,last). This is linear in N if the range is already sorted, 00151 * and NlogN otherwise (where N is distance(first,last)). 00152 */ 00153 template<typename _InputIterator> 00154 multiset(_InputIterator __first, _InputIterator __last) 00155 : _M_t() 00156 { _M_t._M_insert_equal(__first, __last); } 00157 00158 /** 00159 * @brief Builds a %multiset from a range. 00160 * @param first An input iterator. 00161 * @param last An input iterator. 00162 * @param comp A comparison functor. 00163 * @param a An allocator object. 00164 * 00165 * Create a %multiset consisting of copies of the elements from 00166 * [first,last). This is linear in N if the range is already sorted, 00167 * and NlogN otherwise (where N is distance(first,last)). 00168 */ 00169 template<typename _InputIterator> 00170 multiset(_InputIterator __first, _InputIterator __last, 00171 const _Compare& __comp, 00172 const allocator_type& __a = allocator_type()) 00173 : _M_t(__comp, __a) 00174 { _M_t._M_insert_equal(__first, __last); } 00175 00176 /** 00177 * @brief %Multiset copy constructor. 00178 * @param x A %multiset of identical element and allocator types. 00179 * 00180 * The newly-created %multiset uses a copy of the allocation object used 00181 * by @a x. 00182 */ 00183 multiset(const multiset& __x) 00184 : _M_t(__x._M_t) { } 00185 00186 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00187 /** 00188 * @brief %Multiset move constructor. 00189 * @param x A %multiset of identical element and allocator types. 00190 * 00191 * The newly-created %multiset contains the exact contents of @a x. 00192 * The contents of @a x are a valid, but unspecified %multiset. 00193 */ 00194 multiset(multiset&& __x) 00195 : _M_t(std::move(__x._M_t)) { } 00196 00197 /** 00198 * @brief Builds a %multiset from an initializer_list. 00199 * @param l An initializer_list. 00200 * @param comp A comparison functor. 00201 * @param a An allocator object. 00202 * 00203 * Create a %multiset consisting of copies of the elements from 00204 * the list. This is linear in N if the list is already sorted, 00205 * and NlogN otherwise (where N is @a l.size()). 00206 */ 00207 multiset(initializer_list<value_type> __l, 00208 const _Compare& __comp = _Compare(), 00209 const allocator_type& __a = allocator_type()) 00210 : _M_t(__comp, __a) 00211 { _M_t._M_insert_equal(__l.begin(), __l.end()); } 00212 #endif 00213 00214 /** 00215 * @brief %Multiset assignment operator. 00216 * @param x A %multiset of identical element and allocator types. 00217 * 00218 * All the elements of @a x are copied, but unlike the copy constructor, 00219 * the allocator object is not copied. 00220 */ 00221 multiset& 00222 operator=(const multiset& __x) 00223 { 00224 _M_t = __x._M_t; 00225 return *this; 00226 } 00227 00228 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00229 /** 00230 * @brief %Multiset move assignment operator. 00231 * @param x A %multiset of identical element and allocator types. 00232 * 00233 * The contents of @a x are moved into this %multiset (without copying). 00234 * @a x is a valid, but unspecified %multiset. 00235 */ 00236 multiset& 00237 operator=(multiset&& __x) 00238 { 00239 // NB: DR 1204. 00240 // NB: DR 675. 00241 this->clear(); 00242 this->swap(__x); 00243 return *this; 00244 } 00245 00246 /** 00247 * @brief %Multiset list assignment operator. 00248 * @param l An initializer_list. 00249 * 00250 * This function fills a %multiset with copies of the elements in the 00251 * initializer list @a l. 00252 * 00253 * Note that the assignment completely changes the %multiset and 00254 * that the resulting %multiset's size is the same as the number 00255 * of elements assigned. Old data may be lost. 00256 */ 00257 multiset& 00258 operator=(initializer_list<value_type> __l) 00259 { 00260 this->clear(); 00261 this->insert(__l.begin(), __l.end()); 00262 return *this; 00263 } 00264 #endif 00265 00266 // accessors: 00267 00268 /// Returns the comparison object. 00269 key_compare 00270 key_comp() const 00271 { return _M_t.key_comp(); } 00272 /// Returns the comparison object. 00273 value_compare 00274 value_comp() const 00275 { return _M_t.key_comp(); } 00276 /// Returns the memory allocation object. 00277 allocator_type 00278 get_allocator() const 00279 { return _M_t.get_allocator(); } 00280 00281 /** 00282 * Returns a read-only (constant) iterator that points to the first 00283 * element in the %multiset. Iteration is done in ascending order 00284 * according to the keys. 00285 */ 00286 iterator 00287 begin() const 00288 { return _M_t.begin(); } 00289 00290 /** 00291 * Returns a read-only (constant) iterator that points one past the last 00292 * element in the %multiset. Iteration is done in ascending order 00293 * according to the keys. 00294 */ 00295 iterator 00296 end() const 00297 { return _M_t.end(); } 00298 00299 /** 00300 * Returns a read-only (constant) reverse iterator that points to the 00301 * last element in the %multiset. Iteration is done in descending order 00302 * according to the keys. 00303 */ 00304 reverse_iterator 00305 rbegin() const 00306 { return _M_t.rbegin(); } 00307 00308 /** 00309 * Returns a read-only (constant) reverse iterator that points to the 00310 * last element in the %multiset. Iteration is done in descending order 00311 * according to the keys. 00312 */ 00313 reverse_iterator 00314 rend() const 00315 { return _M_t.rend(); } 00316 00317 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00318 /** 00319 * Returns a read-only (constant) iterator that points to the first 00320 * element in the %multiset. Iteration is done in ascending order 00321 * according to the keys. 00322 */ 00323 iterator 00324 cbegin() const 00325 { return _M_t.begin(); } 00326 00327 /** 00328 * Returns a read-only (constant) iterator that points one past the last 00329 * element in the %multiset. Iteration is done in ascending order 00330 * according to the keys. 00331 */ 00332 iterator 00333 cend() const 00334 { return _M_t.end(); } 00335 00336 /** 00337 * Returns a read-only (constant) reverse iterator that points to the 00338 * last element in the %multiset. Iteration is done in descending order 00339 * according to the keys. 00340 */ 00341 reverse_iterator 00342 crbegin() const 00343 { return _M_t.rbegin(); } 00344 00345 /** 00346 * Returns a read-only (constant) reverse iterator that points to the 00347 * last element in the %multiset. Iteration is done in descending order 00348 * according to the keys. 00349 */ 00350 reverse_iterator 00351 crend() const 00352 { return _M_t.rend(); } 00353 #endif 00354 00355 /// Returns true if the %set is empty. 00356 bool 00357 empty() const 00358 { return _M_t.empty(); } 00359 00360 /// Returns the size of the %set. 00361 size_type 00362 size() const 00363 { return _M_t.size(); } 00364 00365 /// Returns the maximum size of the %set. 00366 size_type 00367 max_size() const 00368 { return _M_t.max_size(); } 00369 00370 /** 00371 * @brief Swaps data with another %multiset. 00372 * @param x A %multiset of the same element and allocator types. 00373 * 00374 * This exchanges the elements between two multisets in constant time. 00375 * (It is only swapping a pointer, an integer, and an instance of the @c 00376 * Compare type (which itself is often stateless and empty), so it should 00377 * be quite fast.) 00378 * Note that the global std::swap() function is specialized such that 00379 * std::swap(s1,s2) will feed to this function. 00380 */ 00381 void 00382 swap(multiset& __x) 00383 { _M_t.swap(__x._M_t); } 00384 00385 // insert/erase 00386 /** 00387 * @brief Inserts an element into the %multiset. 00388 * @param x Element to be inserted. 00389 * @return An iterator that points to the inserted element. 00390 * 00391 * This function inserts an element into the %multiset. Contrary 00392 * to a std::set the %multiset does not rely on unique keys and thus 00393 * multiple copies of the same element can be inserted. 00394 * 00395 * Insertion requires logarithmic time. 00396 */ 00397 iterator 00398 insert(const value_type& __x) 00399 { return _M_t._M_insert_equal(__x); } 00400 00401 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00402 iterator 00403 insert(value_type&& __x) 00404 { return _M_t._M_insert_equal(std::move(__x)); } 00405 #endif 00406 00407 /** 00408 * @brief Inserts an element into the %multiset. 00409 * @param position An iterator that serves as a hint as to where the 00410 * element should be inserted. 00411 * @param x Element to be inserted. 00412 * @return An iterator that points to the inserted element. 00413 * 00414 * This function inserts an element into the %multiset. Contrary 00415 * to a std::set the %multiset does not rely on unique keys and thus 00416 * multiple copies of the same element can be inserted. 00417 * 00418 * Note that the first parameter is only a hint and can potentially 00419 * improve the performance of the insertion process. A bad hint would 00420 * cause no gains in efficiency. 00421 * 00422 * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html 00423 * for more on @a hinting. 00424 * 00425 * Insertion requires logarithmic time (if the hint is not taken). 00426 */ 00427 iterator 00428 insert(const_iterator __position, const value_type& __x) 00429 { return _M_t._M_insert_equal_(__position, __x); } 00430 00431 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00432 iterator 00433 insert(const_iterator __position, value_type&& __x) 00434 { return _M_t._M_insert_equal_(__position, std::move(__x)); } 00435 #endif 00436 00437 /** 00438 * @brief A template function that tries to insert a range of elements. 00439 * @param first Iterator pointing to the start of the range to be 00440 * inserted. 00441 * @param last Iterator pointing to the end of the range. 00442 * 00443 * Complexity similar to that of the range constructor. 00444 */ 00445 template<typename _InputIterator> 00446 void 00447 insert(_InputIterator __first, _InputIterator __last) 00448 { _M_t._M_insert_equal(__first, __last); } 00449 00450 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00451 /** 00452 * @brief Attempts to insert a list of elements into the %multiset. 00453 * @param list A std::initializer_list<value_type> of elements 00454 * to be inserted. 00455 * 00456 * Complexity similar to that of the range constructor. 00457 */ 00458 void 00459 insert(initializer_list<value_type> __l) 00460 { this->insert(__l.begin(), __l.end()); } 00461 #endif 00462 00463 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00464 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00465 // DR 130. Associative erase should return an iterator. 00466 /** 00467 * @brief Erases an element from a %multiset. 00468 * @param position An iterator pointing to the element to be erased. 00469 * @return An iterator pointing to the element immediately following 00470 * @a position prior to the element being erased. If no such 00471 * element exists, end() is returned. 00472 * 00473 * This function erases an element, pointed to by the given iterator, 00474 * from a %multiset. Note that this function only erases the element, 00475 * and that if the element is itself a pointer, the pointed-to memory is 00476 * not touched in any way. Managing the pointer is the user's 00477 * responsibility. 00478 */ 00479 iterator 00480 erase(const_iterator __position) 00481 { return _M_t.erase(__position); } 00482 #else 00483 /** 00484 * @brief Erases an element from a %multiset. 00485 * @param position An iterator pointing to the element to be erased. 00486 * 00487 * This function erases an element, pointed to by the given iterator, 00488 * from a %multiset. Note that this function only erases the element, 00489 * and that if the element is itself a pointer, the pointed-to memory is 00490 * not touched in any way. Managing the pointer is the user's 00491 * responsibility. 00492 */ 00493 void 00494 erase(iterator __position) 00495 { _M_t.erase(__position); } 00496 #endif 00497 00498 /** 00499 * @brief Erases elements according to the provided key. 00500 * @param x Key of element to be erased. 00501 * @return The number of elements erased. 00502 * 00503 * This function erases all elements located by the given key from a 00504 * %multiset. 00505 * Note that this function only erases the element, and that if 00506 * the element is itself a pointer, the pointed-to memory is not touched 00507 * in any way. Managing the pointer is the user's responsibility. 00508 */ 00509 size_type 00510 erase(const key_type& __x) 00511 { return _M_t.erase(__x); } 00512 00513 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 00514 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00515 // DR 130. Associative erase should return an iterator. 00516 /** 00517 * @brief Erases a [first,last) range of elements from a %multiset. 00518 * @param first Iterator pointing to the start of the range to be 00519 * erased. 00520 * @param last Iterator pointing to the end of the range to be erased. 00521 * @return The iterator @a last. 00522 * 00523 * This function erases a sequence of elements from a %multiset. 00524 * Note that this function only erases the elements, and that if 00525 * the elements themselves are pointers, the pointed-to memory is not 00526 * touched in any way. Managing the pointer is the user's 00527 * responsibility. 00528 */ 00529 iterator 00530 erase(const_iterator __first, const_iterator __last) 00531 { return _M_t.erase(__first, __last); } 00532 #else 00533 /** 00534 * @brief Erases a [first,last) range of elements from a %multiset. 00535 * @param first Iterator pointing to the start of the range to be 00536 * erased. 00537 * @param last Iterator pointing to the end of the range to be erased. 00538 * 00539 * This function erases a sequence of elements from a %multiset. 00540 * Note that this function only erases the elements, and that if 00541 * the elements themselves are pointers, the pointed-to memory is not 00542 * touched in any way. Managing the pointer is the user's 00543 * responsibility. 00544 */ 00545 void 00546 erase(iterator __first, iterator __last) 00547 { _M_t.erase(__first, __last); } 00548 #endif 00549 00550 /** 00551 * Erases all elements in a %multiset. Note that this function only 00552 * erases the elements, and that if the elements themselves are pointers, 00553 * the pointed-to memory is not touched in any way. Managing the pointer 00554 * is the user's responsibility. 00555 */ 00556 void 00557 clear() 00558 { _M_t.clear(); } 00559 00560 // multiset operations: 00561 00562 /** 00563 * @brief Finds the number of elements with given key. 00564 * @param x Key of elements to be located. 00565 * @return Number of elements with specified key. 00566 */ 00567 size_type 00568 count(const key_type& __x) const 00569 { return _M_t.count(__x); } 00570 00571 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00572 // 214. set::find() missing const overload 00573 //@{ 00574 /** 00575 * @brief Tries to locate an element in a %set. 00576 * @param x Element to be located. 00577 * @return Iterator pointing to sought-after element, or end() if not 00578 * found. 00579 * 00580 * This function takes a key and tries to locate the element with which 00581 * the key matches. If successful the function returns an iterator 00582 * pointing to the sought after element. If unsuccessful it returns the 00583 * past-the-end ( @c end() ) iterator. 00584 */ 00585 iterator 00586 find(const key_type& __x) 00587 { return _M_t.find(__x); } 00588 00589 const_iterator 00590 find(const key_type& __x) const 00591 { return _M_t.find(__x); } 00592 //@} 00593 00594 //@{ 00595 /** 00596 * @brief Finds the beginning of a subsequence matching given key. 00597 * @param x Key to be located. 00598 * @return Iterator pointing to first element equal to or greater 00599 * than key, or end(). 00600 * 00601 * This function returns the first element of a subsequence of elements 00602 * that matches the given key. If unsuccessful it returns an iterator 00603 * pointing to the first element that has a greater value than given key 00604 * or end() if no such element exists. 00605 */ 00606 iterator 00607 lower_bound(const key_type& __x) 00608 { return _M_t.lower_bound(__x); } 00609 00610 const_iterator 00611 lower_bound(const key_type& __x) const 00612 { return _M_t.lower_bound(__x); } 00613 //@} 00614 00615 //@{ 00616 /** 00617 * @brief Finds the end of a subsequence matching given key. 00618 * @param x Key to be located. 00619 * @return Iterator pointing to the first element 00620 * greater than key, or end(). 00621 */ 00622 iterator 00623 upper_bound(const key_type& __x) 00624 { return _M_t.upper_bound(__x); } 00625 00626 const_iterator 00627 upper_bound(const key_type& __x) const 00628 { return _M_t.upper_bound(__x); } 00629 //@} 00630 00631 //@{ 00632 /** 00633 * @brief Finds a subsequence matching given key. 00634 * @param x Key to be located. 00635 * @return Pair of iterators that possibly points to the subsequence 00636 * matching given key. 00637 * 00638 * This function is equivalent to 00639 * @code 00640 * std::make_pair(c.lower_bound(val), 00641 * c.upper_bound(val)) 00642 * @endcode 00643 * (but is faster than making the calls separately). 00644 * 00645 * This function probably only makes sense for multisets. 00646 */ 00647 std::pair<iterator, iterator> 00648 equal_range(const key_type& __x) 00649 { return _M_t.equal_range(__x); } 00650 00651 std::pair<const_iterator, const_iterator> 00652 equal_range(const key_type& __x) const 00653 { return _M_t.equal_range(__x); } 00654 00655 template<typename _K1, typename _C1, typename _A1> 00656 friend bool 00657 operator==(const multiset<_K1, _C1, _A1>&, 00658 const multiset<_K1, _C1, _A1>&); 00659 00660 template<typename _K1, typename _C1, typename _A1> 00661 friend bool 00662 operator< (const multiset<_K1, _C1, _A1>&, 00663 const multiset<_K1, _C1, _A1>&); 00664 }; 00665 00666 /** 00667 * @brief Multiset equality comparison. 00668 * @param x A %multiset. 00669 * @param y A %multiset of the same type as @a x. 00670 * @return True iff the size and elements of the multisets are equal. 00671 * 00672 * This is an equivalence relation. It is linear in the size of the 00673 * multisets. 00674 * Multisets are considered equivalent if their sizes are equal, and if 00675 * corresponding elements compare equal. 00676 */ 00677 template<typename _Key, typename _Compare, typename _Alloc> 00678 inline bool 00679 operator==(const multiset<_Key, _Compare, _Alloc>& __x, 00680 const multiset<_Key, _Compare, _Alloc>& __y) 00681 { return __x._M_t == __y._M_t; } 00682 00683 /** 00684 * @brief Multiset ordering relation. 00685 * @param x A %multiset. 00686 * @param y A %multiset of the same type as @a x. 00687 * @return True iff @a x is lexicographically less than @a y. 00688 * 00689 * This is a total ordering relation. It is linear in the size of the 00690 * maps. The elements must be comparable with @c <. 00691 * 00692 * See std::lexicographical_compare() for how the determination is made. 00693 */ 00694 template<typename _Key, typename _Compare, typename _Alloc> 00695 inline bool 00696 operator<(const multiset<_Key, _Compare, _Alloc>& __x, 00697 const multiset<_Key, _Compare, _Alloc>& __y) 00698 { return __x._M_t < __y._M_t; } 00699 00700 /// Returns !(x == y). 00701 template<typename _Key, typename _Compare, typename _Alloc> 00702 inline bool 00703 operator!=(const multiset<_Key, _Compare, _Alloc>& __x, 00704 const multiset<_Key, _Compare, _Alloc>& __y) 00705 { return !(__x == __y); } 00706 00707 /// Returns y < x. 00708 template<typename _Key, typename _Compare, typename _Alloc> 00709 inline bool 00710 operator>(const multiset<_Key,_Compare,_Alloc>& __x, 00711 const multiset<_Key,_Compare,_Alloc>& __y) 00712 { return __y < __x; } 00713 00714 /// Returns !(y < x) 00715 template<typename _Key, typename _Compare, typename _Alloc> 00716 inline bool 00717 operator<=(const multiset<_Key, _Compare, _Alloc>& __x, 00718 const multiset<_Key, _Compare, _Alloc>& __y) 00719 { return !(__y < __x); } 00720 00721 /// Returns !(x < y) 00722 template<typename _Key, typename _Compare, typename _Alloc> 00723 inline bool 00724 operator>=(const multiset<_Key, _Compare, _Alloc>& __x, 00725 const multiset<_Key, _Compare, _Alloc>& __y) 00726 { return !(__x < __y); } 00727 00728 /// See std::multiset::swap(). 00729 template<typename _Key, typename _Compare, typename _Alloc> 00730 inline void 00731 swap(multiset<_Key, _Compare, _Alloc>& __x, 00732 multiset<_Key, _Compare, _Alloc>& __y) 00733 { __x.swap(__y); } 00734 00735 _GLIBCXX_END_NAMESPACE_CONTAINER 00736 } // namespace std 00737 00738 #endif /* _STL_MULTISET_H */