1.1 --- a/epoc32/include/stdapis/stlport/stl/_list.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_list.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,620 @@
1.4 -_list.h
1.5 +/*
1.6 + *
1.7 + * Copyright (c) 1994
1.8 + * Hewlett-Packard Company
1.9 + *
1.10 + * Copyright (c) 1996,1997
1.11 + * Silicon Graphics Computer Systems, Inc.
1.12 + *
1.13 + * Copyright (c) 1997
1.14 + * Moscow Center for SPARC Technology
1.15 + *
1.16 + * Copyright (c) 1999
1.17 + * Boris Fomitchev
1.18 + *
1.19 + * This material is provided "as is", with absolutely no warranty expressed
1.20 + * or implied. Any use is at your own risk.
1.21 + *
1.22 + * Permission to use or copy this software for any purpose is hereby granted
1.23 + * without fee, provided the above notices are retained on all copies.
1.24 + * Permission to modify the code and to distribute modified code is granted,
1.25 + * provided the above notices are retained, and a notice that the code was
1.26 + * modified is included with the above copyright notice.
1.27 + *
1.28 + */
1.29 +
1.30 +/* NOTE: This is an internal header file, included by other STL headers.
1.31 + * You should not attempt to use it directly.
1.32 + */
1.33 +
1.34 +#ifndef _STLP_INTERNAL_LIST_H
1.35 +#define _STLP_INTERNAL_LIST_H
1.36 +
1.37 +# ifndef _STLP_INTERNAL_ALGOBASE_H
1.38 +# include <stl/_algobase.h>
1.39 +# endif
1.40 +
1.41 +# ifndef _STLP_INTERNAL_ALLOC_H
1.42 +# include <stl/_alloc.h>
1.43 +# endif
1.44 +
1.45 +# ifndef _STLP_INTERNAL_ITERATOR_H
1.46 +# include <stl/_iterator.h>
1.47 +# endif
1.48 +
1.49 +# ifndef _STLP_INTERNAL_CONSTRUCT_H
1.50 +# include <stl/_construct.h>
1.51 +# endif
1.52 +
1.53 +# ifndef _STLP_INTERNAL_FUNCTION_BASE_H
1.54 +# include <stl/_function_base.h>
1.55 +# endif
1.56 +
1.57 +_STLP_BEGIN_NAMESPACE
1.58 +
1.59 +# undef list
1.60 +# define list __WORKAROUND_DBG_RENAME(list)
1.61 +
1.62 +struct _List_node_base {
1.63 + _List_node_base* _M_next;
1.64 + _List_node_base* _M_prev;
1.65 +};
1.66 +
1.67 +template <class _Dummy>
1.68 +class _List_global {
1.69 +public:
1.70 + typedef _List_node_base _Node;
1.71 + static void _STLP_CALL _Transfer(_List_node_base* __position,
1.72 + _List_node_base* __first, _List_node_base* __last);
1.73 +};
1.74 +
1.75 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.76 +_STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
1.77 +# endif
1.78 +typedef _List_global<bool> _List_global_inst;
1.79 +
1.80 +template <class _Tp>
1.81 +struct _List_node : public _List_node_base {
1.82 + _Tp _M_data;
1.83 + __TRIVIAL_STUFF(_List_node)
1.84 +
1.85 +#ifdef __DMC__
1.86 + // for some reason, Digital Mars C++ needs a constructor...
1.87 + private:
1.88 + _List_node();
1.89 +#endif
1.90 +};
1.91 +
1.92 +struct _List_iterator_base {
1.93 + typedef size_t size_type;
1.94 + typedef ptrdiff_t difference_type;
1.95 + typedef bidirectional_iterator_tag iterator_category;
1.96 +
1.97 + _List_node_base* _M_node;
1.98 +
1.99 + _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
1.100 + _List_iterator_base() {}
1.101 +
1.102 + void _M_incr() { _M_node = _M_node->_M_next; }
1.103 + void _M_decr() { _M_node = _M_node->_M_prev; }
1.104 + bool operator==(const _List_iterator_base& __y ) const {
1.105 + return _M_node == __y._M_node;
1.106 + }
1.107 + bool operator!=(const _List_iterator_base& __y ) const {
1.108 + return _M_node != __y._M_node;
1.109 + }
1.110 +};
1.111 +
1.112 +
1.113 +
1.114 +
1.115 +template<class _Tp, class _Traits>
1.116 +struct _List_iterator : public _List_iterator_base {
1.117 + typedef _Tp value_type;
1.118 + typedef typename _Traits::pointer pointer;
1.119 + typedef typename _Traits::reference reference;
1.120 +
1.121 + typedef _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
1.122 + typedef _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
1.123 + typedef _List_iterator<_Tp, _Traits> _Self;
1.124 +
1.125 + typedef bidirectional_iterator_tag iterator_category;
1.126 + typedef _List_node<_Tp> _Node;
1.127 + typedef size_t size_type;
1.128 + typedef ptrdiff_t difference_type;
1.129 +
1.130 + _List_iterator(_Node* __x) : _List_iterator_base(__x) {}
1.131 + _List_iterator() {}
1.132 + _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
1.133 +
1.134 + reference operator*() const { return ((_Node*)_M_node)->_M_data; }
1.135 +
1.136 + _STLP_DEFINE_ARROW_OPERATOR
1.137 +
1.138 + _Self& operator++() {
1.139 + this->_M_incr();
1.140 + return *this;
1.141 + }
1.142 + _Self operator++(int) {
1.143 + _Self __tmp = *this;
1.144 + this->_M_incr();
1.145 + return __tmp;
1.146 + }
1.147 + _Self& operator--() {
1.148 + this->_M_decr();
1.149 + return *this;
1.150 + }
1.151 + _Self operator--(int) {
1.152 + _Self __tmp = *this;
1.153 + this->_M_decr();
1.154 + return __tmp;
1.155 + }
1.156 +};
1.157 +
1.158 +
1.159 +#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.160 +template <class _Tp, class _Traits>
1.161 +inline _Tp* value_type(const _List_iterator<_Tp, _Traits>&) { return 0; }
1.162 +inline bidirectional_iterator_tag iterator_category(const _List_iterator_base&) { return bidirectional_iterator_tag();}
1.163 +inline ptrdiff_t* distance_type(const _List_iterator_base&) { return 0; }
1.164 +#endif
1.165 +
1.166 +
1.167 +// Base class that encapsulates details of allocators and helps
1.168 +// to simplify EH
1.169 +
1.170 +template <class _Tp, class _Alloc>
1.171 +class _List_base
1.172 +{
1.173 +protected:
1.174 + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
1.175 + typedef _List_node<_Tp> _Node;
1.176 + typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type
1.177 + _Node_allocator_type;
1.178 +public:
1.179 + typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type
1.180 + allocator_type;
1.181 +
1.182 + allocator_type get_allocator() const {
1.183 + return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp);
1.184 + }
1.185 +
1.186 + _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), (_Node*)0) {
1.187 + _Node* __n = _M_node.allocate(1);
1.188 + __n->_M_next = __n;
1.189 + __n->_M_prev = __n;
1.190 + _M_node._M_data = __n;
1.191 + }
1.192 + ~_List_base() {
1.193 + clear();
1.194 + _M_node.deallocate(_M_node._M_data, 1);
1.195 + }
1.196 +
1.197 + void clear();
1.198 +
1.199 +public:
1.200 + _STLP_alloc_proxy<_Node*, _Node, _Node_allocator_type> _M_node;
1.201 +};
1.202 +
1.203 +template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
1.204 +class list;
1.205 +
1.206 +// helper functions to reduce code duplication
1.207 +template <class _Tp, class _Alloc, class _Predicate>
1.208 +void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
1.209 +
1.210 +template <class _Tp, class _Alloc, class _BinaryPredicate>
1.211 +void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
1.212 +
1.213 +template <class _Tp, class _Alloc, class _StrictWeakOrdering>
1.214 +void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
1.215 + _StrictWeakOrdering __comp);
1.216 +
1.217 +template <class _Tp, class _Alloc, class _StrictWeakOrdering>
1.218 +void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
1.219 +
1.220 +template <class _Tp, class _Alloc>
1.221 +class list : public _List_base<_Tp, _Alloc> {
1.222 + typedef _List_base<_Tp, _Alloc> _Base;
1.223 + typedef list<_Tp, _Alloc> _Self;
1.224 +public:
1.225 + typedef _Tp value_type;
1.226 + typedef value_type* pointer;
1.227 + typedef const value_type* const_pointer;
1.228 + typedef value_type& reference;
1.229 + typedef const value_type& const_reference;
1.230 + typedef _List_node<_Tp> _Node;
1.231 + typedef size_t size_type;
1.232 + typedef ptrdiff_t difference_type;
1.233 + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
1.234 + typedef typename _Base::allocator_type allocator_type;
1.235 + typedef bidirectional_iterator_tag _Iterator_category;
1.236 +
1.237 +public:
1.238 + typedef _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
1.239 + typedef _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
1.240 + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
1.241 +
1.242 +protected:
1.243 + _Node* _M_create_node(const _Tp& __x)
1.244 + {
1.245 + _Node* __p = this->_M_node.allocate(1);
1.246 + _STLP_TRY {
1.247 + _Construct(&__p->_M_data, __x);
1.248 + }
1.249 + _STLP_UNWIND(this->_M_node.deallocate(__p, 1));
1.250 + return __p;
1.251 + }
1.252 +
1.253 + _Node* _M_create_node()
1.254 + {
1.255 + _Node* __p = this->_M_node.allocate(1);
1.256 + _STLP_TRY {
1.257 + _Construct(&__p->_M_data);
1.258 + }
1.259 + _STLP_UNWIND(this->_M_node.deallocate(__p, 1));
1.260 + return __p;
1.261 + }
1.262 +
1.263 +public:
1.264 +# if !(defined(__MRC__)||(defined(__SC__) && !defined(__DMC__)))
1.265 + explicit
1.266 +# endif
1.267 + list(const allocator_type& __a = allocator_type()) :
1.268 + _List_base<_Tp, _Alloc>(__a) {
1.269 + _STLP_POP_IF_CHECK
1.270 + }
1.271 +
1.272 + iterator begin() { return iterator((_Node*)(this->_M_node._M_data->_M_next)); }
1.273 + const_iterator begin() const { return const_iterator((_Node*)(this->_M_node._M_data->_M_next)); }
1.274 +
1.275 + iterator end() { return this->_M_node._M_data; }
1.276 + const_iterator end() const { return this->_M_node._M_data; }
1.277 +
1.278 + reverse_iterator rbegin()
1.279 + { return reverse_iterator(end()); }
1.280 + const_reverse_iterator rbegin() const
1.281 + { return const_reverse_iterator(end()); }
1.282 +
1.283 + reverse_iterator rend()
1.284 + { return reverse_iterator(begin()); }
1.285 + const_reverse_iterator rend() const
1.286 + { return const_reverse_iterator(begin()); }
1.287 +
1.288 + bool empty() const { return this->_M_node._M_data->_M_next == this->_M_node._M_data; }
1.289 + size_type size() const {
1.290 + size_type __result = distance(begin(), end());
1.291 + return __result;
1.292 + }
1.293 + size_type max_size() const { return size_type(-1); }
1.294 +
1.295 + reference front() { return *begin(); }
1.296 + const_reference front() const { return *begin(); }
1.297 + reference back() { return *(--end()); }
1.298 + const_reference back() const { return *(--end()); }
1.299 +
1.300 + void swap(list<_Tp, _Alloc>& __x) {
1.301 + _STLP_STD::swap(this->_M_node, __x._M_node);
1.302 + }
1.303 +
1.304 + iterator insert(iterator __position, const _Tp& __x) {
1.305 +
1.306 + _Node* __tmp = _M_create_node(__x);
1.307 + _List_node_base* __n = __position._M_node;
1.308 + _List_node_base* __p = __n->_M_prev;
1.309 + __tmp->_M_next = __n;
1.310 + __tmp->_M_prev = __p;
1.311 + __p->_M_next = __tmp;
1.312 + __n->_M_prev = __tmp;
1.313 + return __tmp;
1.314 + }
1.315 +
1.316 +#ifdef _STLP_MEMBER_TEMPLATES
1.317 + template <class _InputIterator>
1.318 + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
1.319 + typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
1.320 + _M_insert_dispatch(__pos, __first, __last, _Integral());
1.321 + }
1.322 + // Check whether it's an integral type. If so, it's not an iterator.
1.323 + template<class _Integer>
1.324 + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1.325 + const __true_type&) {
1.326 + _M_fill_insert(__pos, (size_type) __n, (_Tp) __x);
1.327 + }
1.328 + template <class _InputIter>
1.329 + void
1.330 + _M_insert_dispatch(iterator __position,
1.331 + _InputIter __first, _InputIter __last,
1.332 + const __false_type&)
1.333 +#else /* _STLP_MEMBER_TEMPLATES */
1.334 + void insert(iterator __position, const _Tp* __first, const _Tp* __last) {
1.335 + for ( ; __first != __last; ++__first)
1.336 + insert(__position, *__first);
1.337 + }
1.338 + void insert(iterator __position, const_iterator __first, const_iterator __last)
1.339 +#endif /* _STLP_MEMBER_TEMPLATES */
1.340 + {
1.341 + for ( ; __first != __last; ++__first)
1.342 + insert(__position, *__first);
1.343 + }
1.344 + void insert(iterator __pos, size_type __n, const _Tp& __x) { _M_fill_insert(__pos, __n, __x); }
1.345 +
1.346 + void _M_fill_insert(iterator __pos, size_type __n, const _Tp& __x) {
1.347 + for ( ; __n > 0; --__n)
1.348 + insert(__pos, __x);
1.349 + }
1.350 + void push_front(const _Tp& __x) { insert(begin(), __x); }
1.351 + void push_back(const _Tp& __x) { insert(end(), __x); }
1.352 +
1.353 +# ifndef _STLP_NO_ANACHRONISMS
1.354 + iterator insert(iterator __position) { return insert(__position, _Tp()); }
1.355 + void push_front() {insert(begin());}
1.356 + void push_back() {insert(end());}
1.357 +# endif
1.358 +
1.359 + iterator erase(iterator __position) {
1.360 + _List_node_base* __next_node = __position._M_node->_M_next;
1.361 + _List_node_base* __prev_node = __position._M_node->_M_prev;
1.362 + _Node* __n = (_Node*) __position._M_node;
1.363 + __prev_node->_M_next = __next_node;
1.364 + __next_node->_M_prev = __prev_node;
1.365 + _STLP_STD::_Destroy(&__n->_M_data);
1.366 + this->_M_node.deallocate(__n, 1);
1.367 + return iterator((_Node*)__next_node);
1.368 + }
1.369 +
1.370 + iterator erase(iterator __first, iterator __last) {
1.371 + while (__first != __last)
1.372 + erase(__first++);
1.373 + return __last;
1.374 + }
1.375 +
1.376 + void resize(size_type __new_size, _Tp __x);
1.377 + void resize(size_type __new_size) { this->resize(__new_size, _Tp()); }
1.378 +
1.379 + void pop_front() { erase(begin()); }
1.380 + void pop_back() {
1.381 + iterator __tmp = end();
1.382 + erase(--__tmp);
1.383 + }
1.384 + list(size_type __n, const _Tp& __val,
1.385 + const allocator_type& __a = allocator_type())
1.386 + : _List_base<_Tp, _Alloc>(__a)
1.387 + {
1.388 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.389 + this->insert(begin(), __n, __val);
1.390 + _STLP_POP_CLEANUP_ITEM
1.391 + }
1.392 + explicit list(size_type __n)
1.393 + : _List_base<_Tp, _Alloc>(allocator_type())
1.394 + {
1.395 +# ifdef _STLP_USE_TRAP_LEAVE
1.396 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.397 + _Tp __p;
1.398 + _STLP_PUSH_CLEANUP_ITEM(_Tp, &__p)
1.399 + this->insert(begin(), __n, __p);
1.400 + // unconditional for __p
1.401 + CleanupStack::Pop();
1.402 + _STLP_POP_CLEANUP_ITEM
1.403 +# else
1.404 + this->insert(begin(), __n, _Tp());
1.405 +# endif
1.406 + }
1.407 +
1.408 +#ifdef _STLP_MEMBER_TEMPLATES
1.409 + // We don't need any dispatching tricks here, because insert does all of
1.410 + // that anyway.
1.411 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.412 + template <class _InputIterator>
1.413 + list(_InputIterator __first, _InputIterator __last)
1.414 + : _List_base<_Tp, _Alloc>(allocator_type())
1.415 + {
1.416 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.417 + insert(begin(), __first, __last);
1.418 + _STLP_POP_CLEANUP_ITEM
1.419 + }
1.420 +# endif
1.421 +
1.422 + template <class _InputIterator>
1.423 + list(_InputIterator __first, _InputIterator __last,
1.424 + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.425 + : _List_base<_Tp, _Alloc>(__a)
1.426 + {
1.427 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.428 + insert(begin(), __first, __last);
1.429 + _STLP_POP_CLEANUP_ITEM
1.430 + }
1.431 +
1.432 +#else /* _STLP_MEMBER_TEMPLATES */
1.433 +
1.434 + list(const _Tp* __first, const _Tp* __last,
1.435 + const allocator_type& __a = allocator_type())
1.436 + : _List_base<_Tp, _Alloc>(__a)
1.437 + {
1.438 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.439 + insert(begin(), __first, __last);
1.440 + _STLP_POP_CLEANUP_ITEM
1.441 + }
1.442 + list(const_iterator __first, const_iterator __last,
1.443 + const allocator_type& __a = allocator_type())
1.444 + : _List_base<_Tp, _Alloc>(__a)
1.445 + {
1.446 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.447 + insert(begin(), __first, __last);
1.448 + _STLP_POP_CLEANUP_ITEM
1.449 + }
1.450 +
1.451 +#endif /* _STLP_MEMBER_TEMPLATES */
1.452 + list(const list<_Tp, _Alloc>& __x) : _List_base<_Tp, _Alloc>(__x.get_allocator())
1.453 + {
1.454 + _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.455 + insert(begin(), __x.begin(), __x.end());
1.456 + _STLP_POP_CLEANUP_ITEM
1.457 + }
1.458 +
1.459 + ~list() { }
1.460 +
1.461 + list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x);
1.462 +
1.463 +public:
1.464 + // assign(), a generalized assignment member function. Two
1.465 + // versions: one that takes a count, and one that takes a range.
1.466 + // The range version is a member template, so we dispatch on whether
1.467 + // or not the type is an integer.
1.468 +
1.469 + void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
1.470 +
1.471 + void _M_fill_assign(size_type __n, const _Tp& __val);
1.472 +
1.473 +#ifdef _STLP_MEMBER_TEMPLATES
1.474 +
1.475 + template <class _InputIterator>
1.476 + void assign(_InputIterator __first, _InputIterator __last) {
1.477 + typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
1.478 + _M_assign_dispatch(__first, __last, _Integral());
1.479 + }
1.480 +
1.481 + template <class _Integer>
1.482 + void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
1.483 + { assign((size_type) __n, (_Tp) __val); }
1.484 +
1.485 + template <class _InputIterator>
1.486 + void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
1.487 + const __false_type&) {
1.488 + iterator __first1 = begin();
1.489 + iterator __last1 = end();
1.490 + for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
1.491 + *__first1 = *__first2;
1.492 + if (__first2 == __last2)
1.493 + erase(__first1, __last1);
1.494 + else
1.495 + insert(__last1, __first2, __last2);
1.496 + }
1.497 +
1.498 +#endif /* _STLP_MEMBER_TEMPLATES */
1.499 +
1.500 +public:
1.501 + void splice(iterator __position, _Self& __x) {
1.502 + if (!__x.empty())
1.503 + _List_global_inst::_Transfer(__position._M_node, __x.begin()._M_node, __x.end()._M_node);
1.504 + }
1.505 + void splice(iterator __position, _Self&, iterator __i) {
1.506 + iterator __j = __i;
1.507 + ++__j;
1.508 + if (__position == __i || __position == __j) return;
1.509 + _List_global_inst::_Transfer(__position._M_node, __i._M_node, __j._M_node);
1.510 + }
1.511 + void splice(iterator __position, _Self&, iterator __first, iterator __last) {
1.512 + if (__first != __last)
1.513 + _List_global_inst::_Transfer(__position._M_node, __first._M_node, __last._M_node);
1.514 + }
1.515 +
1.516 + void remove(const _Tp& __val) {
1.517 + iterator __first = begin();
1.518 + iterator __last = end();
1.519 + while (__first != __last) {
1.520 + iterator __next = __first;
1.521 + ++__next;
1.522 + if (__val == *__first) erase(__first);
1.523 + __first = __next;
1.524 + }
1.525 + }
1.526 +
1.527 + void unique() {
1.528 + _S_unique(*this, equal_to<_Tp>());
1.529 + }
1.530 +
1.531 + void merge(_Self& __x) {
1.532 + _S_merge(*this, __x, less<_Tp>());
1.533 + }
1.534 +
1.535 + void reverse() {
1.536 + _List_node_base* __p = this->_M_node._M_data;
1.537 + _List_node_base* __tmp = __p;
1.538 + do {
1.539 + _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
1.540 + __tmp = __tmp->_M_prev; // Old next node is now prev.
1.541 + } while (__tmp != __p);
1.542 + }
1.543 +
1.544 + void sort() {
1.545 + _S_sort(*this, less<_Tp>());
1.546 + }
1.547 +
1.548 +#ifdef _STLP_MEMBER_TEMPLATES
1.549 + template <class _Predicate> void remove_if(_Predicate __pred) {
1.550 + _S_remove_if(*this, __pred);
1.551 + }
1.552 + template <class _BinaryPredicate>
1.553 + void unique(_BinaryPredicate __binary_pred) {
1.554 + _S_unique(*this, __binary_pred);
1.555 + }
1.556 +
1.557 + template <class _StrictWeakOrdering>
1.558 + void merge(list<_Tp, _Alloc>& __x,
1.559 + _StrictWeakOrdering __comp) {
1.560 + _S_merge(*this, __x, __comp);
1.561 + }
1.562 +
1.563 + template <class _StrictWeakOrdering>
1.564 + void sort(_StrictWeakOrdering __comp) {
1.565 + _S_sort(*this, __comp);
1.566 + }
1.567 +#endif /* _STLP_MEMBER_TEMPLATES */
1.568 +
1.569 +#ifdef _STLP_USE_TRAP_LEAVE
1.570 +public:
1.571 + static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.572 + static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.573 +#endif
1.574 +
1.575 +};
1.576 +
1.577 +template <class _Tp, class _Alloc>
1.578 +_STLP_INLINE_LOOP bool _STLP_CALL
1.579 +operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y)
1.580 +{
1.581 + typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
1.582 + const_iterator __end1 = __x.end();
1.583 + const_iterator __end2 = __y.end();
1.584 +
1.585 + const_iterator __i1 = __x.begin();
1.586 + const_iterator __i2 = __y.begin();
1.587 + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
1.588 + ++__i1;
1.589 + ++__i2;
1.590 + }
1.591 + return __i1 == __end1 && __i2 == __end2;
1.592 +}
1.593 +
1.594 +# define _STLP_EQUAL_OPERATOR_SPECIALIZED
1.595 +# define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
1.596 +# define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
1.597 +# include <stl/_relops_cont.h>
1.598 +# undef _STLP_TEMPLATE_CONTAINER
1.599 +# undef _STLP_TEMPLATE_HEADER
1.600 +# undef _STLP_EQUAL_OPERATOR_SPECIALIZED
1.601 +
1.602 +_STLP_END_NAMESPACE
1.603 +
1.604 +# if !defined (_STLP_LINK_TIME_INSTANTIATION)
1.605 +# include <stl/_list.c>
1.606 +# endif
1.607 +
1.608 +// do a cleanup
1.609 +# undef list
1.610 +# define __list__ __FULL_NAME(list)
1.611 +
1.612 +#if defined (_STLP_DEBUG)
1.613 +# include <stl/debug/_list.h>
1.614 +#endif
1.615 +
1.616 +#if defined (_STLP_USE_WRAPPER_FOR_ALLOC_PARAM)
1.617 +# include <stl/wrappers/_list.h>
1.618 +#endif
1.619 +
1.620 +#endif /* _STLP_INTERNAL_LIST_H */
1.621 +
1.622 +// Local Variables:
1.623 +// mode:C++
1.624 +// End: