4 * Hewlett-Packard Company
6 * Copyright (c) 1996,1997
7 * Silicon Graphics Computer Systems, Inc.
10 * Moscow Center for SPARC Technology
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
26 /* NOTE: This is an internal header file, included by other STL headers.
27 * You should not attempt to use it directly.
30 #ifndef _STLP_INTERNAL_LIST_IMPL_H
31 #define _STLP_INTERNAL_LIST_IMPL_H
33 #ifndef _STLP_INTERNAL_ALGOBASE_H
34 # include <stl/_algobase.h>
37 #ifndef _STLP_INTERNAL_ALLOC_H
38 # include <stl/_alloc.h>
41 #ifndef _STLP_INTERNAL_ITERATOR_H
42 # include <stl/_iterator.h>
45 #ifndef _STLP_INTERNAL_CONSTRUCT_H
46 # include <stl/_construct.h>
49 #ifndef _STLP_INTERNAL_FUNCTION_BASE_H
50 # include <stl/_function_base.h>
55 _STLP_MOVE_TO_PRIV_NAMESPACE
57 struct _List_node_base {
58 _List_node_base* _M_next;
59 _List_node_base* _M_prev;
62 template <class _Dummy>
65 typedef _List_node_base _Node_base;
66 static void _STLP_CALL _Transfer(_Node_base* __pos,
67 _Node_base* __first, _Node_base* __last);
70 #if defined (_STLP_USE_TEMPLATE_EXPORT)
71 _STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
73 typedef _List_global<bool> _List_global_inst;
76 class _List_node : public _List_node_base {
79 __TRIVIAL_STUFF(_List_node)
82 struct _List_iterator_base {
83 typedef size_t size_type;
84 typedef ptrdiff_t difference_type;
85 typedef bidirectional_iterator_tag iterator_category;
87 _List_node_base* _M_node;
89 _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
91 void _M_incr() { _M_node = _M_node->_M_next; }
92 void _M_decr() { _M_node = _M_node->_M_prev; }
96 template<class _Tp, class _Traits>
97 struct _List_iterator : public _List_iterator_base {
98 typedef _Tp value_type;
99 typedef typename _Traits::pointer pointer;
100 typedef typename _Traits::reference reference;
102 typedef _List_iterator<_Tp, _Traits> _Self;
103 typedef typename _Traits::_NonConstTraits _NonConstTraits;
104 typedef _List_iterator<_Tp, _NonConstTraits> iterator;
105 typedef typename _Traits::_ConstTraits _ConstTraits;
106 typedef _List_iterator<_Tp, _ConstTraits> const_iterator;
108 typedef bidirectional_iterator_tag iterator_category;
109 typedef _List_node<_Tp> _Node;
110 typedef size_t size_type;
111 typedef ptrdiff_t difference_type;
113 explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
114 _List_iterator() : _List_iterator_base(0) {}
115 //copy constructor for iterator and constructor from iterator for const_iterator
116 _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
118 reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
120 _STLP_DEFINE_ARROW_OPERATOR
122 _Self& operator++() {
126 _Self operator++(int) {
131 _Self& operator--() {
135 _Self operator--(int) {
140 bool operator==(const_iterator __y ) const {
141 return this->_M_node == __y._M_node;
143 bool operator!=(const_iterator __y ) const {
144 return this->_M_node != __y._M_node;
148 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
149 _STLP_MOVE_TO_STD_NAMESPACE
150 template <class _Tp, class _Traits>
151 struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > {
152 typedef __false_type has_trivial_default_constructor;
153 typedef __true_type has_trivial_copy_constructor;
154 typedef __true_type has_trivial_assignment_operator;
155 typedef __true_type has_trivial_destructor;
156 typedef __false_type is_POD_type;
158 _STLP_MOVE_TO_PRIV_NAMESPACE
159 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
161 #if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
162 _STLP_MOVE_TO_STD_NAMESPACE
163 template <class _Tp, class _Traits>
164 inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
165 inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
166 inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
167 _STLP_MOVE_TO_PRIV_NAMESPACE
170 // Base class that encapsulates details of allocators and helps
173 template <class _Tp, class _Alloc>
176 _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
177 typedef _List_node_base _Node_base;
178 typedef _List_node<_Tp> _Node;
179 typedef _List_base<_Tp, _Alloc> _Self;
180 typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
182 typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
183 typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
185 allocator_type get_allocator() const
186 { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
188 _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
189 { _M_empty_initialize(); }
190 _List_base(__move_source<_Self> src) :
191 _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
192 if (src.get().empty())
193 //We force this to empty.
194 _M_empty_initialize();
196 src.get()._M_empty_initialize();
197 _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
205 bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
207 void _M_empty_initialize() {
208 _M_node._M_data._M_next = &_M_node._M_data;
209 _M_node._M_data._M_prev = _M_node._M_data._M_next;
216 #if defined (_STLP_USE_PTR_SPECIALIZATIONS)
217 # define list _STLP_PTR_IMPL_NAME(list)
218 #elif defined (_STLP_DEBUG)
219 # define list _STLP_NON_DBG_NAME(list)
221 _STLP_MOVE_TO_STD_NAMESPACE
224 template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
228 _STLP_MOVE_TO_PRIV_NAMESPACE
231 // helper functions to reduce code duplication
232 template <class _Tp, class _Alloc, class _Predicate>
233 void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
235 template <class _Tp, class _Alloc, class _BinaryPredicate>
236 void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
238 template <class _Tp, class _Alloc, class _StrictWeakOrdering>
239 void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
240 _StrictWeakOrdering __comp);
242 template <class _Tp, class _Alloc, class _StrictWeakOrdering>
243 void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
246 _STLP_MOVE_TO_STD_NAMESPACE
249 template <class _Tp, class _Alloc>
250 class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
251 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
252 , public __stlport_class<list<_Tp, _Alloc> >
255 typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
256 typedef list<_Tp, _Alloc> _Self;
257 typedef _STLP_PRIV _List_node<_Tp> _Node;
258 typedef _STLP_PRIV _List_node_base _Node_base;
260 typedef _Tp value_type;
261 typedef value_type* pointer;
262 typedef const value_type* const_pointer;
263 typedef value_type& reference;
264 typedef const value_type& const_reference;
265 typedef size_t size_type;
266 typedef ptrdiff_t difference_type;
267 _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
268 typedef typename _Base::allocator_type allocator_type;
269 typedef bidirectional_iterator_tag _Iterator_category;
272 typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
273 typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
274 _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
277 #if !defined(_STLP_DONT_SUP_DFLT_PARAM)
278 _Node_base* _M_create_node(const_reference __x = value_type()) {
280 _Node_base* _M_create_node(const_reference __x) {
281 #endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
282 _Node* __p = this->_M_node.allocate(1);
284 _Copy_Construct(&__p->_M_data, __x);
286 _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
290 #if defined(_STLP_DONT_SUP_DFLT_PARAM)
291 _Node_base* _M_create_node() {
292 _Node* __p = this->_M_node.allocate(1);
294 _STLP_STD::_Construct(&__p->_M_data);
296 _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
299 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
302 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
303 explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
304 const allocator_type& __a = allocator_type())
306 explicit list(size_type __n)
307 : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
308 { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
309 list(size_type __n, const_reference __val)
310 : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
311 { this->insert(begin(), __n, __val); }
312 list(size_type __n, const_reference __val, const allocator_type& __a)
313 #endif /*_STLP_DONT_SUP_DFLT_PARAM*/
314 : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
315 { this->insert(begin(), __n, __val); }
317 #if defined (_STLP_MEMBER_TEMPLATES)
318 // We don't need any dispatching tricks here, because insert does all of
320 template <class _InputIterator>
321 list(_InputIterator __first, _InputIterator __last,
322 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
323 : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
324 { _M_insert(begin(), __first, __last); }
326 # if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
327 template <class _InputIterator>
328 list(_InputIterator __first, _InputIterator __last)
329 : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
330 { _M_insert(begin(), __first, __last); }
332 #else /* _STLP_MEMBER_TEMPLATES */
333 list(const value_type* __first, const value_type* __last,
334 const allocator_type& __a = allocator_type())
335 : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
336 { _M_insert(begin(), __first, __last); }
337 list(const_iterator __first, const_iterator __last,
338 const allocator_type& __a = allocator_type())
339 : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
340 { _M_insert(begin(), __first, __last); }
341 #endif /* _STLP_MEMBER_TEMPLATES */
343 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
344 explicit list(const allocator_type& __a = allocator_type())
347 : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
348 list(const allocator_type& __a)
350 : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
352 list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
353 { _M_insert(begin(), __x.begin(), __x.end()); }
355 list(__move_source<_Self> src)
356 : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
360 _Self& operator = (const _Self& __x);
362 iterator begin() { return iterator(this->_M_node._M_data._M_next); }
363 const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); }
365 iterator end() { return iterator(&this->_M_node._M_data); }
366 const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
368 reverse_iterator rbegin() { return reverse_iterator(end()); }
369 const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
371 reverse_iterator rend() { return reverse_iterator(begin()); }
372 const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
374 size_type size() const {
375 size_type __result = distance(begin(), end());
378 size_type max_size() const { return size_type(-1); }
380 reference front() { return *begin(); }
381 const_reference front() const { return *begin(); }
382 reference back() { return *(--end()); }
383 const_reference back() const { return *(--end()); }
386 void _M_swap_aux(_Self& __x) {
387 __x._M_node._M_swap_alloc(this->_M_node);
388 __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
389 __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
390 __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
391 __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
392 this->_M_empty_initialize();
396 void swap(_Self& __x) {
401 this->_M_swap_aux(__x);
402 } else if (this->empty()) {
403 __x._M_swap_aux(*this);
405 this->_M_node.swap(__x._M_node);
406 _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
407 _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
411 #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
412 iterator insert(iterator __pos, const_reference __x = value_type()) {
414 iterator insert(iterator __pos, const_reference __x) {
415 #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
416 _Node_base* __tmp = _M_create_node(__x);
417 _Node_base* __n = __pos._M_node;
418 _Node_base* __p = __n->_M_prev;
419 __tmp->_M_next = __n;
420 __tmp->_M_prev = __p;
421 __p->_M_next = __tmp;
422 __n->_M_prev = __tmp;
423 return iterator(__tmp);
427 #if defined (_STLP_MEMBER_TEMPLATES)
428 template <class _InputIterator>
429 void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
430 typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
431 _M_insert_dispatch(__pos, __first, __last, _Integral());
434 // Check whether it's an integral type. If so, it's not an iterator.
435 template<class _Integer>
436 void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
437 const __true_type& /*_IsIntegral*/) {
438 _M_fill_insert(__pos, __n, __x);
440 template <class _InputIter>
441 void _M_insert_dispatch(iterator __pos,
442 _InputIter __first, _InputIter __last,
443 const __false_type& /*_IsIntegral*/) {
444 #else /* _STLP_MEMBER_TEMPLATES */
445 void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
446 for (; __first != __last; ++__first)
447 insert(__pos, *__first);
449 void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
450 #endif /* _STLP_MEMBER_TEMPLATES */
451 //We use a temporary list to avoid the auto reference troubles (infinite loop)
452 for (; __first != __last; ++__first)
453 insert(__pos, *__first);
457 #if defined (_STLP_MEMBER_TEMPLATES)
458 template <class _InputIterator>
459 void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
460 typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
461 _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
465 // Check whether it's an integral type. If so, it's not an iterator.
466 template<class _Integer>
467 void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
468 const __true_type& /*_IsIntegral*/) {
469 _M_fill_insert(__pos, __n, __x);
471 template <class _InputIter>
472 void _M_splice_insert_dispatch(iterator __pos,
473 _InputIter __first, _InputIter __last,
474 const __false_type& /*_IsIntegral*/) {
475 #else /* _STLP_MEMBER_TEMPLATES */
476 void insert(iterator __pos, const value_type* __first, const value_type* __last) {
477 _Self __tmp(__first, __last, this->get_allocator());
478 splice(__pos, __tmp);
480 void insert(iterator __pos, const_iterator __first, const_iterator __last) {
481 #endif /* _STLP_MEMBER_TEMPLATES */
482 //We use a temporary list to avoid the auto reference troubles (infinite loop)
483 _Self __tmp(__first, __last, this->get_allocator());
484 splice(__pos, __tmp);
488 void insert(iterator __pos, size_type __n, const_reference __x)
489 { _M_fill_insert(__pos, __n, __x); }
492 void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
493 for ( ; __n > 0; --__n)
498 void push_front(const_reference __x) { insert(begin(), __x); }
499 void push_back (const_reference __x) { insert(end(), __x); }
501 #if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
502 iterator insert(iterator __pos)
503 { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
504 void push_front() {insert(begin());}
505 void push_back() {insert(end());}
506 # endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
508 iterator erase(iterator __pos) {
509 _Node_base* __next_node = __pos._M_node->_M_next;
510 _Node_base* __prev_node = __pos._M_node->_M_prev;
511 _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
512 __prev_node->_M_next = __next_node;
513 __next_node->_M_prev = __prev_node;
514 _STLP_STD::_Destroy(&__n->_M_data);
515 this->_M_node.deallocate(__n, 1);
516 return iterator(__next_node);
519 iterator erase(iterator __first, iterator __last) {
520 while (__first != __last)
525 #if !defined (_STLP_DONT_SUP_DFLT_PARAM)
526 void resize(size_type __new_size, const_reference __x = value_type());
528 void resize(size_type __new_size, const_reference __x);
529 void resize(size_type __new_size)
530 { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
531 #endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
533 void pop_front() { erase(begin()); }
535 iterator __tmp = end();
540 // assign(), a generalized assignment member function. Two
541 // versions: one that takes a count, and one that takes a range.
542 // The range version is a member template, so we dispatch on whether
543 // or not the type is an integer.
545 void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); }
547 void _M_fill_assign(size_type __n, const_reference __val);
549 #if defined (_STLP_MEMBER_TEMPLATES)
550 template <class _InputIterator>
551 void assign(_InputIterator __first, _InputIterator __last) {
552 typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
553 _M_assign_dispatch(__first, __last, _Integral());
556 template <class _Integer>
557 void _M_assign_dispatch(_Integer __n, _Integer __val,
558 const __true_type& /*_IsIntegral*/) {
559 _M_fill_assign(__n, __val);
562 template <class _InputIterator>
563 void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
564 const __false_type& /*_IsIntegral*/) {
566 void assign(const value_type *__first2, const value_type *__last2) {
567 iterator __first1 = begin();
568 iterator __last1 = end();
569 for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
570 *__first1 = *__first2;
571 if (__first2 == __last2)
572 erase(__first1, __last1);
574 insert(__last1, __first2, __last2);
576 void assign(const_iterator __first2, const_iterator __last2) {
577 #endif /* _STLP_MEMBER_TEMPLATES */
578 iterator __first1 = begin();
579 iterator __last1 = end();
580 for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
581 *__first1 = *__first2;
582 if (__first2 == __last2)
583 erase(__first1, __last1);
585 insert(__last1, __first2, __last2);
589 void splice(iterator __pos, _Self& __x) {
591 if (this->get_allocator() == __x.get_allocator()) {
592 _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
595 insert(__pos, __x.begin(), __x.end());
600 void splice(iterator __pos, _Self& __x, iterator __i) {
603 if (__pos == __i || __pos == __j) return;
604 if (this->get_allocator() == __x.get_allocator()) {
605 _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
612 void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
613 if (__first != __last) {
614 if (this->get_allocator() == __x.get_allocator()) {
615 _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
618 insert(__pos, __first, __last);
619 __x.erase(__first, __last);
624 void remove(const_reference __val) {
625 iterator __first = begin();
626 iterator __last = end();
627 while (__first != __last) {
628 iterator __next = __first;
630 if (__val == *__first) erase(__first);
636 { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
638 void merge(_Self& __x)
639 { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
642 _Node_base* __p = &this->_M_node._M_data;
643 _Node_base* __tmp = __p;
645 _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
646 __tmp = __tmp->_M_prev; // Old next node is now prev.
647 } while (__tmp != __p);
651 { _STLP_PRIV _S_sort(*this, less<value_type>()); }
653 #if defined (_STLP_MEMBER_TEMPLATES)
654 template <class _Predicate>
655 void remove_if(_Predicate __pred)
656 { _STLP_PRIV _S_remove_if(*this, __pred); }
657 template <class _BinaryPredicate>
658 void unique(_BinaryPredicate __binary_pred)
659 { _STLP_PRIV _S_unique(*this, __binary_pred); }
661 template <class _StrictWeakOrdering>
662 void merge(_Self& __x,
663 _StrictWeakOrdering __comp) {
664 _STLP_PRIV _S_merge(*this, __x, __comp);
667 template <class _StrictWeakOrdering>
668 void sort(_StrictWeakOrdering __comp)
669 { _STLP_PRIV _S_sort(*this, __comp); }
670 #endif /* _STLP_MEMBER_TEMPLATES */
675 _STLP_MOVE_TO_STD_NAMESPACE
680 #if !defined (_STLP_LINK_TIME_INSTANTIATION)
681 # include <stl/_list.c>
684 #if defined (_STLP_USE_PTR_SPECIALIZATIONS)
685 # include <stl/pointers/_list.h>
688 #if defined (_STLP_DEBUG)
689 # include <stl/debug/_list.h>
692 _STLP_BEGIN_NAMESPACE
694 template <class _Tp, class _Alloc>
695 _STLP_INLINE_LOOP bool _STLP_CALL
696 operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
697 typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
698 const_iterator __end1 = __x.end();
699 const_iterator __end2 = __y.end();
701 const_iterator __i1 = __x.begin();
702 const_iterator __i2 = __y.begin();
703 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
707 return __i1 == __end1 && __i2 == __end2;
710 #define _STLP_EQUAL_OPERATOR_SPECIALIZED
711 #define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
712 #define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
713 #include <stl/_relops_cont.h>
714 #undef _STLP_TEMPLATE_CONTAINER
715 #undef _STLP_TEMPLATE_HEADER
716 #undef _STLP_EQUAL_OPERATOR_SPECIALIZED
718 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
719 template <class _Tp, class _Alloc>
720 struct __move_traits<list<_Tp, _Alloc> > {
721 typedef __stlp_movable implemented;
722 typedef typename __move_traits<_Alloc>::complete complete;
724 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
728 #endif /* _STLP_INTERNAL_LIST_IMPL_H */