stl_multimap.h

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

Generated on Tue Dec 2 03:59:28 2008 for libstdc++ by  doxygen 1.5.7.1