# stl_multimap.h

Go to the documentation of this file.

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