00001 // Multimap implementation -*- C++ -*- 00002 00003 // Copyright (C) 2001, 2002 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_multimap.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 __GLIBCPP_INTERNAL_MULTIMAP_H 00062 #define __GLIBCPP_INTERNAL_MULTIMAP_H 00063 00064 #include <bits/concept_check.h> 00065 00066 namespace std 00067 { 00068 // Forward declaration of operators < and ==, needed for friend declaration. 00069 00070 template <typename _Key, typename _Tp, 00071 typename _Compare = less<_Key>, 00072 typename _Alloc = allocator<pair<const _Key, _Tp> > > 00073 class multimap; 00074 00075 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00076 inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00077 const multimap<_Key,_Tp,_Compare,_Alloc>& __y); 00078 00079 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00080 inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00081 const multimap<_Key,_Tp,_Compare,_Alloc>& __y); 00082 00083 /** 00084 * @brief A standard container made up of (key,value) pairs, which can be 00085 * retrieved based on a key, in logarithmic time. 00086 * 00087 * @ingroup Containers 00088 * @ingroup Assoc_containers 00089 * 00090 * Meets the requirements of a <a href="tables.html#65">container</a>, a 00091 * <a href="tables.html#66">reversible container</a>, and an 00092 * <a href="tables.html#69">associative container</a> (using equivalent 00093 * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type 00094 * is T, and the value_type is std::pair<const Key,T>. 00095 * 00096 * Multimaps support bidirectional iterators. 00097 * 00098 * @if maint 00099 * The private tree data is declared exactly the same way for map and 00100 * multimap; the distinction is made entirely in how the tree functions are 00101 * called (*_unique versus *_equal, same as the standard). 00102 * @endif 00103 */ 00104 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00105 class multimap 00106 { 00107 // concept requirements 00108 __glibcpp_class_requires(_Tp, _SGIAssignableConcept) 00109 __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) 00110 00111 public: 00112 typedef _Key key_type; 00113 typedef _Tp mapped_type; 00114 typedef pair<const _Key, _Tp> value_type; 00115 typedef _Compare key_compare; 00116 00117 class value_compare 00118 : public binary_function<value_type, value_type, bool> 00119 { 00120 friend class multimap<_Key,_Tp,_Compare,_Alloc>; 00121 protected: 00122 _Compare comp; 00123 value_compare(_Compare __c) : comp(__c) {} 00124 public: 00125 bool operator()(const value_type& __x, const value_type& __y) const 00126 { return comp(__x.first, __y.first); } 00127 }; 00128 00129 private: 00130 /// @if maint This turns a red-black tree into a [multi]map. @endif 00131 typedef _Rb_tree<key_type, value_type, 00132 _Select1st<value_type>, key_compare, _Alloc> _Rep_type; 00133 /// @if maint The actual tree structure. @endif 00134 _Rep_type _M_t; 00135 00136 public: 00137 // many of these are specified differently in ISO, but the following are 00138 // "functionally equivalent" 00139 typedef typename _Rep_type::allocator_type allocator_type; 00140 typedef typename _Rep_type::reference reference; 00141 typedef typename _Rep_type::const_reference const_reference; 00142 typedef typename _Rep_type::iterator iterator; 00143 typedef typename _Rep_type::const_iterator const_iterator; 00144 typedef typename _Rep_type::size_type size_type; 00145 typedef typename _Rep_type::difference_type difference_type; 00146 typedef typename _Rep_type::pointer pointer; 00147 typedef typename _Rep_type::const_pointer const_pointer; 00148 typedef typename _Rep_type::reverse_iterator reverse_iterator; 00149 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; 00150 00151 00152 // [23.3.2] construct/copy/destroy 00153 // (get_allocator() is also listed in this section) 00154 /** 00155 * @brief Default constructor creates no elements. 00156 */ 00157 multimap() : _M_t(_Compare(), allocator_type()) { } 00158 00159 // for some reason this was made a separate function 00160 /** 00161 * @brief Default constructor creates no elements. 00162 */ 00163 explicit 00164 multimap(const _Compare& __comp, const allocator_type& __a = allocator_type()) 00165 : _M_t(__comp, __a) { } 00166 00167 /** 00168 * @brief %Multimap copy constructor. 00169 * @param x A %multimap of identical element and allocator types. 00170 * 00171 * The newly-created %multimap uses a copy of the allocation object used 00172 * by @a x. 00173 */ 00174 multimap(const multimap& __x) 00175 : _M_t(__x._M_t) { } 00176 00177 /** 00178 * @brief Builds a %multimap from a range. 00179 * @param first An input iterator. 00180 * @param last An input iterator. 00181 * 00182 * Create a %multimap consisting of copies of the elements from 00183 * [first,last). This is linear in N if the range is already sorted, 00184 * and NlogN otherwise (where N is distance(first,last)). 00185 */ 00186 template <typename _InputIterator> 00187 multimap(_InputIterator __first, _InputIterator __last) 00188 : _M_t(_Compare(), allocator_type()) 00189 { _M_t.insert_equal(__first, __last); } 00190 00191 /** 00192 * @brief Builds a %multimap from a range. 00193 * @param first An input iterator. 00194 * @param last An input iterator. 00195 * @param comp A comparison functor. 00196 * @param a An allocator object. 00197 * 00198 * Create a %multimap consisting of copies of the elements from 00199 * [first,last). This is linear in N if the range is already sorted, 00200 * and NlogN otherwise (where N is distance(first,last)). 00201 */ 00202 template <typename _InputIterator> 00203 multimap(_InputIterator __first, _InputIterator __last, 00204 const _Compare& __comp, 00205 const allocator_type& __a = allocator_type()) 00206 : _M_t(__comp, __a) 00207 { _M_t.insert_equal(__first, __last); } 00208 00209 // FIXME There is no dtor declared, but we should have something generated 00210 // by Doxygen. I don't know what tags to add to this paragraph to make 00211 // that happen: 00212 /** 00213 * The dtor only erases the elements, and note that if the elements 00214 * themselves are pointers, the pointed-to memory is not touched in any 00215 * way. Managing the pointer is the user's responsibilty. 00216 */ 00217 00218 /** 00219 * @brief %Multimap assignment operator. 00220 * @param x A %multimap of identical element and allocator types. 00221 * 00222 * All the elements of @a x are copied, but unlike the copy constructor, 00223 * the allocator object is not copied. 00224 */ 00225 multimap& 00226 operator=(const multimap& __x) 00227 { 00228 _M_t = __x._M_t; 00229 return *this; 00230 } 00231 00232 /// Get a copy of the memory allocation object. 00233 allocator_type 00234 get_allocator() const { return _M_t.get_allocator(); } 00235 00236 // iterators 00237 /** 00238 * Returns a read/write iterator that points to the first pair in the 00239 * %multimap. Iteration is done in ascending order according to the keys. 00240 */ 00241 iterator 00242 begin() { return _M_t.begin(); } 00243 00244 /** 00245 * Returns a read-only (constant) iterator that points to the first pair 00246 * in the %multimap. Iteration is done in ascending order according to the 00247 * keys. 00248 */ 00249 const_iterator 00250 begin() const { return _M_t.begin(); } 00251 00252 /** 00253 * Returns a read/write iterator that points one past the last pair in the 00254 * %multimap. Iteration is done in ascending order according to the keys. 00255 */ 00256 iterator 00257 end() { return _M_t.end(); } 00258 00259 /** 00260 * Returns a read-only (constant) iterator that points one past the last 00261 * pair in the %multimap. Iteration is done in ascending order according 00262 * to the keys. 00263 */ 00264 const_iterator 00265 end() const { return _M_t.end(); } 00266 00267 /** 00268 * Returns a read/write reverse iterator that points to the last pair in 00269 * the %multimap. Iteration is done in descending order according to the 00270 * keys. 00271 */ 00272 reverse_iterator 00273 rbegin() { return _M_t.rbegin(); } 00274 00275 /** 00276 * Returns a read-only (constant) reverse iterator that points to the last 00277 * pair in the %multimap. Iteration is done in descending order according 00278 * to the keys. 00279 */ 00280 const_reverse_iterator 00281 rbegin() const { return _M_t.rbegin(); } 00282 00283 /** 00284 * Returns a read/write reverse iterator that points to one before the 00285 * first pair in the %multimap. Iteration is done in descending order 00286 * according to the keys. 00287 */ 00288 reverse_iterator 00289 rend() { return _M_t.rend(); } 00290 00291 /** 00292 * Returns a read-only (constant) reverse iterator that points to one 00293 * before the first pair in the %multimap. Iteration is done in descending 00294 * order according to the keys. 00295 */ 00296 const_reverse_iterator 00297 rend() const { return _M_t.rend(); } 00298 00299 // capacity 00300 /** Returns true if the %multimap is empty. */ 00301 bool 00302 empty() const { return _M_t.empty(); } 00303 00304 /** Returns the size of the %multimap. */ 00305 size_type 00306 size() const { return _M_t.size(); } 00307 00308 /** Returns the maximum size of the %multimap. */ 00309 size_type 00310 max_size() const { return _M_t.max_size(); } 00311 00312 // modifiers 00313 /** 00314 * @brief Inserts a std::pair into the %multimap. 00315 * @param x Pair to be inserted (see std::make_pair for easy creation of 00316 * pairs). 00317 * @return An iterator that points to the inserted (key,value) pair. 00318 * 00319 * This function inserts a (key, value) pair into the %multimap. Contrary 00320 * to a std::map the %multimap does not rely on unique keys and thus 00321 * multiple pairs with the same key can be inserted. 00322 * 00323 * Insertion requires logarithmic time. 00324 */ 00325 iterator 00326 insert(const value_type& __x) { return _M_t.insert_equal(__x); } 00327 00328 /** 00329 * @brief Inserts a std::pair into the %multimap. 00330 * @param position An iterator that serves as a hint as to where the 00331 * pair should be inserted. 00332 * @param x Pair to be inserted (see std::make_pair for easy creation of 00333 * pairs). 00334 * @return An iterator that points to the inserted (key,value) pair. 00335 * 00336 * This function inserts a (key, value) pair into the %multimap. Contrary 00337 * to a std::map the %multimap does not rely on unique keys and thus 00338 * multiple pairs with the same key can be inserted. 00339 * Note that the first parameter is only a hint and can potentially 00340 * improve the performance of the insertion process. A bad hint would 00341 * cause no gains in efficiency. 00342 * 00343 * See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4 00344 * for more on "hinting". 00345 * 00346 * Insertion requires logarithmic time (if the hint is not taken). 00347 */ 00348 iterator 00349 insert(iterator __position, const value_type& __x) 00350 { return _M_t.insert_equal(__position, __x); } 00351 00352 /** 00353 * @brief A template function that attemps to insert a range of elements. 00354 * @param first Iterator pointing to the start of the range to be 00355 * inserted. 00356 * @param last Iterator pointing to the end of the range. 00357 * 00358 * Complexity similar to that of the range constructor. 00359 */ 00360 template <typename _InputIterator> 00361 void 00362 insert(_InputIterator __first, _InputIterator __last) 00363 { _M_t.insert_equal(__first, __last); } 00364 00365 /** 00366 * @brief Erases an element from a %multimap. 00367 * @param position An iterator pointing to the element to be erased. 00368 * 00369 * This function erases an element, pointed to by the given iterator, from 00370 * a %multimap. Note that this function only erases the element, and that 00371 * if the element is itself a pointer, the pointed-to memory is not 00372 * touched in any way. Managing the pointer is the user's responsibilty. 00373 */ 00374 void 00375 erase(iterator __position) { _M_t.erase(__position); } 00376 00377 /** 00378 * @brief Erases elements according to the provided key. 00379 * @param x Key of element to be erased. 00380 * @return The number of elements erased. 00381 * 00382 * This function erases all elements located by the given key from a 00383 * %multimap. 00384 * Note that this function only erases the element, and that if 00385 * the element is itself a pointer, the pointed-to memory is not touched 00386 * in any way. Managing the pointer is the user's responsibilty. 00387 */ 00388 size_type 00389 erase(const key_type& __x) { return _M_t.erase(__x); } 00390 00391 /** 00392 * @brief Erases a [first,last) range of elements from a %multimap. 00393 * @param first Iterator pointing to the start of the range to be erased. 00394 * @param last Iterator pointing to the end of the range to be erased. 00395 * 00396 * This function erases a sequence of elements from a %multimap. 00397 * Note that this function only erases the elements, and that if 00398 * the elements themselves are pointers, the pointed-to memory is not 00399 * touched in any way. Managing the pointer is the user's responsibilty. 00400 */ 00401 void 00402 erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } 00403 00404 /** 00405 * @brief Swaps data with another %multimap. 00406 * @param x A %multimap of the same element and allocator types. 00407 * 00408 * This exchanges the elements between two multimaps in constant time. 00409 * (It is only swapping a pointer, an integer, and an instance of 00410 * the @c Compare type (which itself is often stateless and empty), so it 00411 * should be quite fast.) 00412 * Note that the global std::swap() function is specialized such that 00413 * std::swap(m1,m2) will feed to this function. 00414 */ 00415 void 00416 swap(multimap& __x) { _M_t.swap(__x._M_t); } 00417 00418 /** 00419 * Erases all elements in a %multimap. Note that this function only erases 00420 * the elements, and that if the elements themselves are pointers, the 00421 * pointed-to memory is not touched in any way. Managing the pointer is 00422 * the user's responsibilty. 00423 */ 00424 void 00425 clear() { _M_t.clear(); } 00426 00427 // observers 00428 /** 00429 * Returns the key comparison object out of which the %multimap 00430 * was constructed. 00431 */ 00432 key_compare 00433 key_comp() const { return _M_t.key_comp(); } 00434 00435 /** 00436 * Returns a value comparison object, built from the key comparison 00437 * object out of which the %multimap was constructed. 00438 */ 00439 value_compare 00440 value_comp() const { return value_compare(_M_t.key_comp()); } 00441 00442 // multimap operations 00443 /** 00444 * @brief Tries to locate an element in a %multimap. 00445 * @param x Key of (key, value) pair to be located. 00446 * @return Iterator pointing to sought-after element, 00447 * or end() if not found. 00448 * 00449 * This function takes a key and tries to locate the element with which 00450 * the key matches. If successful the function returns an iterator 00451 * pointing to the sought after %pair. If unsuccessful it returns the 00452 * past-the-end ( @c end() ) iterator. 00453 */ 00454 iterator 00455 find(const key_type& __x) { return _M_t.find(__x); } 00456 00457 /** 00458 * @brief Tries to locate an element in a %multimap. 00459 * @param x Key of (key, value) pair to be located. 00460 * @return Read-only (constant) iterator pointing to sought-after 00461 * element, or end() if not found. 00462 * 00463 * This function takes a key and tries to locate the element with which 00464 * the key matches. If successful the function returns a constant iterator 00465 * pointing to the sought after %pair. If unsuccessful it returns the 00466 * past-the-end ( @c end() ) iterator. 00467 */ 00468 const_iterator 00469 find(const key_type& __x) const { return _M_t.find(__x); } 00470 00471 /** 00472 * @brief Finds the number of elements with given key. 00473 * @param x Key of (key, value) pairs to be located. 00474 * @return Number of elements with specified key. 00475 */ 00476 size_type 00477 count(const key_type& __x) const { return _M_t.count(__x); } 00478 00479 /** 00480 * @brief Finds the beginning of a subsequence matching given key. 00481 * @param x Key of (key, value) pair to be located. 00482 * @return Iterator pointing to first element matching given key, or 00483 * end() if not found. 00484 * 00485 * This function returns the first element of a subsequence of elements 00486 * that matches the given key. If unsuccessful it returns an iterator 00487 * pointing to the first element that has a greater value than given key 00488 * or end() if no such element exists. 00489 */ 00490 iterator 00491 lower_bound(const key_type& __x) { return _M_t.lower_bound(__x); } 00492 00493 /** 00494 * @brief Finds the beginning of a subsequence matching given key. 00495 * @param x Key of (key, value) pair to be located. 00496 * @return Read-only (constant) iterator pointing to first element 00497 * matching given key, or end() if not found. 00498 * 00499 * This function returns the first element of a subsequence of elements 00500 * that matches the given key. If unsuccessful the iterator will point 00501 * to the next greatest element or, if no such greater element exists, to 00502 * end(). 00503 */ 00504 const_iterator 00505 lower_bound(const key_type& __x) const { return _M_t.lower_bound(__x); } 00506 00507 /** 00508 * @brief Finds the end of a subsequence matching given key. 00509 * @param x Key of (key, value) pair to be located. 00510 * @return Iterator pointing to last element matching given key. 00511 */ 00512 iterator 00513 upper_bound(const key_type& __x) { return _M_t.upper_bound(__x); } 00514 00515 /** 00516 * @brief Finds the end of a subsequence matching given key. 00517 * @param x Key of (key, value) pair to be located. 00518 * @return Read-only (constant) iterator pointing to last element matching 00519 * given key. 00520 */ 00521 const_iterator 00522 upper_bound(const key_type& __x) const { return _M_t.upper_bound(__x); } 00523 00524 /** 00525 * @brief Finds a subsequence matching given key. 00526 * @param x Key of (key, value) pairs to be located. 00527 * @return Pair of iterators that possibly points to the subsequence 00528 * matching given key. 00529 * 00530 * This function returns a pair of which the first 00531 * element possibly points to the first element matching the given key 00532 * and the second element possibly points to the last element matching the 00533 * given key. If unsuccessful the first element of the returned pair will 00534 * contain an iterator pointing to the next greatest element or, if no such 00535 * greater element exists, to end(). 00536 */ 00537 pair<iterator,iterator> 00538 equal_range(const key_type& __x) { return _M_t.equal_range(__x); } 00539 00540 /** 00541 * @brief Finds a subsequence matching given key. 00542 * @param x Key of (key, value) pairs to be located. 00543 * @return Pair of read-only (constant) iterators that possibly points to 00544 * the subsequence matching given key. 00545 * 00546 * This function returns a pair of which the first 00547 * element possibly points to the first element matching the given key 00548 * and the second element possibly points to the last element matching the 00549 * given key. If unsuccessful the first element of the returned pair will 00550 * contain an iterator pointing to the next greatest element or, if no such 00551 * a greater element exists, to end(). 00552 */ 00553 pair<const_iterator,const_iterator> 00554 equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } 00555 00556 template <typename _K1, typename _T1, typename _C1, typename _A1> 00557 friend bool operator== (const multimap<_K1,_T1,_C1,_A1>&, 00558 const multimap<_K1,_T1,_C1,_A1>&); 00559 template <typename _K1, typename _T1, typename _C1, typename _A1> 00560 friend bool operator< (const multimap<_K1,_T1,_C1,_A1>&, 00561 const multimap<_K1,_T1,_C1,_A1>&); 00562 }; 00563 00564 00565 /** 00566 * @brief Multimap equality comparison. 00567 * @param x A %multimap. 00568 * @param y A %multimap of the same type as @a x. 00569 * @return True iff the size and elements of the maps are equal. 00570 * 00571 * This is an equivalence relation. It is linear in the size of the 00572 * multimaps. Multimaps are considered equivalent if their sizes are equal, 00573 * and if corresponding elements compare equal. 00574 */ 00575 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00576 inline bool 00577 operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00578 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00579 { 00580 return __x._M_t == __y._M_t; 00581 } 00582 00583 /** 00584 * @brief Multimap ordering relation. 00585 * @param x A %multimap. 00586 * @param y A %multimap of the same type as @a x. 00587 * @return True iff @a x is lexographically less than @a y. 00588 * 00589 * This is a total ordering relation. It is linear in the size of the 00590 * multimaps. The elements must be comparable with @c <. 00591 * 00592 * See std::lexographical_compare() for how the determination is made. 00593 */ 00594 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00595 inline bool 00596 operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00597 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00598 { return __x._M_t < __y._M_t; } 00599 00600 /// Based on operator== 00601 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00602 inline bool 00603 operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00604 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00605 { return !(__x == __y); } 00606 00607 /// Based on operator< 00608 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00609 inline bool 00610 operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00611 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00612 { return __y < __x; } 00613 00614 /// Based on operator< 00615 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00616 inline bool 00617 operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00618 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00619 { return !(__y < __x); } 00620 00621 /// Based on operator< 00622 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00623 inline bool 00624 operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00625 const multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00626 { return !(__x < __y); } 00627 00628 /// See std::multimap::swap(). 00629 template <typename _Key, typename _Tp, typename _Compare, typename _Alloc> 00630 inline void 00631 swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x, 00632 multimap<_Key,_Tp,_Compare,_Alloc>& __y) 00633 { __x.swap(__y); } 00634 } // namespace std 00635 00636 #endif /* __GLIBCPP_INTERNAL_MULTIMAP_H */