libstdc++
list
Go to the documentation of this file.
00001 // Debugging list implementation -*- C++ -*-
00002 
00003 // Copyright (C) 2003-2013 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/list
00026  *  This file is a GNU debug extension to the Standard C++ Library.
00027  */
00028 
00029 #ifndef _GLIBCXX_DEBUG_LIST
00030 #define _GLIBCXX_DEBUG_LIST 1
00031 
00032 #include <list>
00033 #include <debug/safe_sequence.h>
00034 #include <debug/safe_iterator.h>
00035 
00036 namespace std _GLIBCXX_VISIBILITY(default)
00037 {
00038 namespace __debug
00039 {
00040   /// Class std::list with safety/checking/debug instrumentation.
00041   template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
00042     class list
00043     : public _GLIBCXX_STD_C::list<_Tp, _Allocator>,
00044       public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >
00045     {
00046       typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
00047 
00048       typedef typename _Base::iterator       _Base_iterator;
00049       typedef typename _Base::const_iterator _Base_const_iterator;
00050       typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
00051       typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
00052     public:
00053       typedef typename _Base::reference             reference;
00054       typedef typename _Base::const_reference       const_reference;
00055 
00056       typedef __gnu_debug::_Safe_iterator<_Base_iterator, list>
00057                             iterator;
00058       typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, list>
00059                             const_iterator;
00060 
00061       typedef typename _Base::size_type             size_type;
00062       typedef typename _Base::difference_type       difference_type;
00063 
00064       typedef _Tp                   value_type;
00065       typedef _Allocator                allocator_type;
00066       typedef typename _Base::pointer               pointer;
00067       typedef typename _Base::const_pointer         const_pointer;
00068       typedef std::reverse_iterator<iterator>       reverse_iterator;
00069       typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00070 
00071       // 23.2.2.1 construct/copy/destroy:
00072       explicit
00073       list(const _Allocator& __a = _Allocator())
00074       : _Base(__a) { }
00075 
00076 #if __cplusplus >= 201103L
00077       explicit
00078       list(size_type __n)
00079       : _Base(__n) { }
00080 
00081       list(size_type __n, const _Tp& __value,
00082        const _Allocator& __a = _Allocator())
00083       : _Base(__n, __value, __a) { }
00084 #else
00085       explicit
00086       list(size_type __n, const _Tp& __value = _Tp(),
00087        const _Allocator& __a = _Allocator())
00088       : _Base(__n, __value, __a) { }
00089 #endif
00090 
00091 #if __cplusplus >= 201103L
00092       template<class _InputIterator,
00093            typename = std::_RequireInputIter<_InputIterator>>
00094 #else
00095       template<class _InputIterator>
00096 #endif
00097     list(_InputIterator __first, _InputIterator __last,
00098          const _Allocator& __a = _Allocator())
00099     : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
00100                                      __last)),
00101         __gnu_debug::__base(__last), __a)
00102         { }
00103 
00104       list(const list& __x)
00105       : _Base(__x) { }
00106 
00107       list(const _Base& __x)
00108       : _Base(__x) { }
00109 
00110 #if __cplusplus >= 201103L
00111       list(list&& __x) noexcept
00112       : _Base(std::move(__x))
00113       { this->_M_swap(__x); }
00114 
00115       list(initializer_list<value_type> __l,
00116            const allocator_type& __a = allocator_type())
00117         : _Base(__l, __a) { }
00118 #endif
00119 
00120       ~list() _GLIBCXX_NOEXCEPT { }
00121 
00122       list&
00123       operator=(const list& __x)
00124       {
00125     static_cast<_Base&>(*this) = __x;
00126     this->_M_invalidate_all();
00127     return *this;
00128       }
00129 
00130 #if __cplusplus >= 201103L
00131       list&
00132       operator=(list&& __x)
00133       {
00134     // NB: DR 1204.
00135     // NB: DR 675.
00136     __glibcxx_check_self_move_assign(__x);
00137     clear();
00138     swap(__x);
00139         return *this;
00140       }
00141 
00142       list&
00143       operator=(initializer_list<value_type> __l)
00144       {
00145     static_cast<_Base&>(*this) = __l;
00146     this->_M_invalidate_all();
00147     return *this;
00148       }
00149 
00150       void
00151       assign(initializer_list<value_type> __l)
00152       {
00153     _Base::assign(__l);
00154     this->_M_invalidate_all();
00155       }
00156 #endif
00157 
00158 #if __cplusplus >= 201103L
00159       template<class _InputIterator,
00160            typename = std::_RequireInputIter<_InputIterator>>
00161 #else
00162       template<class _InputIterator>
00163 #endif
00164         void
00165         assign(_InputIterator __first, _InputIterator __last)
00166         {
00167       __glibcxx_check_valid_range(__first, __last);
00168       _Base::assign(__gnu_debug::__base(__first),
00169             __gnu_debug::__base(__last));
00170       this->_M_invalidate_all();
00171     }
00172 
00173       void
00174       assign(size_type __n, const _Tp& __t)
00175       {
00176     _Base::assign(__n, __t);
00177     this->_M_invalidate_all();
00178       }
00179 
00180       using _Base::get_allocator;
00181 
00182       // iterators:
00183       iterator
00184       begin() _GLIBCXX_NOEXCEPT
00185       { return iterator(_Base::begin(), this); }
00186 
00187       const_iterator
00188       begin() const _GLIBCXX_NOEXCEPT
00189       { return const_iterator(_Base::begin(), this); }
00190 
00191       iterator
00192       end() _GLIBCXX_NOEXCEPT
00193       { return iterator(_Base::end(), this); }
00194 
00195       const_iterator
00196       end() const _GLIBCXX_NOEXCEPT
00197       { return const_iterator(_Base::end(), this); }
00198 
00199       reverse_iterator
00200       rbegin() _GLIBCXX_NOEXCEPT
00201       { return reverse_iterator(end()); }
00202 
00203       const_reverse_iterator
00204       rbegin() const _GLIBCXX_NOEXCEPT
00205       { return const_reverse_iterator(end()); }
00206 
00207       reverse_iterator
00208       rend() _GLIBCXX_NOEXCEPT
00209       { return reverse_iterator(begin()); }
00210 
00211       const_reverse_iterator
00212       rend() const _GLIBCXX_NOEXCEPT
00213       { return const_reverse_iterator(begin()); }
00214 
00215 #if __cplusplus >= 201103L
00216       const_iterator
00217       cbegin() const noexcept
00218       { return const_iterator(_Base::begin(), this); }
00219 
00220       const_iterator
00221       cend() const noexcept
00222       { return const_iterator(_Base::end(), this); }
00223 
00224       const_reverse_iterator
00225       crbegin() const noexcept
00226       { return const_reverse_iterator(end()); }
00227 
00228       const_reverse_iterator
00229       crend() const noexcept
00230       { return const_reverse_iterator(begin()); }
00231 #endif
00232 
00233       // 23.2.2.2 capacity:
00234       using _Base::empty;
00235       using _Base::size;
00236       using _Base::max_size;
00237 
00238 #if __cplusplus >= 201103L
00239       void
00240       resize(size_type __sz)
00241       {
00242     this->_M_detach_singular();
00243 
00244     // if __sz < size(), invalidate all iterators in [begin+__sz, end())
00245     _Base_iterator __victim = _Base::begin();
00246     _Base_iterator __end = _Base::end();
00247     for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
00248       ++__victim;
00249 
00250     for (; __victim != __end; ++__victim)
00251       {
00252         this->_M_invalidate_if(_Equal(__victim));
00253       }
00254 
00255     __try
00256       {
00257         _Base::resize(__sz);
00258       }
00259     __catch(...)
00260       {
00261         this->_M_revalidate_singular();
00262         __throw_exception_again;
00263       }
00264       }
00265 
00266       void
00267       resize(size_type __sz, const _Tp& __c)
00268       {
00269     this->_M_detach_singular();
00270 
00271     // if __sz < size(), invalidate all iterators in [begin+__sz, end())
00272     _Base_iterator __victim = _Base::begin();
00273     _Base_iterator __end = _Base::end();
00274     for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
00275       ++__victim;
00276 
00277     for (; __victim != __end; ++__victim)
00278       {
00279         this->_M_invalidate_if(_Equal(__victim));
00280       }
00281 
00282     __try
00283       {
00284         _Base::resize(__sz, __c);
00285       }
00286     __catch(...)
00287       {
00288         this->_M_revalidate_singular();
00289         __throw_exception_again;
00290       }
00291       }
00292 #else
00293       void
00294       resize(size_type __sz, _Tp __c = _Tp())
00295       {
00296     this->_M_detach_singular();
00297 
00298     // if __sz < size(), invalidate all iterators in [begin+__sz, end())
00299     _Base_iterator __victim = _Base::begin();
00300     _Base_iterator __end = _Base::end();
00301     for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
00302       ++__victim;
00303 
00304     for (; __victim != __end; ++__victim)
00305       {
00306         this->_M_invalidate_if(_Equal(__victim));
00307       }
00308 
00309     __try
00310       {
00311         _Base::resize(__sz, __c);
00312       }
00313     __catch(...)
00314       {
00315         this->_M_revalidate_singular();
00316         __throw_exception_again;
00317       }
00318       }
00319 #endif
00320 
00321       // element access:
00322       reference
00323       front()
00324       {
00325     __glibcxx_check_nonempty();
00326     return _Base::front();
00327       }
00328 
00329       const_reference
00330       front() const
00331       {
00332     __glibcxx_check_nonempty();
00333     return _Base::front();
00334       }
00335 
00336       reference
00337       back()
00338       {
00339     __glibcxx_check_nonempty();
00340     return _Base::back();
00341       }
00342 
00343       const_reference
00344       back() const
00345       {
00346     __glibcxx_check_nonempty();
00347     return _Base::back();
00348       }
00349 
00350       // 23.2.2.3 modifiers:
00351       using _Base::push_front;
00352 
00353 #if __cplusplus >= 201103L
00354       using _Base::emplace_front;
00355 #endif
00356 
00357       void
00358       pop_front()
00359       {
00360     __glibcxx_check_nonempty();
00361     this->_M_invalidate_if(_Equal(_Base::begin()));
00362     _Base::pop_front();
00363       }
00364 
00365       using _Base::push_back;
00366 
00367 #if __cplusplus >= 201103L
00368       using _Base::emplace_back;
00369 #endif
00370 
00371       void
00372       pop_back()
00373       {
00374     __glibcxx_check_nonempty();
00375     this->_M_invalidate_if(_Equal(--_Base::end()));
00376     _Base::pop_back();
00377       }
00378 
00379 #if __cplusplus >= 201103L
00380       template<typename... _Args>
00381         iterator
00382         emplace(iterator __position, _Args&&... __args)
00383     {
00384       __glibcxx_check_insert(__position);
00385       return iterator(_Base::emplace(__position.base(),
00386                     std::forward<_Args>(__args)...), this);
00387     }
00388 #endif
00389 
00390       iterator
00391       insert(iterator __position, const _Tp& __x)
00392       {
00393     __glibcxx_check_insert(__position);
00394     return iterator(_Base::insert(__position.base(), __x), this);
00395       }
00396 
00397 #if __cplusplus >= 201103L
00398       iterator
00399       insert(iterator __position, _Tp&& __x)
00400       { return emplace(__position, std::move(__x)); }
00401 
00402       void
00403       insert(iterator __p, initializer_list<value_type> __l)
00404       {
00405     __glibcxx_check_insert(__p);
00406     _Base::insert(__p.base(), __l);
00407       }
00408 #endif
00409 
00410       void
00411       insert(iterator __position, size_type __n, const _Tp& __x)
00412       {
00413     __glibcxx_check_insert(__position);
00414     _Base::insert(__position.base(), __n, __x);
00415       }
00416 
00417 #if __cplusplus >= 201103L
00418       template<class _InputIterator,
00419            typename = std::_RequireInputIter<_InputIterator>>
00420 #else
00421       template<class _InputIterator>
00422 #endif
00423         void
00424         insert(iterator __position, _InputIterator __first,
00425            _InputIterator __last)
00426         {
00427       __glibcxx_check_insert_range(__position, __first, __last);
00428       _Base::insert(__position.base(), __gnu_debug::__base(__first),
00429                        __gnu_debug::__base(__last));
00430     }
00431 
00432     private:
00433       _Base_iterator
00434       _M_erase(_Base_iterator __position)
00435       {
00436     this->_M_invalidate_if(_Equal(__position));
00437     return _Base::erase(__position);
00438       }
00439     public:
00440       iterator
00441       erase(iterator __position)
00442       {
00443     __glibcxx_check_erase(__position);
00444     return iterator(_M_erase(__position.base()), this);
00445       }
00446 
00447       iterator
00448       erase(iterator __position, iterator __last)
00449       {
00450     // _GLIBCXX_RESOLVE_LIB_DEFECTS
00451     // 151. can't currently clear() empty container
00452     __glibcxx_check_erase_range(__position, __last);
00453     for (_Base_iterator __victim = __position.base();
00454          __victim != __last.base(); ++__victim)
00455       {
00456         _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
00457                       _M_message(__gnu_debug::__msg_valid_range)
00458                   ._M_iterator(__position, "position")
00459                   ._M_iterator(__last, "last"));
00460         this->_M_invalidate_if(_Equal(__victim));
00461       }
00462     return iterator(_Base::erase(__position.base(), __last.base()), this);
00463       }
00464 
00465       void
00466       swap(list& __x)
00467       {
00468     _Base::swap(__x);
00469     this->_M_swap(__x);
00470       }
00471 
00472       void
00473       clear() _GLIBCXX_NOEXCEPT
00474       {
00475     _Base::clear();
00476     this->_M_invalidate_all();
00477       }
00478 
00479       // 23.2.2.4 list operations:
00480       void
00481 #if __cplusplus >= 201103L
00482       splice(iterator __position, list&& __x)
00483 #else
00484       splice(iterator __position, list& __x)
00485 #endif
00486       {
00487     _GLIBCXX_DEBUG_VERIFY(&__x != this,
00488                   _M_message(__gnu_debug::__msg_self_splice)
00489                   ._M_sequence(*this, "this"));
00490     this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
00491     _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()));
00492       }
00493 
00494 #if __cplusplus >= 201103L
00495       void
00496       splice(iterator __position, list& __x)
00497       { splice(__position, std::move(__x)); }
00498 #endif
00499 
00500       void
00501 #if __cplusplus >= 201103L
00502       splice(iterator __position, list&& __x, iterator __i)
00503 #else
00504       splice(iterator __position, list& __x, iterator __i)
00505 #endif
00506       {
00507     __glibcxx_check_insert(__position);
00508 
00509     // We used to perform the splice_alloc check:  not anymore, redundant
00510     // after implementing the relevant bits of N1599.
00511 
00512     _GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(),
00513                   _M_message(__gnu_debug::__msg_splice_bad)
00514                   ._M_iterator(__i, "__i"));
00515     _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x),
00516                   _M_message(__gnu_debug::__msg_splice_other)
00517                  ._M_iterator(__i, "__i")._M_sequence(__x, "__x"));
00518 
00519     // _GLIBCXX_RESOLVE_LIB_DEFECTS
00520     // 250. splicing invalidates iterators
00521     this->_M_transfer_from_if(__x, _Equal(__i.base()));
00522     _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
00523               __i.base());
00524       }
00525 
00526 #if __cplusplus >= 201103L
00527       void
00528       splice(iterator __position, list& __x, iterator __i)
00529       { splice(__position, std::move(__x), __i); }
00530 #endif
00531 
00532       void
00533 #if __cplusplus >= 201103L
00534       splice(iterator __position, list&& __x, iterator __first,
00535          iterator __last)
00536 #else
00537       splice(iterator __position, list& __x, iterator __first,
00538          iterator __last)
00539 #endif
00540       {
00541     __glibcxx_check_insert(__position);
00542     __glibcxx_check_valid_range(__first, __last);
00543     _GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(&__x),
00544                   _M_message(__gnu_debug::__msg_splice_other)
00545                   ._M_sequence(__x, "x")
00546                   ._M_iterator(__first, "first"));
00547 
00548     // We used to perform the splice_alloc check:  not anymore, redundant
00549     // after implementing the relevant bits of N1599.
00550 
00551     for (_Base_iterator __tmp = __first.base();
00552          __tmp != __last.base(); ++__tmp)
00553       {
00554         _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
00555                   _M_message(__gnu_debug::__msg_valid_range)
00556                   ._M_iterator(__first, "first")
00557                   ._M_iterator(__last, "last"));
00558         _GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position,
00559                 _M_message(__gnu_debug::__msg_splice_overlap)
00560                   ._M_iterator(__tmp, "position")
00561                   ._M_iterator(__first, "first")
00562                   ._M_iterator(__last, "last"));
00563         // _GLIBCXX_RESOLVE_LIB_DEFECTS
00564         // 250. splicing invalidates iterators
00565         this->_M_transfer_from_if(__x, _Equal(__tmp));
00566       }
00567 
00568     _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
00569               __first.base(), __last.base());
00570       }
00571 
00572 #if __cplusplus >= 201103L
00573       void
00574       splice(iterator __position, list& __x, iterator __first, iterator __last)
00575       { splice(__position, std::move(__x), __first, __last); }
00576 #endif
00577 
00578       void
00579       remove(const _Tp& __value)
00580       {
00581     for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); )
00582       {
00583         if (*__x == __value)
00584           __x = _M_erase(__x);
00585         else
00586           ++__x;
00587       }
00588       }
00589 
00590       template<class _Predicate>
00591         void
00592         remove_if(_Predicate __pred)
00593         {
00594       for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); )
00595         {
00596           if (__pred(*__x))
00597         __x = _M_erase(__x);
00598           else
00599         ++__x;
00600         }
00601     }
00602 
00603       void
00604       unique()
00605       {
00606     _Base_iterator __first = _Base::begin();
00607     _Base_iterator __last = _Base::end();
00608     if (__first == __last)
00609       return;
00610     _Base_iterator __next = __first; ++__next;
00611     while (__next != __last)
00612       {
00613         if (*__first == *__next)
00614           __next = _M_erase(__next);
00615         else
00616           __first = __next++;
00617       }
00618       }
00619 
00620       template<class _BinaryPredicate>
00621         void
00622         unique(_BinaryPredicate __binary_pred)
00623         {
00624       _Base_iterator __first = _Base::begin();
00625       _Base_iterator __last = _Base::end();
00626       if (__first == __last)
00627         return;
00628       _Base_iterator __next = __first; ++__next;
00629       while (__next != __last)
00630         {
00631           if (__binary_pred(*__first, *__next))
00632         __next = _M_erase(__next);
00633           else
00634         __first = __next++;
00635         }
00636     }
00637 
00638       void
00639 #if __cplusplus >= 201103L
00640       merge(list&& __x)
00641 #else
00642       merge(list& __x)
00643 #endif
00644       {
00645     // _GLIBCXX_RESOLVE_LIB_DEFECTS
00646     // 300. list::merge() specification incomplete
00647     if (this != &__x)
00648       {
00649         __glibcxx_check_sorted(_Base::begin(), _Base::end());
00650         __glibcxx_check_sorted(__x.begin().base(), __x.end().base());
00651         this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
00652         _Base::merge(_GLIBCXX_MOVE(__x._M_base()));
00653       }
00654       }
00655 
00656 #if __cplusplus >= 201103L
00657       void
00658       merge(list& __x)
00659       { merge(std::move(__x)); }
00660 #endif
00661 
00662       template<class _Compare>
00663         void
00664 #if __cplusplus >= 201103L
00665         merge(list&& __x, _Compare __comp)
00666 #else
00667         merge(list& __x, _Compare __comp)
00668 #endif
00669         {
00670       // _GLIBCXX_RESOLVE_LIB_DEFECTS
00671       // 300. list::merge() specification incomplete
00672       if (this != &__x)
00673         {
00674           __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(),
00675                       __comp);
00676           __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
00677                       __comp);
00678           this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
00679           _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp);
00680         }
00681     }
00682 
00683 #if __cplusplus >= 201103L
00684       template<typename _Compare>
00685         void
00686         merge(list& __x, _Compare __comp)
00687         { merge(std::move(__x), __comp); }
00688 #endif
00689 
00690       void
00691       sort() { _Base::sort(); }
00692 
00693       template<typename _StrictWeakOrdering>
00694         void
00695         sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }
00696 
00697       using _Base::reverse;
00698 
00699       _Base&
00700       _M_base() _GLIBCXX_NOEXCEPT       { return *this; }
00701 
00702       const _Base&
00703       _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
00704 
00705     private:
00706       void
00707       _M_invalidate_all()
00708       {
00709     this->_M_invalidate_if(_Not_equal(_Base::end()));
00710       }
00711     };
00712 
00713   template<typename _Tp, typename _Alloc>
00714     inline bool
00715     operator==(const list<_Tp, _Alloc>& __lhs,
00716            const list<_Tp, _Alloc>& __rhs)
00717     { return __lhs._M_base() == __rhs._M_base(); }
00718 
00719   template<typename _Tp, typename _Alloc>
00720     inline bool
00721     operator!=(const list<_Tp, _Alloc>& __lhs,
00722            const list<_Tp, _Alloc>& __rhs)
00723     { return __lhs._M_base() != __rhs._M_base(); }
00724 
00725   template<typename _Tp, typename _Alloc>
00726     inline bool
00727     operator<(const list<_Tp, _Alloc>& __lhs,
00728           const list<_Tp, _Alloc>& __rhs)
00729     { return __lhs._M_base() < __rhs._M_base(); }
00730 
00731   template<typename _Tp, typename _Alloc>
00732     inline bool
00733     operator<=(const list<_Tp, _Alloc>& __lhs,
00734            const list<_Tp, _Alloc>& __rhs)
00735     { return __lhs._M_base() <= __rhs._M_base(); }
00736 
00737   template<typename _Tp, typename _Alloc>
00738     inline bool
00739     operator>=(const list<_Tp, _Alloc>& __lhs,
00740            const list<_Tp, _Alloc>& __rhs)
00741     { return __lhs._M_base() >= __rhs._M_base(); }
00742 
00743   template<typename _Tp, typename _Alloc>
00744     inline bool
00745     operator>(const list<_Tp, _Alloc>& __lhs,
00746           const list<_Tp, _Alloc>& __rhs)
00747     { return __lhs._M_base() > __rhs._M_base(); }
00748 
00749   template<typename _Tp, typename _Alloc>
00750     inline void
00751     swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
00752     { __lhs.swap(__rhs); }
00753 
00754 } // namespace __debug
00755 } // namespace std
00756 
00757 #endif