197403Sobrien// Set implementation -*- C++ -*- 297403Sobrien 3169691Skan// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 3097403Sobrien/* 3197403Sobrien * 3297403Sobrien * Copyright (c) 1994 3397403Sobrien * Hewlett-Packard Company 3497403Sobrien * 3597403Sobrien * Permission to use, copy, modify, distribute and sell this software 3697403Sobrien * and its documentation for any purpose is hereby granted without fee, 3797403Sobrien * provided that the above copyright notice appear in all copies and 3897403Sobrien * that both that copyright notice and this permission notice appear 3997403Sobrien * in supporting documentation. Hewlett-Packard Company makes no 4097403Sobrien * representations about the suitability of this software for any 4197403Sobrien * purpose. It is provided "as is" without express or implied warranty. 4297403Sobrien * 4397403Sobrien * 4497403Sobrien * Copyright (c) 1996,1997 4597403Sobrien * Silicon Graphics Computer Systems, Inc. 4697403Sobrien * 4797403Sobrien * Permission to use, copy, modify, distribute and sell this software 4897403Sobrien * and its documentation for any purpose is hereby granted without fee, 4997403Sobrien * provided that the above copyright notice appear in all copies and 5097403Sobrien * that both that copyright notice and this permission notice appear 5197403Sobrien * in supporting documentation. Silicon Graphics makes no 5297403Sobrien * representations about the suitability of this software for any 5397403Sobrien * purpose. It is provided "as is" without express or implied warranty. 5497403Sobrien */ 5597403Sobrien 5697403Sobrien/** @file stl_set.h 5797403Sobrien * This is an internal header file, included by other library headers. 5897403Sobrien * You should not attempt to use it directly. 5997403Sobrien */ 6097403Sobrien 61132720Skan#ifndef _SET_H 62132720Skan#define _SET_H 1 6397403Sobrien 6497403Sobrien#include <bits/concept_check.h> 6597403Sobrien 66169691Skan_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) 6797403Sobrien 68132720Skan /** 69132720Skan * @brief A standard container made up of unique keys, which can be 70132720Skan * retrieved in logarithmic time. 71132720Skan * 72132720Skan * @ingroup Containers 73132720Skan * @ingroup Assoc_containers 74132720Skan * 75132720Skan * Meets the requirements of a <a href="tables.html#65">container</a>, a 76132720Skan * <a href="tables.html#66">reversible container</a>, and an 77132720Skan * <a href="tables.html#69">associative container</a> (using unique keys). 78132720Skan * 79132720Skan * Sets support bidirectional iterators. 80132720Skan * 81132720Skan * @param Key Type of key objects. 82132720Skan * @param Compare Comparison function object type, defaults to less<Key>. 83132720Skan * @param Alloc Allocator type, defaults to allocator<Key>. 84132720Skan * 85132720Skan * @if maint 86132720Skan * The private tree data is declared exactly the same way for set and 87132720Skan * multiset; the distinction is made entirely in how the tree functions are 88132720Skan * called (*_unique versus *_equal, same as the standard). 89132720Skan * @endif 90132720Skan */ 91169691Skan template<class _Key, class _Compare = std::less<_Key>, 92169691Skan class _Alloc = std::allocator<_Key> > 93132720Skan class set 94132720Skan { 95132720Skan // concept requirements 96169691Skan typedef typename _Alloc::value_type _Alloc_value_type; 97132720Skan __glibcxx_class_requires(_Key, _SGIAssignableConcept) 98132720Skan __glibcxx_class_requires4(_Compare, bool, _Key, _Key, 99132720Skan _BinaryFunctionConcept) 100169691Skan __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) 10197403Sobrien 102132720Skan public: 103132720Skan // typedefs: 104132720Skan //@{ 105132720Skan /// Public typedefs. 106132720Skan typedef _Key key_type; 107132720Skan typedef _Key value_type; 108132720Skan typedef _Compare key_compare; 109132720Skan typedef _Compare value_compare; 110169691Skan typedef _Alloc allocator_type; 111132720Skan //@} 11297403Sobrien 113132720Skan private: 114169691Skan typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type; 115169691Skan 116169691Skan typedef _Rb_tree<key_type, value_type, _Identity<value_type>, 117169691Skan key_compare, _Key_alloc_type> _Rep_type; 118132720Skan _Rep_type _M_t; // red-black tree representing set 119169691Skan 120132720Skan public: 121132720Skan //@{ 122132720Skan /// Iterator-related typedefs. 123169691Skan typedef typename _Key_alloc_type::pointer pointer; 124169691Skan typedef typename _Key_alloc_type::const_pointer const_pointer; 125169691Skan typedef typename _Key_alloc_type::reference reference; 126169691Skan typedef typename _Key_alloc_type::const_reference const_reference; 127132720Skan // _GLIBCXX_RESOLVE_LIB_DEFECTS 128132720Skan // DR 103. set::iterator is required to be modifiable, 129132720Skan // but this allows modification of keys. 130169691Skan typedef typename _Rep_type::const_iterator iterator; 131169691Skan typedef typename _Rep_type::const_iterator const_iterator; 132169691Skan typedef typename _Rep_type::const_reverse_iterator reverse_iterator; 133169691Skan typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; 134169691Skan typedef typename _Rep_type::size_type size_type; 135169691Skan typedef typename _Rep_type::difference_type difference_type; 136132720Skan //@} 13797403Sobrien 138132720Skan // allocation/deallocation 139132720Skan /// Default constructor creates no elements. 140132720Skan set() 141236829Spfg : _M_t() { } 14297403Sobrien 143132720Skan /** 144132720Skan * @brief Default constructor creates no elements. 145132720Skan * 146132720Skan * @param comp Comparator to use. 147132720Skan * @param a Allocator to use. 148132720Skan */ 149169691Skan explicit 150169691Skan set(const _Compare& __comp, 151169691Skan const allocator_type& __a = allocator_type()) 152132720Skan : _M_t(__comp, __a) {} 15397403Sobrien 154132720Skan /** 155132720Skan * @brief Builds a %set from a range. 156132720Skan * @param first An input iterator. 157132720Skan * @param last An input iterator. 158132720Skan * 159132720Skan * Create a %set consisting of copies of the elements from [first,last). 160132720Skan * This is linear in N if the range is already sorted, and NlogN 161132720Skan * otherwise (where N is distance(first,last)). 162132720Skan */ 163132720Skan template<class _InputIterator> 164132720Skan set(_InputIterator __first, _InputIterator __last) 165236829Spfg : _M_t() 166169691Skan { _M_t._M_insert_unique(__first, __last); } 16797403Sobrien 168132720Skan /** 169132720Skan * @brief Builds a %set from a range. 170132720Skan * @param first An input iterator. 171132720Skan * @param last An input iterator. 172132720Skan * @param comp A comparison functor. 173132720Skan * @param a An allocator object. 174132720Skan * 175132720Skan * Create a %set consisting of copies of the elements from [first,last). 176132720Skan * This is linear in N if the range is already sorted, and NlogN 177132720Skan * otherwise (where N is distance(first,last)). 178132720Skan */ 179132720Skan template<class _InputIterator> 180132720Skan set(_InputIterator __first, _InputIterator __last, 181132720Skan const _Compare& __comp, 182132720Skan const allocator_type& __a = allocator_type()) 183132720Skan : _M_t(__comp, __a) 184169691Skan { _M_t._M_insert_unique(__first, __last); } 18597403Sobrien 186132720Skan /** 187132720Skan * @brief Set copy constructor. 188132720Skan * @param x A %set of identical element and allocator types. 189132720Skan * 190132720Skan * The newly-created %set uses a copy of the allocation object used 191132720Skan * by @a x. 192132720Skan */ 193236829Spfg set(const set& __x) 194132720Skan : _M_t(__x._M_t) { } 19597403Sobrien 196132720Skan /** 197132720Skan * @brief Set assignment operator. 198132720Skan * @param x A %set of identical element and allocator types. 199132720Skan * 200132720Skan * All the elements of @a x are copied, but unlike the copy constructor, 201132720Skan * the allocator object is not copied. 202132720Skan */ 203236829Spfg set& 204236829Spfg operator=(const set& __x) 205132720Skan { 206132720Skan _M_t = __x._M_t; 207132720Skan return *this; 208132720Skan } 20997403Sobrien 210132720Skan // accessors: 21197403Sobrien 212132720Skan /// Returns the comparison object with which the %set was constructed. 213132720Skan key_compare 214132720Skan key_comp() const 215132720Skan { return _M_t.key_comp(); } 216132720Skan /// Returns the comparison object with which the %set was constructed. 217132720Skan value_compare 218132720Skan value_comp() const 219132720Skan { return _M_t.key_comp(); } 220132720Skan /// Returns the allocator object with which the %set was constructed. 221132720Skan allocator_type 222132720Skan get_allocator() const 223132720Skan { return _M_t.get_allocator(); } 22497403Sobrien 225132720Skan /** 226132720Skan * Returns a read/write iterator that points to the first element in the 227132720Skan * %set. Iteration is done in ascending order according to the keys. 228132720Skan */ 229132720Skan iterator 230132720Skan begin() const 231132720Skan { return _M_t.begin(); } 23297403Sobrien 233132720Skan /** 234132720Skan * Returns a read/write iterator that points one past the last element in 235132720Skan * the %set. Iteration is done in ascending order according to the keys. 236132720Skan */ 237132720Skan iterator 238132720Skan end() const 239132720Skan { return _M_t.end(); } 24097403Sobrien 241132720Skan /** 242132720Skan * Returns a read/write reverse iterator that points to the last element 243132720Skan * in the %set. Iteration is done in descending order according to the 244132720Skan * keys. 245132720Skan */ 246132720Skan reverse_iterator 247132720Skan rbegin() const 248132720Skan { return _M_t.rbegin(); } 24997403Sobrien 250132720Skan /** 251132720Skan * Returns a read-only (constant) reverse iterator that points to the 252132720Skan * last pair in the %map. Iteration is done in descending order 253132720Skan * according to the keys. 254132720Skan */ 255132720Skan reverse_iterator 256132720Skan rend() const 257132720Skan { return _M_t.rend(); } 25897403Sobrien 259132720Skan /// Returns true if the %set is empty. 260132720Skan bool 261132720Skan empty() const 262132720Skan { return _M_t.empty(); } 26397403Sobrien 264132720Skan /// Returns the size of the %set. 265132720Skan size_type 266132720Skan size() const 267132720Skan { return _M_t.size(); } 26897403Sobrien 269132720Skan /// Returns the maximum size of the %set. 270132720Skan size_type 271132720Skan max_size() const 272132720Skan { return _M_t.max_size(); } 27397403Sobrien 274132720Skan /** 275132720Skan * @brief Swaps data with another %set. 276132720Skan * @param x A %set of the same element and allocator types. 277132720Skan * 278132720Skan * This exchanges the elements between two sets in constant time. 279132720Skan * (It is only swapping a pointer, an integer, and an instance of 280132720Skan * the @c Compare type (which itself is often stateless and empty), so it 281132720Skan * should be quite fast.) 282132720Skan * Note that the global std::swap() function is specialized such that 283132720Skan * std::swap(s1,s2) will feed to this function. 284132720Skan */ 285132720Skan void 286236829Spfg swap(set& __x) 287132720Skan { _M_t.swap(__x._M_t); } 28897403Sobrien 289132720Skan // insert/erase 290132720Skan /** 291132720Skan * @brief Attempts to insert an element into the %set. 292132720Skan * @param x Element to be inserted. 293132720Skan * @return A pair, of which the first element is an iterator that points 294132720Skan * to the possibly inserted element, and the second is a bool 295132720Skan * that is true if the element was actually inserted. 296132720Skan * 297132720Skan * This function attempts to insert an element into the %set. A %set 298132720Skan * relies on unique keys and thus an element is only inserted if it is 299132720Skan * not already present in the %set. 300132720Skan * 301132720Skan * Insertion requires logarithmic time. 302132720Skan */ 303169691Skan std::pair<iterator,bool> 304132720Skan insert(const value_type& __x) 305132720Skan { 306169691Skan std::pair<typename _Rep_type::iterator, bool> __p = 307169691Skan _M_t._M_insert_unique(__x); 308169691Skan return std::pair<iterator, bool>(__p.first, __p.second); 309132720Skan } 31097403Sobrien 311132720Skan /** 312132720Skan * @brief Attempts to insert an element into the %set. 313132720Skan * @param position An iterator that serves as a hint as to where the 314132720Skan * element should be inserted. 315132720Skan * @param x Element to be inserted. 316132720Skan * @return An iterator that points to the element with key of @a x (may 317132720Skan * or may not be the element passed in). 318132720Skan * 319132720Skan * This function is not concerned about whether the insertion took place, 320132720Skan * and thus does not return a boolean like the single-argument insert() 321132720Skan * does. Note that the first parameter is only a hint and can 322132720Skan * potentially improve the performance of the insertion process. A bad 323132720Skan * hint would cause no gains in efficiency. 324132720Skan * 325132720Skan * See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4 326132720Skan * for more on "hinting". 327132720Skan * 328132720Skan * Insertion requires logarithmic time (if the hint is not taken). 329132720Skan */ 330132720Skan iterator 331132720Skan insert(iterator __position, const value_type& __x) 332169691Skan { return _M_t._M_insert_unique(__position, __x); } 33397403Sobrien 334132720Skan /** 335132720Skan * @brief A template function that attemps to insert a range of elements. 336132720Skan * @param first Iterator pointing to the start of the range to be 337132720Skan * inserted. 338132720Skan * @param last Iterator pointing to the end of the range. 339132720Skan * 340132720Skan * Complexity similar to that of the range constructor. 341132720Skan */ 342132720Skan template<class _InputIterator> 343169691Skan void 344169691Skan insert(_InputIterator __first, _InputIterator __last) 345169691Skan { _M_t._M_insert_unique(__first, __last); } 34697403Sobrien 347132720Skan /** 348132720Skan * @brief Erases an element from a %set. 349132720Skan * @param position An iterator pointing to the element to be erased. 350132720Skan * 351132720Skan * This function erases an element, pointed to by the given iterator, 352132720Skan * from a %set. Note that this function only erases the element, and 353132720Skan * that if the element is itself a pointer, the pointed-to memory is not 354132720Skan * touched in any way. Managing the pointer is the user's responsibilty. 355132720Skan */ 356132720Skan void 357132720Skan erase(iterator __position) 358169691Skan { _M_t.erase(__position); } 35997403Sobrien 360132720Skan /** 361132720Skan * @brief Erases elements according to the provided key. 362132720Skan * @param x Key of element to be erased. 363132720Skan * @return The number of elements erased. 364132720Skan * 365132720Skan * This function erases all the elements located by the given key from 366132720Skan * a %set. 367132720Skan * Note that this function only erases the element, and that if 368132720Skan * the element is itself a pointer, the pointed-to memory is not touched 369132720Skan * in any way. Managing the pointer is the user's responsibilty. 370132720Skan */ 371132720Skan size_type 372169691Skan erase(const key_type& __x) 373169691Skan { return _M_t.erase(__x); } 37497403Sobrien 375132720Skan /** 376132720Skan * @brief Erases a [first,last) range of elements from a %set. 377132720Skan * @param first Iterator pointing to the start of the range to be 378132720Skan * erased. 379132720Skan * @param last Iterator pointing to the end of the range to be erased. 380132720Skan * 381132720Skan * This function erases a sequence of elements from a %set. 382132720Skan * Note that this function only erases the element, and that if 383132720Skan * the element is itself a pointer, the pointed-to memory is not touched 384132720Skan * in any way. Managing the pointer is the user's responsibilty. 385132720Skan */ 386132720Skan void 387132720Skan erase(iterator __first, iterator __last) 388169691Skan { _M_t.erase(__first, __last); } 38997403Sobrien 390132720Skan /** 391132720Skan * Erases all elements in a %set. Note that this function only erases 392132720Skan * the elements, and that if the elements themselves are pointers, the 393132720Skan * pointed-to memory is not touched in any way. Managing the pointer is 394132720Skan * the user's responsibilty. 395132720Skan */ 396132720Skan void 397132720Skan clear() 398132720Skan { _M_t.clear(); } 399132720Skan 400132720Skan // set operations: 401132720Skan 402132720Skan /** 403132720Skan * @brief Finds the number of elements. 404132720Skan * @param x Element to located. 405132720Skan * @return Number of elements with specified key. 406132720Skan * 407132720Skan * This function only makes sense for multisets; for set the result will 408132720Skan * either be 0 (not present) or 1 (present). 409132720Skan */ 410132720Skan size_type 411132720Skan count(const key_type& __x) const 412132720Skan { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } 413132720Skan 414132720Skan // _GLIBCXX_RESOLVE_LIB_DEFECTS 415132720Skan // 214. set::find() missing const overload 416132720Skan //@{ 417132720Skan /** 418132720Skan * @brief Tries to locate an element in a %set. 419132720Skan * @param x Element to be located. 420132720Skan * @return Iterator pointing to sought-after element, or end() if not 421132720Skan * found. 422132720Skan * 423132720Skan * This function takes a key and tries to locate the element with which 424132720Skan * the key matches. If successful the function returns an iterator 425132720Skan * pointing to the sought after element. If unsuccessful it returns the 426132720Skan * past-the-end ( @c end() ) iterator. 427132720Skan */ 428132720Skan iterator 429132720Skan find(const key_type& __x) 430132720Skan { return _M_t.find(__x); } 431132720Skan 432132720Skan const_iterator 433132720Skan find(const key_type& __x) const 434132720Skan { return _M_t.find(__x); } 435132720Skan //@} 436132720Skan 437132720Skan //@{ 438132720Skan /** 439132720Skan * @brief Finds the beginning of a subsequence matching given key. 440132720Skan * @param x Key to be located. 441132720Skan * @return Iterator pointing to first element equal to or greater 442132720Skan * than key, or end(). 443132720Skan * 444132720Skan * This function returns the first element of a subsequence of elements 445132720Skan * that matches the given key. If unsuccessful it returns an iterator 446132720Skan * pointing to the first element that has a greater value than given key 447132720Skan * or end() if no such element exists. 448132720Skan */ 449132720Skan iterator 450132720Skan lower_bound(const key_type& __x) 451132720Skan { return _M_t.lower_bound(__x); } 452132720Skan 453132720Skan const_iterator 454132720Skan lower_bound(const key_type& __x) const 455132720Skan { return _M_t.lower_bound(__x); } 456132720Skan //@} 457132720Skan 458132720Skan //@{ 459132720Skan /** 460132720Skan * @brief Finds the end of a subsequence matching given key. 461132720Skan * @param x Key to be located. 462132720Skan * @return Iterator pointing to the first element 463132720Skan * greater than key, or end(). 464132720Skan */ 465132720Skan iterator 466132720Skan upper_bound(const key_type& __x) 467132720Skan { return _M_t.upper_bound(__x); } 468132720Skan 469132720Skan const_iterator 470132720Skan upper_bound(const key_type& __x) const 471132720Skan { return _M_t.upper_bound(__x); } 472132720Skan //@} 473132720Skan 474132720Skan //@{ 475132720Skan /** 476132720Skan * @brief Finds a subsequence matching given key. 477132720Skan * @param x Key to be located. 478132720Skan * @return Pair of iterators that possibly points to the subsequence 479132720Skan * matching given key. 480132720Skan * 481132720Skan * This function is equivalent to 482132720Skan * @code 483132720Skan * std::make_pair(c.lower_bound(val), 484132720Skan * c.upper_bound(val)) 485132720Skan * @endcode 486132720Skan * (but is faster than making the calls separately). 487132720Skan * 488132720Skan * This function probably only makes sense for multisets. 489132720Skan */ 490169691Skan std::pair<iterator, iterator> 491132720Skan equal_range(const key_type& __x) 492132720Skan { return _M_t.equal_range(__x); } 493132720Skan 494169691Skan std::pair<const_iterator, const_iterator> 495132720Skan equal_range(const key_type& __x) const 496132720Skan { return _M_t.equal_range(__x); } 497132720Skan //@} 498132720Skan 499132720Skan template<class _K1, class _C1, class _A1> 500132720Skan friend bool 501169691Skan operator== (const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); 502132720Skan 503132720Skan template<class _K1, class _C1, class _A1> 504132720Skan friend bool 505169691Skan operator< (const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); 506132720Skan }; 507132720Skan 508132720Skan 509132720Skan /** 510132720Skan * @brief Set equality comparison. 511132720Skan * @param x A %set. 512132720Skan * @param y A %set of the same type as @a x. 513132720Skan * @return True iff the size and elements of the sets are equal. 514132720Skan * 515132720Skan * This is an equivalence relation. It is linear in the size of the sets. 516132720Skan * Sets are considered equivalent if their sizes are equal, and if 517132720Skan * corresponding elements compare equal. 518132720Skan */ 519132720Skan template<class _Key, class _Compare, class _Alloc> 520132720Skan inline bool 521169691Skan operator==(const set<_Key, _Compare, _Alloc>& __x, 522169691Skan const set<_Key, _Compare, _Alloc>& __y) 523132720Skan { return __x._M_t == __y._M_t; } 524132720Skan 525132720Skan /** 526132720Skan * @brief Set ordering relation. 527132720Skan * @param x A %set. 528132720Skan * @param y A %set of the same type as @a x. 529132720Skan * @return True iff @a x is lexicographically less than @a y. 530132720Skan * 531132720Skan * This is a total ordering relation. It is linear in the size of the 532132720Skan * maps. The elements must be comparable with @c <. 533132720Skan * 534132720Skan * See std::lexicographical_compare() for how the determination is made. 535132720Skan */ 536132720Skan template<class _Key, class _Compare, class _Alloc> 537132720Skan inline bool 538169691Skan operator<(const set<_Key, _Compare, _Alloc>& __x, 539169691Skan const set<_Key, _Compare, _Alloc>& __y) 540132720Skan { return __x._M_t < __y._M_t; } 541132720Skan 542132720Skan /// Returns !(x == y). 543132720Skan template<class _Key, class _Compare, class _Alloc> 544132720Skan inline bool 545169691Skan operator!=(const set<_Key, _Compare, _Alloc>& __x, 546169691Skan const set<_Key, _Compare, _Alloc>& __y) 547132720Skan { return !(__x == __y); } 548132720Skan 549132720Skan /// Returns y < x. 550132720Skan template<class _Key, class _Compare, class _Alloc> 551132720Skan inline bool 552169691Skan operator>(const set<_Key, _Compare, _Alloc>& __x, 553169691Skan const set<_Key, _Compare, _Alloc>& __y) 554132720Skan { return __y < __x; } 555132720Skan 556132720Skan /// Returns !(y < x) 557132720Skan template<class _Key, class _Compare, class _Alloc> 558132720Skan inline bool 559169691Skan operator<=(const set<_Key, _Compare, _Alloc>& __x, 560169691Skan const set<_Key, _Compare, _Alloc>& __y) 561132720Skan { return !(__y < __x); } 562132720Skan 563132720Skan /// Returns !(x < y) 564132720Skan template<class _Key, class _Compare, class _Alloc> 565132720Skan inline bool 566169691Skan operator>=(const set<_Key, _Compare, _Alloc>& __x, 567169691Skan const set<_Key, _Compare, _Alloc>& __y) 568132720Skan { return !(__x < __y); } 569132720Skan 570132720Skan /// See std::set::swap(). 571132720Skan template<class _Key, class _Compare, class _Alloc> 572132720Skan inline void 573169691Skan swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) 574132720Skan { __x.swap(__y); } 575132720Skan 576169691Skan_GLIBCXX_END_NESTED_NAMESPACE 57797403Sobrien 578132720Skan#endif /* _SET_H */ 579