libstdc++
map.h
Go to the documentation of this file.
00001 // Debugging map implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2003-2017 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 3, 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 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file debug/map.h
00026  *  This file is a GNU debug extension to the Standard C++ Library.
00027  */
00028 
00029 #ifndef _GLIBCXX_DEBUG_MAP_H
00030 #define _GLIBCXX_DEBUG_MAP_H 1
00031 
00032 #include <debug/safe_sequence.h>
00033 #include <debug/safe_container.h>
00034 #include <debug/safe_iterator.h>
00035 #include <utility>
00036 
00037 namespace std _GLIBCXX_VISIBILITY(default)
00038 {
00039 namespace __debug
00040 {
00041   /// Class std::map with safety/checking/debug instrumentation.
00042   template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
00043            typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
00044     class map
00045     : public __gnu_debug::_Safe_container<
00046         map<_Key, _Tp, _Compare, _Allocator>, _Allocator,
00047         __gnu_debug::_Safe_node_sequence>,
00048       public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>
00049     {
00050       typedef _GLIBCXX_STD_C::map<
00051         _Key, _Tp, _Compare, _Allocator>                        _Base;
00052       typedef __gnu_debug::_Safe_container<
00053         map, _Allocator, __gnu_debug::_Safe_node_sequence>      _Safe;
00054 
00055       typedef typename _Base::const_iterator    _Base_const_iterator;
00056       typedef typename _Base::iterator          _Base_iterator;
00057       typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
00058 
00059     public:
00060       // types:
00061       typedef _Key                                      key_type;
00062       typedef _Tp                                       mapped_type;
00063       typedef std::pair<const _Key, _Tp>                value_type;
00064       typedef _Compare                                  key_compare;
00065       typedef _Allocator                                allocator_type;
00066       typedef typename _Base::reference                 reference;
00067       typedef typename _Base::const_reference           const_reference;
00068 
00069       typedef __gnu_debug::_Safe_iterator<_Base_iterator, map>
00070                                                         iterator;
00071       typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map>
00072                                                         const_iterator;
00073 
00074       typedef typename _Base::size_type                 size_type;
00075       typedef typename _Base::difference_type           difference_type;
00076       typedef typename _Base::pointer                   pointer;
00077       typedef typename _Base::const_pointer             const_pointer;
00078       typedef std::reverse_iterator<iterator>           reverse_iterator;
00079       typedef std::reverse_iterator<const_iterator>     const_reverse_iterator;
00080 
00081       // 23.3.1.1 construct/copy/destroy:
00082 
00083 #if __cplusplus < 201103L
00084       map() : _Base() { }
00085 
00086       map(const map& __x)
00087       : _Base(__x) { }
00088 
00089       ~map() { }
00090 #else
00091       map() = default;
00092       map(const map&) = default;
00093       map(map&&) = default;
00094 
00095       map(initializer_list<value_type> __l,
00096           const _Compare& __c = _Compare(),
00097           const allocator_type& __a = allocator_type())
00098       : _Base(__l, __c, __a) { }
00099 
00100       explicit
00101       map(const allocator_type& __a)
00102       : _Base(__a) { }
00103 
00104       map(const map& __m, const allocator_type& __a)
00105       : _Base(__m, __a) { }
00106 
00107       map(map&& __m, const allocator_type& __a)
00108       : _Safe(std::move(__m._M_safe()), __a),
00109         _Base(std::move(__m._M_base()), __a) { }
00110 
00111       map(initializer_list<value_type> __l, const allocator_type& __a)
00112       : _Base(__l, __a) { }
00113 
00114       template<typename _InputIterator>
00115         map(_InputIterator __first, _InputIterator __last,
00116             const allocator_type& __a)
00117         : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
00118                                                                      __last)),
00119                 __gnu_debug::__base(__last), __a)
00120         { }
00121 
00122       ~map() = default;
00123 #endif
00124 
00125       map(const _Base& __x)
00126       : _Base(__x) { }
00127 
00128       explicit map(const _Compare& __comp,
00129                    const _Allocator& __a = _Allocator())
00130       : _Base(__comp, __a) { }
00131 
00132       template<typename _InputIterator>
00133         map(_InputIterator __first, _InputIterator __last,
00134             const _Compare& __comp = _Compare(),
00135             const _Allocator& __a = _Allocator())
00136         : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
00137                                                                      __last)),
00138                 __gnu_debug::__base(__last),
00139                 __comp, __a) { }
00140 
00141 #if __cplusplus < 201103L
00142       map&
00143       operator=(const map& __x)
00144       {
00145         this->_M_safe() = __x;
00146         _M_base() = __x;
00147         return *this;
00148       }
00149 #else
00150       map&
00151       operator=(const map&) = default;
00152 
00153       map&
00154       operator=(map&&) = default;
00155 
00156       map&
00157       operator=(initializer_list<value_type> __l)
00158       {
00159         _M_base() = __l;
00160         this->_M_invalidate_all();
00161         return *this;
00162       }
00163 #endif
00164 
00165       // _GLIBCXX_RESOLVE_LIB_DEFECTS
00166       // 133. map missing get_allocator()
00167       using _Base::get_allocator;
00168 
00169       // iterators:
00170       iterator
00171       begin() _GLIBCXX_NOEXCEPT
00172       { return iterator(_Base::begin(), this); }
00173 
00174       const_iterator
00175       begin() const _GLIBCXX_NOEXCEPT
00176       { return const_iterator(_Base::begin(), this); }
00177 
00178       iterator
00179       end() _GLIBCXX_NOEXCEPT
00180       { return iterator(_Base::end(), this); }
00181 
00182       const_iterator
00183       end() const _GLIBCXX_NOEXCEPT
00184       { return const_iterator(_Base::end(), this); }
00185 
00186       reverse_iterator
00187       rbegin() _GLIBCXX_NOEXCEPT
00188       { return reverse_iterator(end()); }
00189 
00190       const_reverse_iterator
00191       rbegin() const _GLIBCXX_NOEXCEPT
00192       { return const_reverse_iterator(end()); }
00193 
00194       reverse_iterator
00195       rend() _GLIBCXX_NOEXCEPT
00196       { return reverse_iterator(begin()); }
00197 
00198       const_reverse_iterator
00199       rend() const _GLIBCXX_NOEXCEPT
00200       { return const_reverse_iterator(begin()); }
00201 
00202 #if __cplusplus >= 201103L
00203       const_iterator
00204       cbegin() const noexcept
00205       { return const_iterator(_Base::begin(), this); }
00206 
00207       const_iterator
00208       cend() const noexcept
00209       { return const_iterator(_Base::end(), this); }
00210 
00211       const_reverse_iterator
00212       crbegin() const noexcept
00213       { return const_reverse_iterator(end()); }
00214 
00215       const_reverse_iterator
00216       crend() const noexcept
00217       { return const_reverse_iterator(begin()); }
00218 #endif
00219 
00220       // capacity:
00221       using _Base::empty;
00222       using _Base::size;
00223       using _Base::max_size;
00224 
00225       // 23.3.1.2 element access:
00226       using _Base::operator[];
00227 
00228       // _GLIBCXX_RESOLVE_LIB_DEFECTS
00229       // DR 464. Suggestion for new member functions in standard containers.
00230       using _Base::at;
00231 
00232       // modifiers:
00233 #if __cplusplus >= 201103L
00234       template<typename... _Args>
00235         std::pair<iterator, bool>
00236         emplace(_Args&&... __args)
00237         {
00238           auto __res = _Base::emplace(std::forward<_Args>(__args)...);
00239           return std::pair<iterator, bool>(iterator(__res.first, this),
00240                                            __res.second);
00241         }
00242 
00243       template<typename... _Args>
00244         iterator
00245         emplace_hint(const_iterator __pos, _Args&&... __args)
00246         {
00247           __glibcxx_check_insert(__pos);
00248           return iterator(_Base::emplace_hint(__pos.base(),
00249                                               std::forward<_Args>(__args)...),
00250                           this);
00251         }
00252 #endif
00253 
00254       std::pair<iterator, bool>
00255       insert(const value_type& __x)
00256       {
00257         std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
00258         return std::pair<iterator, bool>(iterator(__res.first, this),
00259                                          __res.second);
00260       }
00261 
00262 #if __cplusplus >= 201103L
00263       template<typename _Pair, typename = typename
00264                std::enable_if<std::is_constructible<value_type,
00265                                                     _Pair&&>::value>::type>
00266         std::pair<iterator, bool>
00267         insert(_Pair&& __x)
00268         {
00269           std::pair<_Base_iterator, bool> __res
00270             = _Base::insert(std::forward<_Pair>(__x));
00271           return std::pair<iterator, bool>(iterator(__res.first, this),
00272                                            __res.second);
00273         }
00274 #endif
00275 
00276 #if __cplusplus >= 201103L
00277       void
00278       insert(std::initializer_list<value_type> __list)
00279       { _Base::insert(__list); }
00280 #endif
00281 
00282       iterator
00283 #if __cplusplus >= 201103L
00284       insert(const_iterator __position, const value_type& __x)
00285 #else
00286       insert(iterator __position, const value_type& __x)
00287 #endif
00288       {
00289         __glibcxx_check_insert(__position);
00290         return iterator(_Base::insert(__position.base(), __x), this);
00291       }
00292 
00293 #if __cplusplus >= 201103L
00294       template<typename _Pair, typename = typename
00295                std::enable_if<std::is_constructible<value_type,
00296                                                     _Pair&&>::value>::type>
00297         iterator
00298         insert(const_iterator __position, _Pair&& __x)
00299         {
00300           __glibcxx_check_insert(__position);
00301           return iterator(_Base::insert(__position.base(),
00302                                         std::forward<_Pair>(__x)), this);
00303         }
00304 #endif
00305 
00306       template<typename _InputIterator>
00307         void
00308         insert(_InputIterator __first, _InputIterator __last)
00309         {
00310           typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
00311           __glibcxx_check_valid_range2(__first, __last, __dist);
00312 
00313           if (__dist.second >= __gnu_debug::__dp_sign)
00314             _Base::insert(__gnu_debug::__unsafe(__first),
00315                           __gnu_debug::__unsafe(__last));
00316           else
00317             _Base::insert(__first, __last);
00318         }
00319 
00320 
00321 #if __cplusplus > 201402L
00322       template <typename... _Args>
00323         pair<iterator, bool>
00324         try_emplace(const key_type& __k, _Args&&... __args)
00325         {
00326           auto __res = _Base::try_emplace(__k,
00327                                           std::forward<_Args>(__args)...);
00328           return { iterator(__res.first, this), __res.second };
00329         }
00330 
00331       template <typename... _Args>
00332         pair<iterator, bool>
00333         try_emplace(key_type&& __k, _Args&&... __args)
00334         {
00335           auto __res = _Base::try_emplace(std::move(__k),
00336                                           std::forward<_Args>(__args)...);
00337           return { iterator(__res.first, this), __res.second };
00338         }
00339 
00340       template <typename... _Args>
00341         iterator
00342         try_emplace(const_iterator __hint, const key_type& __k,
00343                     _Args&&... __args)
00344         {
00345           __glibcxx_check_insert(__hint);
00346           return iterator(_Base::try_emplace(__hint.base(), __k,
00347                                              std::forward<_Args>(__args)...),
00348                           this);
00349         }
00350 
00351       template <typename... _Args>
00352         iterator
00353         try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
00354         {
00355           __glibcxx_check_insert(__hint);
00356           return iterator(_Base::try_emplace(__hint.base(), std::move(__k),
00357                                              std::forward<_Args>(__args)...),
00358                           this);
00359         }
00360 
00361       template <typename _Obj>
00362         std::pair<iterator, bool>
00363         insert_or_assign(const key_type& __k, _Obj&& __obj)
00364         {
00365           auto __res = _Base::insert_or_assign(__k,
00366                                                std::forward<_Obj>(__obj));
00367           return { iterator(__res.first, this), __res.second };
00368         }
00369 
00370       template <typename _Obj>
00371         std::pair<iterator, bool>
00372         insert_or_assign(key_type&& __k, _Obj&& __obj)
00373         {
00374           auto __res = _Base::insert_or_assign(std::move(__k),
00375                                                std::forward<_Obj>(__obj));
00376           return { iterator(__res.first, this), __res.second };
00377         }
00378 
00379       template <typename _Obj>
00380         iterator
00381         insert_or_assign(const_iterator __hint,
00382                          const key_type& __k, _Obj&& __obj)
00383         {
00384           __glibcxx_check_insert(__hint);
00385           return iterator(_Base::insert_or_assign(__hint.base(), __k,
00386                                                   std::forward<_Obj>(__obj)),
00387                           this);
00388         }
00389 
00390       template <typename _Obj>
00391         iterator
00392         insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj)
00393         {
00394           __glibcxx_check_insert(__hint);
00395           return iterator(_Base::insert_or_assign(__hint.base(),
00396                                                   std::move(__k),
00397                                                   std::forward<_Obj>(__obj)),
00398                           this);
00399         }
00400 #endif // C++17
00401 
00402 #if __cplusplus > 201402L
00403       using node_type = typename _Base::node_type;
00404 
00405       struct insert_return_type
00406       {
00407         bool inserted;
00408         iterator position;
00409         node_type node;
00410       };
00411 
00412       node_type
00413       extract(const_iterator __position)
00414       {
00415         __glibcxx_check_erase(__position);
00416         this->_M_invalidate_if(_Equal(__position.base()));
00417         return _Base::extract(__position.base());
00418       }
00419 
00420       node_type
00421       extract(const key_type& __key)
00422       {
00423         const auto __position = find(__key);
00424         if (__position != end())
00425           return extract(__position);
00426         return {};
00427       }
00428 
00429       insert_return_type
00430       insert(node_type&& __nh)
00431       {
00432         auto __ret = _Base::insert(std::move(__nh));
00433         iterator __pos = iterator(__ret.position, this);
00434         return { __ret.inserted, __pos, std::move(__ret.node) };
00435       }
00436 
00437       iterator
00438       insert(const_iterator __hint, node_type&& __nh)
00439       {
00440         __glibcxx_check_insert(__hint);
00441         return iterator(_Base::insert(__hint.base(), std::move(__nh)), this);
00442       }
00443 
00444       using _Base::merge;
00445 #endif // C++17
00446 
00447 #if __cplusplus >= 201103L
00448       iterator
00449       erase(const_iterator __position)
00450       {
00451         __glibcxx_check_erase(__position);
00452         this->_M_invalidate_if(_Equal(__position.base()));
00453         return iterator(_Base::erase(__position.base()), this);
00454       }
00455 
00456       iterator
00457       erase(iterator __position)
00458       { return erase(const_iterator(__position)); }
00459 #else
00460       void
00461       erase(iterator __position)
00462       {
00463         __glibcxx_check_erase(__position);
00464         this->_M_invalidate_if(_Equal(__position.base()));
00465         _Base::erase(__position.base());
00466       }
00467 #endif
00468 
00469       size_type
00470       erase(const key_type& __x)
00471       {
00472         _Base_iterator __victim = _Base::find(__x);
00473         if (__victim == _Base::end())
00474           return 0;
00475         else
00476           {
00477             this->_M_invalidate_if(_Equal(__victim));
00478             _Base::erase(__victim);
00479             return 1;
00480           }
00481       }
00482 
00483 #if __cplusplus >= 201103L
00484       iterator
00485       erase(const_iterator __first, const_iterator __last)
00486       {
00487         // _GLIBCXX_RESOLVE_LIB_DEFECTS
00488         // 151. can't currently clear() empty container
00489         __glibcxx_check_erase_range(__first, __last);
00490         for (_Base_const_iterator __victim = __first.base();
00491              __victim != __last.base(); ++__victim)
00492           {
00493             _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
00494                                   _M_message(__gnu_debug::__msg_valid_range)
00495                                   ._M_iterator(__first, "first")
00496                                   ._M_iterator(__last, "last"));
00497             this->_M_invalidate_if(_Equal(__victim));
00498           }
00499         return iterator(_Base::erase(__first.base(), __last.base()), this);
00500       }
00501 #else
00502       void
00503       erase(iterator __first, iterator __last)
00504       {
00505         // _GLIBCXX_RESOLVE_LIB_DEFECTS
00506         // 151. can't currently clear() empty container
00507         __glibcxx_check_erase_range(__first, __last);
00508         for (_Base_iterator __victim = __first.base();
00509              __victim != __last.base(); ++__victim)
00510           {
00511             _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
00512                                   _M_message(__gnu_debug::__msg_valid_range)
00513                                   ._M_iterator(__first, "first")
00514                                   ._M_iterator(__last, "last"));
00515             this->_M_invalidate_if(_Equal(__victim));
00516           }
00517         _Base::erase(__first.base(), __last.base());
00518       }
00519 #endif
00520 
00521       void
00522       swap(map& __x)
00523       _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
00524       {
00525         _Safe::_M_swap(__x);
00526         _Base::swap(__x);
00527       }
00528 
00529       void
00530       clear() _GLIBCXX_NOEXCEPT
00531       {
00532         this->_M_invalidate_all();
00533         _Base::clear();
00534       }
00535 
00536       // observers:
00537       using _Base::key_comp;
00538       using _Base::value_comp;
00539 
00540       // 23.3.1.3 map operations:
00541       iterator
00542       find(const key_type& __x)
00543       { return iterator(_Base::find(__x), this); }
00544 
00545 #if __cplusplus > 201103L
00546       template<typename _Kt,
00547                typename _Req =
00548                  typename __has_is_transparent<_Compare, _Kt>::type>
00549         iterator
00550         find(const _Kt& __x)
00551         { return { _Base::find(__x), this }; }
00552 #endif
00553 
00554       const_iterator
00555       find(const key_type& __x) const
00556       { return const_iterator(_Base::find(__x), this); }
00557 
00558 #if __cplusplus > 201103L
00559       template<typename _Kt,
00560                typename _Req =
00561                  typename __has_is_transparent<_Compare, _Kt>::type>
00562         const_iterator
00563         find(const _Kt& __x) const
00564         { return { _Base::find(__x), this }; }
00565 #endif
00566 
00567       using _Base::count;
00568 
00569       iterator
00570       lower_bound(const key_type& __x)
00571       { return iterator(_Base::lower_bound(__x), this); }
00572 
00573 #if __cplusplus > 201103L
00574       template<typename _Kt,
00575                typename _Req =
00576                  typename __has_is_transparent<_Compare, _Kt>::type>
00577         iterator
00578         lower_bound(const _Kt& __x)
00579         { return { _Base::lower_bound(__x), this }; }
00580 #endif
00581 
00582       const_iterator
00583       lower_bound(const key_type& __x) const
00584       { return const_iterator(_Base::lower_bound(__x), this); }
00585 
00586 #if __cplusplus > 201103L
00587       template<typename _Kt,
00588                typename _Req =
00589                  typename __has_is_transparent<_Compare, _Kt>::type>
00590         const_iterator
00591         lower_bound(const _Kt& __x) const
00592         { return { _Base::lower_bound(__x), this }; }
00593 #endif
00594 
00595       iterator
00596       upper_bound(const key_type& __x)
00597       { return iterator(_Base::upper_bound(__x), this); }
00598 
00599 #if __cplusplus > 201103L
00600       template<typename _Kt,
00601                typename _Req =
00602                  typename __has_is_transparent<_Compare, _Kt>::type>
00603         iterator
00604         upper_bound(const _Kt& __x)
00605         { return { _Base::upper_bound(__x), this }; }
00606 #endif
00607 
00608       const_iterator
00609       upper_bound(const key_type& __x) const
00610       { return const_iterator(_Base::upper_bound(__x), this); }
00611 
00612 #if __cplusplus > 201103L
00613       template<typename _Kt,
00614                typename _Req =
00615                  typename __has_is_transparent<_Compare, _Kt>::type>
00616         const_iterator
00617         upper_bound(const _Kt& __x) const
00618         { return { _Base::upper_bound(__x), this }; }
00619 #endif
00620 
00621       std::pair<iterator,iterator>
00622       equal_range(const key_type& __x)
00623       {
00624         std::pair<_Base_iterator, _Base_iterator> __res =
00625         _Base::equal_range(__x);
00626         return std::make_pair(iterator(__res.first, this),
00627                               iterator(__res.second, this));
00628       }
00629 
00630 #if __cplusplus > 201103L
00631       template<typename _Kt,
00632                typename _Req =
00633                  typename __has_is_transparent<_Compare, _Kt>::type>
00634         std::pair<iterator, iterator>
00635         equal_range(const _Kt& __x)
00636         {
00637           auto __res = _Base::equal_range(__x);
00638           return { { __res.first, this }, { __res.second, this } };
00639         }
00640 #endif
00641 
00642       std::pair<const_iterator,const_iterator>
00643       equal_range(const key_type& __x) const
00644       {
00645         std::pair<_Base_const_iterator, _Base_const_iterator> __res =
00646         _Base::equal_range(__x);
00647         return std::make_pair(const_iterator(__res.first, this),
00648                               const_iterator(__res.second, this));
00649       }
00650 
00651 #if __cplusplus > 201103L
00652       template<typename _Kt,
00653                typename _Req =
00654                  typename __has_is_transparent<_Compare, _Kt>::type>
00655         std::pair<const_iterator, const_iterator>
00656         equal_range(const _Kt& __x) const
00657         {
00658           auto __res = _Base::equal_range(__x);
00659           return { { __res.first, this }, { __res.second, this } };
00660         }
00661 #endif
00662 
00663       _Base&
00664       _M_base() _GLIBCXX_NOEXCEPT       { return *this; }
00665 
00666       const _Base&
00667       _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
00668     };
00669 
00670   template<typename _Key, typename _Tp,
00671            typename _Compare, typename _Allocator>
00672     inline bool
00673     operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00674                const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00675     { return __lhs._M_base() == __rhs._M_base(); }
00676 
00677   template<typename _Key, typename _Tp,
00678            typename _Compare, typename _Allocator>
00679     inline bool
00680     operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00681                const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00682     { return __lhs._M_base() != __rhs._M_base(); }
00683 
00684   template<typename _Key, typename _Tp,
00685            typename _Compare, typename _Allocator>
00686     inline bool
00687     operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00688               const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00689     { return __lhs._M_base() < __rhs._M_base(); }
00690 
00691   template<typename _Key, typename _Tp,
00692            typename _Compare, typename _Allocator>
00693     inline bool
00694     operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00695                const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00696     { return __lhs._M_base() <= __rhs._M_base(); }
00697 
00698   template<typename _Key, typename _Tp,
00699            typename _Compare, typename _Allocator>
00700     inline bool
00701     operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00702                const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00703     { return __lhs._M_base() >= __rhs._M_base(); }
00704 
00705   template<typename _Key, typename _Tp,
00706            typename _Compare, typename _Allocator>
00707     inline bool
00708     operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00709               const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00710     { return __lhs._M_base() > __rhs._M_base(); }
00711 
00712   template<typename _Key, typename _Tp,
00713            typename _Compare, typename _Allocator>
00714     inline void
00715     swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
00716          map<_Key, _Tp, _Compare, _Allocator>& __rhs)
00717     _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
00718     { __lhs.swap(__rhs); }
00719 
00720 } // namespace __debug
00721 } // namespace std
00722 
00723 #endif