stl_map.h

Go to the documentation of this file.
00001 // Map implementation -*- C++ -*- 00002 00003 // Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 2, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // You should have received a copy of the GNU General Public License along 00017 // with this library; see the file COPYING. If not, write to the Free 00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00019 // USA. 00020 00021 // As a special exception, you may use this file as part of a free software 00022 // library without restriction. Specifically, if other files instantiate 00023 // templates or use macros or inline functions from this file, or you compile 00024 // this file and link it with other files to produce an executable, this 00025 // file does not by itself cause the resulting executable to be covered by 00026 // the GNU General Public License. This exception does not however 00027 // invalidate any other reasons why the executable file might be covered by 00028 // the GNU General Public License. 00029 00030 /* 00031 * 00032 * Copyright (c) 1994 00033 * Hewlett-Packard Company 00034 * 00035 * Permission to use, copy, modify, distribute and sell this software 00036 * and its documentation for any purpose is hereby granted without fee, 00037 * provided that the above copyright notice appear in all copies and 00038 * that both that copyright notice and this permission notice appear 00039 * in supporting documentation. Hewlett-Packard Company makes no 00040 * representations about the suitability of this software for any 00041 * purpose. It is provided "as is" without express or implied warranty. 00042 * 00043 * 00044 * Copyright (c) 1996,1997 00045 * Silicon Graphics Computer Systems, Inc. 00046 * 00047 * Permission to use, copy, modify, distribute and sell this software 00048 * and its documentation for any purpose is hereby granted without fee, 00049 * provided that the above copyright notice appear in all copies and 00050 * that both that copyright notice and this permission notice appear 00051 * in supporting documentation. Silicon Graphics makes no 00052 * representations about the suitability of this software for any 00053 * purpose. It is provided "as is" without express or implied warranty. 00054 */ 00055 00056 /** @file stl_map.h 00057 * This is an internal header file, included by other library headers. 00058 * You should not attempt to use it directly. 00059 */ 00060 00061 #ifndef _MAP_H 00062 #define _MAP_H 1 00063 00064 #include <bits/concept_check.h> 00065 00066 namespace _GLIBCXX_STD 00067 { 00068 /** 00069 * @brief A standard container made up of (key,value) pairs, which can be 00070 * retrieved based on a key, in logarithmic time. 00071 * 00072 * @ingroup Containers 00073 * @ingroup Assoc_containers 00074 * 00075 * Meets the requirements of a <a href="tables.html#65">container</a>, a 00076 * <a href="tables.html#66">reversible container</a>, and an 00077 * <a href="tables.html#69">associative container</a> (using unique keys). 00078 * For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the 00079 * value_type is std::pair<const Key,T>. 00080 * 00081 * Maps support bidirectional iterators. 00082 * 00083 * @if maint 00084 * The private tree data is declared exactly the same way for map and 00085 * multimap; the distinction is made entirely in how the tree functions are 00086 * called (*_unique versus *_equal, same as the standard). 00087 * @endif 00088 */ 00089 template <typename _Key, typename _Tp, typename _Compare = less<_Key>, 00090 typename _Alloc = allocator<pair<const _Key, _Tp> > > 00091 class map 00092 { 00093 // concept requirements 00094 __glibcxx_class_requires(_Tp, _SGIAssignableConcept) 00095 __glibcxx_class_requires4(_Compare, bool, _Key, _Key, 00096 _BinaryFunctionConcept) 00097 00098 public: 00099 typedef _Key key_type; 00100 typedef _Tp mapped_type; 00101 typedef pair<const _Key, _Tp> value_type; 00102 typedef _Compare key_compare; 00103 00104 class value_compare 00105 : public binary_function<value_type, value_type, bool> 00106 { 00107 friend class map<_Key,_Tp,_Compare,_Alloc>; 00108 protected: 00109 _Compare comp; 00110 00111 value_compare(_Compare __c) 00112 : comp(__c) { } 00113 00114 public: 00115 bool operator()(const value_type& __x, const value_type& __y) const 00116 { return comp(__x.first, __y.first); } 00117 }; 00118 00119 private: 00120 /// @if maint This turns a red-black tree into a [multi]map. @endif 00121 typedef _Rb_tree<key_type, value_type, 00122 _Select1st<value_type>, key_compare, _Alloc> _Rep_type; 00123 /// @if maint The actual tree structure. @endif 00124 _Rep_type _M_t; 00125 00126 public: 00127 // many of these are specified differently in ISO, but the following are 00128 // "functionally equivalent" 00129 typedef typename _Rep_type::allocator_type allocator_type; 00130 typedef typename _Rep_type::reference reference; 00131 typedef typename _Rep_type::const_reference const_reference; 00132 typedef typename _Rep_type::iterator iterator; 00133 typedef typename _Rep_type::const_iterator const_iterator; 00134 typedef typename _Rep_type::size_type size_type; 00135 typedef typename _Rep_type::difference_type difference_type; 00136 typedef typename _Rep_type::pointer pointer; 00137 typedef typename _Rep_type::const_pointer const_pointer; 00138 typedef typename _Rep_type::reverse_iterator reverse_iterator; 00139 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; 00140 00141 // [23.3.1.1] construct/copy/destroy 00142 // (get_allocator() is normally listed in this section, but seems to have 00143 // been accidentally omitted in the printed standard) 00144 /** 00145 * @brief Default constructor creates no elements. 00146 */ 00147 map() 00148 : _M_t(_Compare(), allocator_type()) { } 00149 00150 // for some reason this was made a separate function 00151 /** 00152 * @brief Default constructor creates no elements. 00153 */ 00154 explicit 00155 map(const _Compare& __comp, const allocator_type& __a = allocator_type()) 00156 : _M_t(__comp, __a) { } 00157 00158 /** 00159 * @brief Map copy constructor. 00160 * @param x A %map of identical element and allocator types. 00161 * 00162 * The newly-created %map uses a copy of the allocation object used 00163 * by @a x. 00164 */ 00165 map(const map& __x) 00166 : _M_t(__x._M_t) { } 00167 00168 /** 00169 * @brief Builds a %map from a range. 00170 * @param first An input iterator. 00171 * @param last An input iterator. 00172 * 00173 * Create a %map consisting of copies of the elements from [first,last). 00174 * This is linear in N if the range is already sorted, and NlogN 00175 * otherwise (where N is distance(first,last)). 00176 */ 00177 template <typename _InputIterator> 00178 map(_InputIterator __first, _InputIterator __last) 00179 : _M_t(_Compare(), allocator_type()) 00180 { _M_t.insert_unique(__first, __last); } 00181 00182 /** 00183 * @brief Builds a %map from a range. 00184 * @param first An input iterator. 00185 * @param last An input iterator. 00186 * @param comp A comparison functor. 00187 * @param a An allocator object. 00188 * 00189 * Create a %map consisting of copies of the elements from [first,last). 00190 * This is linear in N if the range is already sorted, and NlogN 00191 * otherwise (where N is distance(first,last)). 00192 */ 00193 template <typename _InputIterator> 00194 map(_InputIterator __first, _InputIterator __last, 00195 const _Compare& __comp, const allocator_type& __a = allocator_type()) 00196 : _M_t(__comp, __a) 00197 { _M_t.insert_unique(__first, __last); } 00198 00199 // FIXME There is no dtor declared, but we should have something generated 00200 // by Doxygen. I don't know what tags to add to this paragraph to make 00201 // that happen: 00202 /** 00203 * The dtor only erases the elements, and note that if the elements 00204 * themselves are pointers, the pointed-to memory is not touched in any 00205 * way. Managing the pointer is the user's responsibilty. 00206 */ 00207 00208 /** 00209 * @brief Map assignment operator. 00210 * @param x A %map of identical element and allocator types. 00211 * 00212 * All the elements of @a x are copied, but unlike the copy constructor, 00213 * the allocator object is not copied. 00214 */ 00215 map& 00216 operator=(const map& __x) 00217 { 00218 _M_t = __x._M_t; 00219 return *this; 00220 } 00221 00222 /// Get a copy of the memory allocation object. 00223 allocator_type 00224 get_allocator() const 00225 { return _M_t.get_allocator(); } 00226 00227 // iterators 00228 /** 00229 * Returns a read/write iterator that points to the first pair in the 00230 * %map. 00231 * Iteration is done in ascending order according to the keys. 00232 */ 00233 iterator 00234 begin() 00235 { return _M_t.begin(); } 00236 00237 /** 00238 * Returns a read-only (constant) iterator that points to the first pair 00239 * in the %map. Iteration is done in ascending order according to the 00240 * keys. 00241 */ 00242 const_iterator 00243 begin() const 00244 { return _M_t.begin(); } 00245 00246 /** 00247 * Returns a read/write iterator that points one past the last pair in 00248 * the %map. Iteration is done in ascending order according to the keys. 00249 */ 00250 iterator 00251 end() 00252 { return _M_t.end(); } 00253 00254 /** 00255 * Returns a read-only (constant) iterator that points one past the last 00256 * pair in the %map. Iteration is done in ascending order according to 00257 * the keys. 00258 */ 00259 const_iterator 00260 end() const 00261 { return _M_t.end(); } 00262 00263 /** 00264 * Returns a read/write reverse iterator that points to the last pair in 00265 * the %map. Iteration is done in descending order according to the 00266 * keys. 00267 */ 00268 reverse_iterator 00269 rbegin() 00270 { return _M_t.rbegin(); } 00271 00272 /** 00273 * Returns a read-only (constant) reverse iterator that points to the 00274 * last pair in the %map. Iteration is done in descending order 00275 * according to the keys. 00276 */ 00277 const_reverse_iterator 00278 rbegin() const 00279 { return _M_t.rbegin(); } 00280 00281 /** 00282 * Returns a read/write reverse iterator that points to one before the 00283 * first pair in the %map. Iteration is done in descending order 00284 * according to the keys. 00285 */ 00286 reverse_iterator 00287 rend() 00288 { return _M_t.rend(); } 00289 00290 /** 00291 * Returns a read-only (constant) reverse iterator that points to one 00292 * before the first pair in the %map. Iteration is done in descending 00293 * order according to the keys. 00294 */ 00295 const_reverse_iterator 00296 rend() const 00297 { return _M_t.rend(); } 00298 00299 // capacity 00300 /** Returns true if the %map is empty. (Thus begin() would equal 00301 * end().) 00302 */ 00303 bool 00304 empty() const 00305 { return _M_t.empty(); } 00306 00307 /** Returns the size of the %map. */ 00308 size_type 00309 size() const 00310 { return _M_t.size(); } 00311 00312 /** Returns the maximum size of the %map. */ 00313 size_type 00314 max_size() const 00315 { return _M_t.max_size(); } 00316 00317 // [23.3.1.2] element access 00318 /** 00319 * @brief Subscript ( @c [] ) access to %map data. 00320 * @param k The key for which data should be retrieved. 00321 * @return A reference to the data of the (key,data) %pair. 00322 * 00323 * Allows for easy lookup with the subscript ( @c [] ) operator. Returns 00324 * data associated with the key specified in subscript. If the key does 00325 * not exist, a pair with that key is created using default values, which 00326 * is then returned. 00327 * 00328 * Lookup requires logarithmic time. 00329 */ 00330 mapped_type& 00331 operator[](const key_type& __k) 00332 { 00333 // concept requirements 00334 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>) 00335 00336 iterator __i = lower_bound(__k); 00337 // __i->first is greater than or equivalent to __k. 00338 if (__i == end() || key_comp()(__k, (*__i).first)) 00339 __i = insert(__i, value_type(__k, mapped_type())); 00340 return (*__i).second; 00341 } 00342 00343 // modifiers 00344 /** 00345 * @brief Attempts to insert a std::pair into the %map. 00346 * @param x Pair to be inserted (see std::make_pair for easy creation of 00347 * pairs). 00348 * @return A pair, of which the first element is an iterator that points 00349 * to the possibly inserted pair, and the second is a bool that 00350 * is true if the pair was actually inserted. 00351 * 00352 * This function attempts to insert a (key, value) %pair into the %map. 00353 * A %map relies on unique keys and thus a %pair is only inserted if its 00354 * first element (the key) is not already present in the %map. 00355 * 00356 * Insertion requires logarithmic time. 00357 */ 00358 pair<iterator,bool> 00359 insert(const value_type& __x) 00360 { return _M_t.insert_unique(__x); } 00361 00362 /** 00363 * @brief Attempts to insert a std::pair into the %map. 00364 * @param position An iterator that serves as a hint as to where the 00365 * pair should be inserted. 00366 * @param x Pair to be inserted (see std::make_pair for easy creation of 00367 * pairs). 00368 * @return An iterator that points to the element with key of @a x (may 00369 * or may not be the %pair passed in). 00370 * 00371 * This function is not concerned about whether the insertion took place, 00372 * and thus does not return a boolean like the single-argument 00373 * insert() does. Note that the first parameter is only a hint and can 00374 * potentially improve the performance of the insertion process. A bad 00375 * hint would cause no gains in efficiency. 00376 * 00377 * See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4 00378 * for more on "hinting". 00379 * 00380 * Insertion requires logarithmic time (if the hint is not taken). 00381 */ 00382 iterator 00383 insert(iterator position, const value_type& __x) 00384 { return _M_t.insert_unique(position, __x); } 00385 00386 /** 00387 * @brief A template function that attemps to insert a range of elements. 00388 * @param first Iterator pointing to the start of the range to be 00389 * inserted. 00390 * @param last Iterator pointing to the end of the range. 00391 * 00392 * Complexity similar to that of the range constructor. 00393 */ 00394 template <typename _InputIterator> 00395 void 00396 insert(_InputIterator __first, _InputIterator __last) 00397 { _M_t.insert_unique(__first, __last); } 00398 00399 /** 00400 * @brief Erases an element from a %map. 00401 * @param position An iterator pointing to the element to be erased. 00402 * 00403 * This function erases an element, pointed to by the given iterator, 00404 * from a %map. Note that this function only erases the element, and 00405 * that if the element is itself a pointer, the pointed-to memory is not 00406 * touched in any way. Managing the pointer is the user's responsibilty. 00407 */ 00408 void 00409 erase(iterator __position) 00410 { _M_t.erase(__position); } 00411 00412 /** 00413 * @brief Erases elements according to the provided key. 00414 * @param x Key of element to be erased. 00415 * @return The number of elements erased. 00416 * 00417 * This function erases all the elements located by the given key from 00418 * a %map. 00419 * Note that this function only erases the element, and that if 00420 * the element is itself a pointer, the pointed-to memory is not touched 00421 * in any way. Managing the pointer is the user's responsibilty. 00422 */ 00423 size_type 00424 erase(const key_type& __x) 00425 { return _M_t.erase(__x); } 00426 00427 /** 00428 * @brief Erases a [first,last) range of elements from a %map. 00429 * @param first Iterator pointing to the start of the range to be 00430 * erased. 00431 * @param last Iterator pointing to the end of the range to be erased. 00432 * 00433 * This function erases a sequence of elements from a %map. 00434 * Note that this function only erases the element, and that if 00435 * the element is itself a pointer, the pointed-to memory is not touched 00436 * in any way. Managing the pointer is the user's responsibilty. 00437 */ 00438 void 00439 erase(iterator __first, iterator __last) 00440 { _M_t.erase(__first, __last); } 00441 00442 /** 00443 * @brief Swaps data with another %map. 00444 * @param x A %map of the same element and allocator types. 00445 * 00446 * This exchanges the elements between two maps in constant time. 00447 * (It is only swapping a pointer, an integer, and an instance of 00448 * the @c Compare type (which itself is often stateless and empty), so it 00449 * should be quite fast.) 00450 * Note that the global std::swap() function is specialized such that 00451 * std::swap(m1,m2) will feed to this function. 00452 */ 00453 void 00454 swap(map& __x) 00455 { _M_t.swap(__x._M_t); } 00456 00457 /** 00458 * Erases all elements in a %map. Note that this function only erases 00459 * the elements, and that if the elements themselves are pointers, the 00460 * pointed-to memory is not touched in any way. Managing the pointer is 00461 * the user's responsibilty. 00462 */ 00463 void 00464 clear() 00465 { _M_t.clear(); } 00466 00467 // observers 00468 /** 00469 * Returns the key comparison object out of which the %map was 00470 * constructed. 00471 */ 00472 key_compare 00473 key_comp() const 00474 { return _M_t.key_comp(); } 00475 00476 /** 00477 * Returns a value comparison object, built from the key comparison 00478 * object out of which the %map was constructed. 00479 */ 00480 value_compare 00481 value_comp() const 00482 { return value_compare(_M_t.key_comp()); } 00483 00484 // [23.3.1.3] map operations 00485 /** 00486 * @brief Tries to locate an element in a %map. 00487 * @param x Key of (key, value) %pair to be located. 00488 * @return Iterator pointing to sought-after element, or end() if not 00489 * found. 00490 * 00491 * This function takes a key and tries to locate the element with which 00492 * the key matches. If successful the function returns an iterator 00493 * pointing to the sought after %pair. If unsuccessful it returns the 00494 * past-the-end ( @c end() ) iterator. 00495 */ 00496 iterator 00497 find(const key_type& __x) 00498 { return _M_t.find(__x); } 00499 00500 /** 00501 * @brief Tries to locate an element in a %map. 00502 * @param x Key of (key, value) %pair to be located. 00503 * @return Read-only (constant) iterator pointing to sought-after 00504 * element, or end() if not found. 00505 * 00506 * This function takes a key and tries to locate the element with which 00507 * the key matches. If successful the function returns a constant 00508 * iterator pointing to the sought after %pair. If unsuccessful it 00509 * returns the past-the-end ( @c end() ) iterator. 00510 */ 00511 const_iterator 00512 find(const key_type& __x) const 00513 { return _M_t.find(__x); } 00514 00515 /** 00516 * @brief Finds the number of elements with given key. 00517 * @param x Key of (key, value) pairs to be located. 00518 * @return Number of elements with specified key. 00519 * 00520 * This function only makes sense for multimaps; for map the result will 00521 * either be 0 (not present) or 1 (present). 00522 */ 00523 size_type 00524 count(const key_type& __x) const 00525 { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } 00526 00527 /** 00528 * @brief Finds the beginning of a subsequence matching given key. 00529 * @param x Key of (key, value) pair to be located. 00530 * @return Iterator pointing to first element equal to or greater 00531 * than key, or end(). 00532 * 00533 * This function returns the first element of a subsequence of elements 00534 * that matches the given key. If unsuccessful it returns an iterator 00535 * pointing to the first element that has a greater value than given key 00536 * or end() if no such element exists. 00537 */ 00538 iterator 00539 lower_bound(const key_type& __x) 00540 { return _M_t.lower_bound(__x); } 00541 00542 /** 00543 * @brief Finds the beginning of a subsequence matching given key. 00544 * @param x Key of (key, value) pair to be located. 00545 * @return Read-only (constant) iterator pointing to first element 00546 * equal to or greater than key, or end(). 00547 * 00548 * This function returns the first element of a subsequence of elements 00549 * that matches the given key. If unsuccessful it returns an iterator 00550 * pointing to the first element that has a greater value than given key 00551 * or end() if no such element exists. 00552 */ 00553 const_iterator 00554 lower_bound(const key_type& __x) const 00555 { return _M_t.lower_bound(__x); } 00556 00557 /** 00558 * @brief Finds the end of a subsequence matching given key. 00559 * @param x Key of (key, value) pair to be located. 00560 * @return Iterator pointing to the first element 00561 * greater than key, or end(). 00562 */ 00563 iterator 00564 upper_bound(const key_type& __x) 00565 { return _M_t.upper_bound(__x); } 00566 00567 /** 00568 * @brief Finds the end of a subsequence matching given key. 00569 * @param x Key of (key, value) pair to be located. 00570 * @return Read-only (constant) iterator pointing to first iterator 00571 * greater than key, or end(). 00572 */ 00573 const_iterator 00574 upper_bound(const key_type& __x) const 00575 { return _M_t.upper_bound(__x); } 00576 00577 /** 00578 * @brief Finds a subsequence matching given key. 00579 * @param x Key of (key, value) pairs to be located. 00580 * @return Pair of iterators that possibly points to the subsequence 00581 * matching given key. 00582 * 00583 * This function is equivalent to 00584 * @code 00585 * std::make_pair(c.lower_bound(val), 00586 * c.upper_bound(val)) 00587 * @endcode 00588 * (but is faster than making the calls separately). 00589 * 00590 * This function probably only makes sense for multimaps. 00591 */ 00592 pair<iterator,iterator> 00593 equal_range(const key_type& __x) 00594 { return _M_t.equal_range(__x); } 00595 00596 /** 00597 * @brief Finds a subsequence matching given key. 00598 * @param x Key of (key, value) pairs to be located. 00599 * @return Pair of read-only (constant) iterators that possibly points 00600 * to the subsequence matching given key. 00601 * 00602 * This function is equivalent to 00603 * @code 00604 * std::make_pair(c.lower_bound(val), 00605 * c.upper_bound(val)) 00606 * @endcode 00607 * (but is faster than making the calls separately). 00608 * 00609 * This function probably only makes sense for multimaps. 00610 */ 00611 pair<const_iterator,const_iterator> 00612 equal_range(const key_type& __x) const 00613 { return _M_t.equal_range(__x); } 00614 00615 template <typename _K1, typename _T1, typename _C1, typename _A1> 00616 friend bool 00617 operator== (const map<_K1,_T1,_C1,_A1>&, 00618 const map<_K1,_T1,_C1,_A1>&); 00619 00620 template <typename _K1, typename _T1, typename _C1, typename _A1> 00621 friend bool 00622 operator< (const map<_K1,_T1,_C1,_A1>&, 00623 const map<_K1,_T1,_C1,_A1>&); 00624 }; 00625 00626 /** 00627 * @brief Map equality comparison. 00628 * @param x A %map. 00629 * @param y A %map of the same type as @a x. 00630 * @return True iff the size and elements of the maps are equal. 00631 * 00632 * This is an equivalence relation. It is linear in the size of the 00633 * maps. Maps are considered equivalent if their sizes are equal, 00634 * and if corresponding elements compare equal. 00635 */ 00636 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00637 inline bool 00638 operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00639 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00640 { return __x._M_t == __y._M_t; } 00641 00642 /** 00643 * @brief Map ordering relation. 00644 * @param x A %map. 00645 * @param y A %map of the same type as @a x. 00646 * @return True iff @a x is lexicographically less than @a y. 00647 * 00648 * This is a total ordering relation. It is linear in the size of the 00649 * maps. The elements must be comparable with @c <. 00650 * 00651 * See std::lexicographical_compare() for how the determination is made. 00652 */ 00653 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00654 inline bool 00655 operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00656 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00657 { return __x._M_t < __y._M_t; } 00658 00659 /// Based on operator== 00660 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00661 inline bool 00662 operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00663 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00664 { return !(__x == __y); } 00665 00666 /// Based on operator< 00667 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00668 inline bool 00669 operator>(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00670 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00671 { return __y < __x; } 00672 00673 /// Based on operator< 00674 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00675 inline bool 00676 operator<=(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00677 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00678 { return !(__y < __x); } 00679 00680 /// Based on operator< 00681 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00682 inline bool 00683 operator>=(const map<_Key,_Tp,_Compare,_Alloc>& __x, 00684 const map<_Key,_Tp,_Compare,_Alloc>& __y) 00685 { return !(__x < __y); } 00686 00687 /// See std::map::swap(). 00688 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00689 inline void 00690 swap(map<_Key,_Tp,_Compare,_Alloc>& __x, map<_Key,_Tp,_Compare,_Alloc>& __y) 00691 { __x.swap(__y); } 00692 } // namespace std 00693 00694 #endif /* _MAP_H */

Generated on Wed Jun 9 11:19:08 2004 for libstdc++-v3 Source by doxygen 1.3.7