OSDN Git Service

2005-08-17 Kelley Cook <kcook@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / bits / stl_map.h
1 // Map implementation -*- C++ -*-
2
3 // Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING.  If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // USA.
20
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction.  Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License.  This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
29
30 /*
31  *
32  * Copyright (c) 1994
33  * Hewlett-Packard Company
34  *
35  * Permission to use, copy, modify, distribute and sell this software
36  * and its documentation for any purpose is hereby granted without fee,
37  * provided that the above copyright notice appear in all copies and
38  * that both that copyright notice and this permission notice appear
39  * in supporting documentation.  Hewlett-Packard Company makes no
40  * representations about the suitability of this software for any
41  * purpose.  It is provided "as is" without express or implied warranty.
42  *
43  *
44  * Copyright (c) 1996,1997
45  * Silicon Graphics Computer Systems, Inc.
46  *
47  * Permission to use, copy, modify, distribute and sell this software
48  * and its documentation for any purpose is hereby granted without fee,
49  * provided that the above copyright notice appear in all copies and
50  * that both that copyright notice and this permission notice appear
51  * in supporting documentation.  Silicon Graphics makes no
52  * representations about the suitability of this software for any
53  * purpose.  It is provided "as is" without express or implied warranty.
54  */
55
56 /** @file stl_map.h
57  *  This is an internal header file, included by other library headers.
58  *  You should not attempt to use it directly.
59  */
60
61 #ifndef _MAP_H
62 #define _MAP_H 1
63
64 #include <bits/concept_check.h>
65
66 namespace _GLIBCXX_STD
67 {
68   /**
69    *  @brief A standard container made up of (key,value) pairs, which can be
70    *  retrieved based on a key, in logarithmic time.
71    *
72    *  @ingroup Containers
73    *  @ingroup Assoc_containers
74    *
75    *  Meets the requirements of a <a href="tables.html#65">container</a>, a
76    *  <a href="tables.html#66">reversible container</a>, and an
77    *  <a href="tables.html#69">associative container</a> (using unique keys).
78    *  For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the
79    *  value_type is std::pair<const Key,T>.
80    *
81    *  Maps support bidirectional iterators.
82    *
83    *  @if maint
84    *  The private tree data is declared exactly the same way for map and
85    *  multimap; the distinction is made entirely in how the tree functions are
86    *  called (*_unique versus *_equal, same as the standard).
87    *  @endif
88   */
89   template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
90             typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
91     class map
92     {
93     public:
94       typedef _Key                                          key_type;
95       typedef _Tp                                           mapped_type;
96       typedef std::pair<const _Key, _Tp>                    value_type;
97       typedef _Compare                                      key_compare;
98       typedef _Alloc                                        allocator_type;
99
100     private:
101       // concept requirements
102       typedef typename _Alloc::value_type                   _Alloc_value_type;
103       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
104       __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
105                                 _BinaryFunctionConcept)
106       __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
107
108     public:
109       class value_compare
110       : public std::binary_function<value_type, value_type, bool>
111       {
112         friend class map<_Key, _Tp, _Compare, _Alloc>;
113       protected:
114         _Compare comp;
115
116         value_compare(_Compare __c)
117         : comp(__c) { }
118
119       public:
120         bool operator()(const value_type& __x, const value_type& __y) const
121         { return comp(__x.first, __y.first); }
122       };
123
124     private:
125       /// @if maint  This turns a red-black tree into a [multi]map.  @endif
126       typedef typename _Alloc::template rebind<value_type>::other 
127         _Pair_alloc_type;
128
129       typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
130                        key_compare, _Pair_alloc_type> _Rep_type;
131
132       /// @if maint  The actual tree structure.  @endif
133       _Rep_type _M_t;
134
135     public:
136       // many of these are specified differently in ISO, but the following are
137       // "functionally equivalent"
138       typedef typename _Pair_alloc_type::pointer         pointer;
139       typedef typename _Pair_alloc_type::const_pointer   const_pointer;
140       typedef typename _Pair_alloc_type::reference       reference;
141       typedef typename _Pair_alloc_type::const_reference const_reference;
142       typedef typename _Rep_type::iterator               iterator;
143       typedef typename _Rep_type::const_iterator         const_iterator;
144       typedef typename _Rep_type::size_type              size_type;
145       typedef typename _Rep_type::difference_type        difference_type;
146       typedef typename _Rep_type::reverse_iterator       reverse_iterator;
147       typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
148
149       // [23.3.1.1] construct/copy/destroy
150       // (get_allocator() is normally listed in this section, but seems to have
151       // been accidentally omitted in the printed standard)
152       /**
153        *  @brief  Default constructor creates no elements.
154        */
155       map()
156       : _M_t(_Compare(), allocator_type()) { }
157
158       // for some reason this was made a separate function
159       /**
160        *  @brief  Default constructor creates no elements.
161        */
162       explicit
163       map(const _Compare& __comp, const allocator_type& __a = allocator_type())
164       : _M_t(__comp, __a) { }
165
166       /**
167        *  @brief  Map copy constructor.
168        *  @param  x  A %map of identical element and allocator types.
169        *
170        *  The newly-created %map uses a copy of the allocation object used
171        *  by @a x.
172        */
173       map(const map& __x)
174       : _M_t(__x._M_t) { }
175
176       /**
177        *  @brief  Builds a %map from a range.
178        *  @param  first  An input iterator.
179        *  @param  last  An input iterator.
180        *
181        *  Create a %map consisting of copies of the elements from [first,last).
182        *  This is linear in N if the range is already sorted, and NlogN
183        *  otherwise (where N is distance(first,last)).
184        */
185       template <typename _InputIterator>
186         map(_InputIterator __first, _InputIterator __last)
187         : _M_t(_Compare(), allocator_type())
188         { _M_t.insert_unique(__first, __last); }
189
190       /**
191        *  @brief  Builds a %map from a range.
192        *  @param  first  An input iterator.
193        *  @param  last  An input iterator.
194        *  @param  comp  A comparison functor.
195        *  @param  a  An allocator object.
196        *
197        *  Create a %map consisting of copies of the elements from [first,last).
198        *  This is linear in N if the range is already sorted, and NlogN
199        *  otherwise (where N is distance(first,last)).
200        */
201       template <typename _InputIterator>
202         map(_InputIterator __first, _InputIterator __last,
203             const _Compare& __comp, const allocator_type& __a = allocator_type())
204         : _M_t(__comp, __a)
205         { _M_t.insert_unique(__first, __last); }
206
207       // FIXME There is no dtor declared, but we should have something generated
208       // by Doxygen.  I don't know what tags to add to this paragraph to make
209       // that happen:
210       /**
211        *  The dtor only erases the elements, and note that if the elements
212        *  themselves are pointers, the pointed-to memory is not touched in any
213        *  way.  Managing the pointer is the user's responsibilty.
214        */
215
216       /**
217        *  @brief  Map assignment operator.
218        *  @param  x  A %map of identical element and allocator types.
219        *
220        *  All the elements of @a x are copied, but unlike the copy constructor,
221        *  the allocator object is not copied.
222        */
223       map&
224       operator=(const map& __x)
225       {
226         _M_t = __x._M_t;
227         return *this;
228       }
229
230       /// Get a copy of the memory allocation object.
231       allocator_type
232       get_allocator() const
233       { return _M_t.get_allocator(); }
234
235       // iterators
236       /**
237        *  Returns a read/write iterator that points to the first pair in the
238        *  %map.
239        *  Iteration is done in ascending order according to the keys.
240        */
241       iterator
242       begin()
243       { return _M_t.begin(); }
244
245       /**
246        *  Returns a read-only (constant) iterator that points to the first pair
247        *  in the %map.  Iteration is done in ascending order according to the
248        *  keys.
249        */
250       const_iterator
251       begin() const
252       { return _M_t.begin(); }
253
254       /**
255        *  Returns a read/write iterator that points one past the last pair in
256        *  the %map.  Iteration is done in ascending order according to the keys.
257        */
258       iterator
259       end()
260       { return _M_t.end(); }
261
262       /**
263        *  Returns a read-only (constant) iterator that points one past the last
264        *  pair in the %map.  Iteration is done in ascending order according to
265        *  the keys.
266        */
267       const_iterator
268       end() const
269       { return _M_t.end(); }
270
271       /**
272        *  Returns a read/write reverse iterator that points to the last pair in
273        *  the %map.  Iteration is done in descending order according to the
274        *  keys.
275        */
276       reverse_iterator
277       rbegin()
278       { return _M_t.rbegin(); }
279
280       /**
281        *  Returns a read-only (constant) reverse iterator that points to the
282        *  last pair in the %map.  Iteration is done in descending order
283        *  according to the keys.
284        */
285       const_reverse_iterator
286       rbegin() const
287       { return _M_t.rbegin(); }
288
289       /**
290        *  Returns a read/write reverse iterator that points to one before the
291        *  first pair in the %map.  Iteration is done in descending order
292        *  according to the keys.
293        */
294       reverse_iterator
295       rend()
296       { return _M_t.rend(); }
297
298       /**
299        *  Returns a read-only (constant) reverse iterator that points to one
300        *  before the first pair in the %map.  Iteration is done in descending
301        *  order according to the keys.
302        */
303       const_reverse_iterator
304       rend() const
305       { return _M_t.rend(); }
306
307       // capacity
308       /** Returns true if the %map is empty.  (Thus begin() would equal
309        *  end().)
310       */
311       bool
312       empty() const
313       { return _M_t.empty(); }
314
315       /** Returns the size of the %map.  */
316       size_type
317       size() const
318       { return _M_t.size(); }
319
320       /** Returns the maximum size of the %map.  */
321       size_type
322       max_size() const
323       { return _M_t.max_size(); }
324
325       // [23.3.1.2] element access
326       /**
327        *  @brief  Subscript ( @c [] ) access to %map data.
328        *  @param  k  The key for which data should be retrieved.
329        *  @return  A reference to the data of the (key,data) %pair.
330        *
331        *  Allows for easy lookup with the subscript ( @c [] ) operator.  Returns
332        *  data associated with the key specified in subscript.  If the key does
333        *  not exist, a pair with that key is created using default values, which
334        *  is then returned.
335        *
336        *  Lookup requires logarithmic time.
337        */
338       mapped_type&
339       operator[](const key_type& __k)
340       {
341         // concept requirements
342         __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
343
344         iterator __i = lower_bound(__k);
345         // __i->first is greater than or equivalent to __k.
346         if (__i == end() || key_comp()(__k, (*__i).first))
347           __i = insert(__i, value_type(__k, mapped_type()));
348         return (*__i).second;
349       }
350
351       // modifiers
352       /**
353        *  @brief Attempts to insert a std::pair into the %map.
354        *  @param  x  Pair to be inserted (see std::make_pair for easy creation of
355        *             pairs).
356        *  @return  A pair, of which the first element is an iterator that points
357        *           to the possibly inserted pair, and the second is a bool that
358        *           is true if the pair was actually inserted.
359        *
360        *  This function attempts to insert a (key, value) %pair into the %map.
361        *  A %map relies on unique keys and thus a %pair is only inserted if its
362        *  first element (the key) is not already present in the %map.
363        *
364        *  Insertion requires logarithmic time.
365        */
366       std::pair<iterator,bool>
367       insert(const value_type& __x)
368       { return _M_t.insert_unique(__x); }
369
370       /**
371        *  @brief Attempts to insert a std::pair into the %map.
372        *  @param  position  An iterator that serves as a hint as to where the
373        *                    pair should be inserted.
374        *  @param  x  Pair to be inserted (see std::make_pair for easy creation of
375        *             pairs).
376        *  @return  An iterator that points to the element with key of @a x (may
377        *           or may not be the %pair passed in).
378        *
379        *  This function is not concerned about whether the insertion took place,
380        *  and thus does not return a boolean like the single-argument
381        *  insert() does.  Note that the first parameter is only a hint and can
382        *  potentially improve the performance of the insertion process.  A bad
383        *  hint would cause no gains in efficiency.
384        *
385        *  See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4
386        *  for more on "hinting".
387        *
388        *  Insertion requires logarithmic time (if the hint is not taken).
389        */
390       iterator
391       insert(iterator position, const value_type& __x)
392       { return _M_t.insert_unique(position, __x); }
393
394       /**
395        *  @brief A template function that attemps to insert a range of elements.
396        *  @param  first  Iterator pointing to the start of the range to be
397        *                 inserted.
398        *  @param  last  Iterator pointing to the end of the range.
399        *
400        *  Complexity similar to that of the range constructor.
401        */
402       template <typename _InputIterator>
403         void
404         insert(_InputIterator __first, _InputIterator __last)
405         { _M_t.insert_unique(__first, __last); }
406
407       /**
408        *  @brief Erases an element from a %map.
409        *  @param  position  An iterator pointing to the element to be erased.
410        *
411        *  This function erases an element, pointed to by the given iterator,
412        *  from a %map.  Note that this function only erases the element, and
413        *  that if the element is itself a pointer, the pointed-to memory is not
414        *  touched in any way.  Managing the pointer is the user's responsibilty.
415        */
416       void
417       erase(iterator __position)
418       { _M_t.erase(__position); }
419
420       /**
421        *  @brief Erases elements according to the provided key.
422        *  @param  x  Key of element to be erased.
423        *  @return  The number of elements erased.
424        *
425        *  This function erases all the elements located by the given key from
426        *  a %map.
427        *  Note that this function only erases the element, and that if
428        *  the element is itself a pointer, the pointed-to memory is not touched
429        *  in any way.  Managing the pointer is the user's responsibilty.
430        */
431       size_type
432       erase(const key_type& __x)
433       { return _M_t.erase(__x); }
434
435       /**
436        *  @brief Erases a [first,last) range of elements from a %map.
437        *  @param  first  Iterator pointing to the start of the range to be
438        *                 erased.
439        *  @param  last  Iterator pointing to the end of the range to be erased.
440        *
441        *  This function erases a sequence of elements from a %map.
442        *  Note that this function only erases the element, and that if
443        *  the element is itself a pointer, the pointed-to memory is not touched
444        *  in any way.  Managing the pointer is the user's responsibilty.
445        */
446       void
447       erase(iterator __first, iterator __last)
448       { _M_t.erase(__first, __last); }
449
450       /**
451        *  @brief  Swaps data with another %map.
452        *  @param  x  A %map of the same element and allocator types.
453        *
454        *  This exchanges the elements between two maps in constant time.
455        *  (It is only swapping a pointer, an integer, and an instance of
456        *  the @c Compare type (which itself is often stateless and empty), so it
457        *  should be quite fast.)
458        *  Note that the global std::swap() function is specialized such that
459        *  std::swap(m1,m2) will feed to this function.
460        */
461       void
462       swap(map& __x)
463       { _M_t.swap(__x._M_t); }
464
465       /**
466        *  Erases all elements in a %map.  Note that this function only erases
467        *  the elements, and that if the elements themselves are pointers, the
468        *  pointed-to memory is not touched in any way.  Managing the pointer is
469        *  the user's responsibilty.
470        */
471       void
472       clear()
473       { _M_t.clear(); }
474
475       // observers
476       /**
477        *  Returns the key comparison object out of which the %map was
478        *  constructed.
479        */
480       key_compare
481       key_comp() const
482       { return _M_t.key_comp(); }
483
484       /**
485        *  Returns a value comparison object, built from the key comparison
486        *  object out of which the %map was constructed.
487        */
488       value_compare
489       value_comp() const
490       { return value_compare(_M_t.key_comp()); }
491
492       // [23.3.1.3] map operations
493       /**
494        *  @brief Tries to locate an element in a %map.
495        *  @param  x  Key of (key, value) %pair to be located.
496        *  @return  Iterator pointing to sought-after element, or end() if not
497        *           found.
498        *
499        *  This function takes a key and tries to locate the element with which
500        *  the key matches.  If successful the function returns an iterator
501        *  pointing to the sought after %pair.  If unsuccessful it returns the
502        *  past-the-end ( @c end() ) iterator.
503        */
504       iterator
505       find(const key_type& __x)
506       { return _M_t.find(__x); }
507
508       /**
509        *  @brief Tries to locate an element in a %map.
510        *  @param  x  Key of (key, value) %pair to be located.
511        *  @return  Read-only (constant) iterator pointing to sought-after
512        *           element, or end() if not found.
513        *
514        *  This function takes a key and tries to locate the element with which
515        *  the key matches.  If successful the function returns a constant
516        *  iterator pointing to the sought after %pair. If unsuccessful it
517        *  returns the past-the-end ( @c end() ) iterator.
518        */
519       const_iterator
520       find(const key_type& __x) const
521       { return _M_t.find(__x); }
522
523       /**
524        *  @brief  Finds the number of elements with given key.
525        *  @param  x  Key of (key, value) pairs to be located.
526        *  @return  Number of elements with specified key.
527        *
528        *  This function only makes sense for multimaps; for map the result will
529        *  either be 0 (not present) or 1 (present).
530        */
531       size_type
532       count(const key_type& __x) const
533       { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
534
535       /**
536        *  @brief Finds the beginning of a subsequence matching given key.
537        *  @param  x  Key of (key, value) pair to be located.
538        *  @return  Iterator pointing to first element equal to or greater
539        *           than key, or end().
540        *
541        *  This function returns the first element of a subsequence of elements
542        *  that matches the given key.  If unsuccessful it returns an iterator
543        *  pointing to the first element that has a greater value than given key
544        *  or end() if no such element exists.
545        */
546       iterator
547       lower_bound(const key_type& __x)
548       { return _M_t.lower_bound(__x); }
549
550       /**
551        *  @brief Finds the beginning of a subsequence matching given key.
552        *  @param  x  Key of (key, value) pair to be located.
553        *  @return  Read-only (constant) iterator pointing to first element
554        *           equal to or greater than key, or end().
555        *
556        *  This function returns the first element of a subsequence of elements
557        *  that matches the given key.  If unsuccessful it returns an iterator
558        *  pointing to the first element that has a greater value than given key
559        *  or end() if no such element exists.
560        */
561       const_iterator
562       lower_bound(const key_type& __x) const
563       { return _M_t.lower_bound(__x); }
564
565       /**
566        *  @brief Finds the end of a subsequence matching given key.
567        *  @param  x  Key of (key, value) pair to be located.
568        *  @return Iterator pointing to the first element
569        *          greater than key, or end().
570        */
571       iterator
572       upper_bound(const key_type& __x)
573       { return _M_t.upper_bound(__x); }
574
575       /**
576        *  @brief Finds the end of a subsequence matching given key.
577        *  @param  x  Key of (key, value) pair to be located.
578        *  @return  Read-only (constant) iterator pointing to first iterator
579        *           greater than key, or end().
580        */
581       const_iterator
582       upper_bound(const key_type& __x) const
583       { return _M_t.upper_bound(__x); }
584
585       /**
586        *  @brief Finds a subsequence matching given key.
587        *  @param  x  Key of (key, value) pairs to be located.
588        *  @return  Pair of iterators that possibly points to the subsequence
589        *           matching given key.
590        *
591        *  This function is equivalent to
592        *  @code
593        *    std::make_pair(c.lower_bound(val),
594        *                   c.upper_bound(val))
595        *  @endcode
596        *  (but is faster than making the calls separately).
597        *
598        *  This function probably only makes sense for multimaps.
599        */
600       std::pair<iterator, iterator>
601       equal_range(const key_type& __x)
602       { return _M_t.equal_range(__x); }
603
604       /**
605        *  @brief Finds a subsequence matching given key.
606        *  @param  x  Key of (key, value) pairs to be located.
607        *  @return  Pair of read-only (constant) iterators that possibly points
608        *           to the subsequence matching given key.
609        *
610        *  This function is equivalent to
611        *  @code
612        *    std::make_pair(c.lower_bound(val),
613        *                   c.upper_bound(val))
614        *  @endcode
615        *  (but is faster than making the calls separately).
616        *
617        *  This function probably only makes sense for multimaps.
618        */
619       std::pair<const_iterator, const_iterator>
620       equal_range(const key_type& __x) const
621       { return _M_t.equal_range(__x); }
622
623       template <typename _K1, typename _T1, typename _C1, typename _A1>
624         friend bool
625         operator== (const map<_K1, _T1, _C1, _A1>&,
626                     const map<_K1, _T1, _C1, _A1>&);
627
628       template <typename _K1, typename _T1, typename _C1, typename _A1>
629         friend bool
630         operator< (const map<_K1, _T1, _C1, _A1>&,
631                    const map<_K1, _T1, _C1, _A1>&);
632     };
633
634   /**
635    *  @brief  Map equality comparison.
636    *  @param  x  A %map.
637    *  @param  y  A %map of the same type as @a x.
638    *  @return  True iff the size and elements of the maps are equal.
639    *
640    *  This is an equivalence relation.  It is linear in the size of the
641    *  maps.  Maps are considered equivalent if their sizes are equal,
642    *  and if corresponding elements compare equal.
643   */
644   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
645     inline bool
646     operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
647                const map<_Key, _Tp, _Compare, _Alloc>& __y)
648     { return __x._M_t == __y._M_t; }
649
650   /**
651    *  @brief  Map ordering relation.
652    *  @param  x  A %map.
653    *  @param  y  A %map of the same type as @a x.
654    *  @return  True iff @a x is lexicographically less than @a y.
655    *
656    *  This is a total ordering relation.  It is linear in the size of the
657    *  maps.  The elements must be comparable with @c <.
658    *
659    *  See std::lexicographical_compare() for how the determination is made.
660   */
661   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
662     inline bool
663     operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
664               const map<_Key, _Tp, _Compare, _Alloc>& __y)
665     { return __x._M_t < __y._M_t; }
666
667   /// Based on operator==
668   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
669     inline bool
670     operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
671                const map<_Key, _Tp, _Compare, _Alloc>& __y)
672     { return !(__x == __y); }
673
674   /// Based on operator<
675   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
676     inline bool
677     operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
678               const map<_Key, _Tp, _Compare, _Alloc>& __y)
679     { return __y < __x; }
680
681   /// Based on operator<
682   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
683     inline bool
684     operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
685                const map<_Key, _Tp, _Compare, _Alloc>& __y)
686     { return !(__y < __x); }
687
688   /// Based on operator<
689   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
690     inline bool
691     operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
692                const map<_Key, _Tp, _Compare, _Alloc>& __y)
693     { return !(__x < __y); }
694
695   /// See std::map::swap().
696   template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>
697     inline void
698     swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
699          map<_Key, _Tp, _Compare, _Alloc>& __y)
700     { __x.swap(__y); }
701 } // namespace std
702
703 #endif /* _MAP_H */