19720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/*
29720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
39720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1994
49720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Hewlett-Packard Company
59720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
69720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1996,1997
79720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Silicon Graphics Computer Systems, Inc.
89720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
99720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1997
109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Moscow Center for SPARC Technology
119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1999
139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Boris Fomitchev
149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * This material is provided "as is", with absolutely no warranty expressed
169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * or implied. Any use is at your own risk.
179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to use or copy this software for any purpose is hereby granted
199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * without fee, provided the above notices are retained on all copies.
209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to modify the code and to distribute modified code is granted,
219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * provided the above notices are retained, and a notice that the code was
229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * modified is included with the above copyright notice.
239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/* NOTE: This is an internal header file, included by other STL headers.
279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *   You should not attempt to use it directly.
289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_DBG_LIST_H
319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_INTERNAL_DBG_LIST_H
329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_ALGO_H
349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_algo.h>
359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_DBG_ITERATOR_H
389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/debug/_iterator.h>
399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc>
429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_BEGIN_NAMESPACE
449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Tp, class _Alloc>
479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockinline _Tp*
489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockvalue_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{ return (_Tp*)0; }
509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Tp, class _Alloc>
519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockinline bidirectional_iterator_tag
529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockiterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{ return bidirectional_iterator_tag(); }
549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
56e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scotttemplate <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass list :
589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined (__DMC__)
599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block             private
609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST >
629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block           , public __stlport_class<list<_Tp, _Alloc> >
649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{
669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_NON_DBG_LIST _Base;
679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef list<_Tp, _Alloc> _Self;
689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck;
699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  __IMPORT_CONTAINER_TYPEDEFS(_Base)
729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > >    const_iterator;
769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Base _M_non_dbg_impl;
819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_PRIV __owned_list _M_iter_list;
829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void _Invalidate_iterator(const iterator& __it)
849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void _Invalidate_iterators(const iterator& __first, const iterator& __last)
869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Base::iterator _Base_iterator;
899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  explicit list(const allocator_type& __a = allocator_type()) :
929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  explicit list(size_type __n, const _Tp& __x = _Tp(),
969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(size_type __n, const _Tp& __x,
989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block            const allocator_type& __a = allocator_type())
1009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
1019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined(_STLP_DONT_SUP_DFLT_PARAM)
1039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  explicit list(size_type __n)
1049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
1059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
1069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
107e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_NO_MOVE_SEMANTIC)
1089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(__move_source<_Self> src)
1099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
1109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_iter_list(&_M_non_dbg_impl) {
111e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
1129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    src.get()._M_iter_list._Invalidate_all();
113e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  else
1149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    src.get()._M_iter_list._Set_owner(_M_iter_list);
115e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  endif
1169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
117e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
1189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
1209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
1219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(_InputIterator __first, _InputIterator __last,
1229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block       const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _ConstructCheck(__first, __last),
1249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
1259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_iter_list(&_M_non_dbg_impl) {}
1269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
1279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
1289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(_InputIterator __first, _InputIterator __last)
1299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _ConstructCheck(__first, __last),
1309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
1319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_iter_list(&_M_non_dbg_impl) {}
1329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  endif
1339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
1349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(const value_type* __first, const value_type* __last,
1369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block       const allocator_type& __a = allocator_type())
1379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _ConstructCheck(__first, __last),
1389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl(__first, __last, __a),
1399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_iter_list(&_M_non_dbg_impl) {}
1409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(const_iterator __first, const_iterator __last,
1419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block       const allocator_type& __a = allocator_type())
1429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _ConstructCheck(__first, __last),
1439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
1449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_iter_list(&_M_non_dbg_impl) {}
1459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
1479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  list(const _Self& __x) :
1499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _ConstructCheck(__x),
1509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {}
1519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator=(const _Self& __x) {
1539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (this != &__x) {
1549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      //Should not invalidate end iterator
1559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _Invalidate_iterators(begin(), end());
1569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl = __x._M_non_dbg_impl;
1579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
1589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *this;
1599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
1629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator begin()             { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
1649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
1659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator end()               { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
1679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator end() const   { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
1689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reverse_iterator rbegin()    { return reverse_iterator(end()); }
1709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reverse_iterator rend()      { return reverse_iterator(begin()); }
1719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
1739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
1749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type size() const { return _M_non_dbg_impl.size(); }
1769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_size() const { return _M_non_dbg_impl.max_size(); }
1779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool empty() const { return _M_non_dbg_impl.empty(); }
1789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  // those are here to enforce checking
1809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reference front() {
1819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
1829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *begin();
1839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reference front() const {
1859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
1869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *begin();
1879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reference back() {
1899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
1909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *(--end());
1919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reference back() const {
1939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
1949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *(--end());
1959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void swap(_Self& __x) {
1989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_iter_list._Swap_owners(__x._M_iter_list);
1999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
2009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
201e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
202e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void _M_swap_workaround(_Self& __x) { swap(__x); }
203e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
2049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
2069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
2079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
2089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(iterator __pos, const _Tp& __x) {
2099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
2109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
2119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) );
2129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
2159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
2169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
2179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
2199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
2209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
2219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
2229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
2239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert(__pos._M_iterator,
2249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                           _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
2259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
226e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
227e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
228e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_MEMBER_TEMPLATES)
2299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(iterator __pos, const _Tp* __first, const _Tp* __last) {
2309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
2319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
2329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
2339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
234e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
2359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
236e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
2379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(iterator __pos,
2389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block              const_iterator __first, const_iterator __last) {
2399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
2409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
241e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
242e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
243e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  endif
244e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
245e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  }
246e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void insert(iterator __pos,
247e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott              iterator __first, iterator __last) {
248e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
249e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
250e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
251e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
252e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  endif
2539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
2549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
2569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(iterator __pos, size_type __n, const _Tp& __x) {
2589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
2599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
2609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); }
2639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void pop_back() {
2649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
2659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterator(end());
2669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.pop_back();
2679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
2709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void pop_front() {
2719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
2729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterator(begin());
2739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.pop_front();
2749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator erase(iterator __pos) {
2779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
2789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
2799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterator(__pos);
2809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator));
2819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator erase(iterator __first, iterator __last) {
2839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
2849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterators(__first, __last);
2859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
2869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
2899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void resize(size_type __new_size, const _Tp& __x = _Tp()) {
2909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
2919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void resize(size_type __new_size, const _Tp& __x) {
2929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
2939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __i = _M_non_dbg_impl.begin();
2949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    size_type __len = 0;
2959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len);
2969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (__len == __new_size)
2989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      erase(iterator(&_M_iter_list, __i), end());
2999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else                          // __i == end()
3009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x);
3019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined(_STLP_DONT_SUP_DFLT_PARAM)
3049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
305e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
3069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
3089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
3099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void assign(_InputIterator __first, _InputIterator __last) {
310e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
311e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
312e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(begin(), end());
3139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
3159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void assign(const _Tp* __first, const _Tp* __last) {
3169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
3179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.assign(__first, __last);
318e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(begin(), end());
3199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
321e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void assign(iterator __first, iterator __last) {
3229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
3239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
324e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(begin(), end());
3259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
327e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void assign(const_iterator __first, const_iterator __last) {
328e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
329e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
330e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(begin(), end());
3319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
332e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
3339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void assign(size_type __n, const _Tp& __val) {
335e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(begin(), end());
3369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.assign(__n, __val);
3379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void remove(const _Tp& __x) {
3409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
3419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    while (__first != __last) {
3429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _Base_iterator __next = __first;
3439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      ++__next;
3449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      if (__x == *__first) {
3459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _Invalidate_iterator(iterator(&_M_iter_list, __first));
3469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _M_non_dbg_impl.erase(__first);
3479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      }
3489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __first = __next;
3499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
3509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void clear() {
3539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterators(begin(), end());
3549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.clear();
3559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
3589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void splice(iterator __pos, _Self& __x) {
3599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
3609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
3619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
3629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (get_allocator() == __x.get_allocator())
3639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._M_iter_list._Set_owner(_M_iter_list);
3649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else
3659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
3669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      // Std: 23.2.2.4:4
3679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      // end iterator is not invalidated:
3689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._Invalidate_iterators(__x.begin(), __x.end());
3699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void splice(iterator __pos, _Self& __x, iterator __i) {
3729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
3739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
3749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i))
3759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
3769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
3779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (get_allocator() == __x.get_allocator())
3789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
3799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else
3809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
3819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      // Std: 23.2.2.4:7
3829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._Invalidate_iterator(__i);
3839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
3869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
3879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
3889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true)
3899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
3909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (this->get_allocator() == __x.get_allocator())
3919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
3929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else
3939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
3949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      // Std: 23.2.2.4:12
3959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._Invalidate_iterators(__first, __last);
3969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator);
3979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void merge(_Self& __x) {
4009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined (_STLP_NO_EXTENSIONS)
4019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator))
4029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
4039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
4049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
4059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (this->get_allocator() == __x.get_allocator()) {
4069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._M_iter_list._Set_owner(_M_iter_list);
4079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else {
4099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._Invalidate_iterators(__x.begin(), __x.end());
4109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void reverse() {
4139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.reverse();
4149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void unique() {
4169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
4179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (__first == __last) return;
4189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __next = __first;
4199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    while (++__next != __last) {
4209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      if (*__first == *__next) {
4219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _Invalidate_iterator(iterator(&_M_iter_list, __next));
4229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _M_non_dbg_impl.erase(__next);
4239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      }
4249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      else
4259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        __first = __next;
4269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __next = __first;
4279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void sort() {
4309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.sort();
4319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
4349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _Predicate>
4359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void remove_if(_Predicate __pred) {
4369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
4379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    while (__first != __last) {
4389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _Base_iterator __next = __first;
4399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      ++__next;
4409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      if (__pred(*__first)) {
4419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _Invalidate_iterator(iterator(&_M_iter_list, __first));
4429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _M_non_dbg_impl.erase(__first);
4439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      }
4449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __first = __next;
4459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _BinaryPredicate>
4499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void unique(_BinaryPredicate __binary_pred) {
4509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
4519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (__first == __last) return;
4529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __next = __first;
4539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    while (++__next != __last) {
4549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      if (__binary_pred(*__first, *__next)) {
4559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _Invalidate_iterator(iterator(&_M_iter_list, __next));
4569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        _M_non_dbg_impl.erase(__next);
4579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      }
4589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      else
4599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block        __first = __next;
4609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __next = __first;
4619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _StrictWeakOrdering>
4659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void merge(_Self& __x, _StrictWeakOrdering __comp) {
4669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined (_STLP_NO_EXTENSIONS)
4679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp))
4689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp))
4699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
4709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp);
4719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (this->get_allocator() == __x.get_allocator()) {
4729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._M_iter_list._Set_owner(_M_iter_list);
4739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    else {
4759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      __x._Invalidate_iterators(__x.begin(), __x.end());
4769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
4779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _StrictWeakOrdering>
4809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void sort(_StrictWeakOrdering __comp) {
4819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.sort(__comp);
4829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
4849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
4859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_END_NAMESPACE
4889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#undef _STLP_NON_DBG_LIST
4909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_INTERNAL_LIST_H */
4929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Local Variables:
4949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// mode:C++
4959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// End:
496