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