Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
3 * Copyright (c) 1996,1997
4 * Silicon Graphics Computer Systems, Inc.
7 * Moscow Center for SPARC Technology
12 * This material is provided "as is", with absolutely no warranty expressed
13 * or implied. Any use is at your own risk.
15 * Permission to use or copy this software for any purpose is hereby granted
16 * without fee, provided the above notices are retained on all copies.
17 * Permission to modify the code and to distribute modified code is granted,
18 * provided the above notices are retained, and a notice that the code was
19 * modified is included with the above copyright notice.
23 /* NOTE: This is an internal header file, included by other STL headers.
24 * You should not attempt to use it directly.
27 #ifndef _STLP_INTERNAL_SLIST_H
28 #define _STLP_INTERNAL_SLIST_H
31 # ifndef _STLP_INTERNAL_ALGOBASE_H
32 # include <stl/_algobase.h>
35 # ifndef _STLP_INTERNAL_ALLOC_H
36 # include <stl/_alloc.h>
39 # ifndef _STLP_INTERNAL_ITERATOR_H
40 # include <stl/_iterator.h>
43 # ifndef _STLP_INTERNAL_CONSTRUCT_H
44 # include <stl/_construct.h>
47 # ifndef _STLP_INTERNAL_SLIST_BASE_H
48 # include <stl/_slist_base.h>
52 # define slist __WORKAROUND_DBG_RENAME(slist)
57 struct _Slist_node : public _Slist_node_base
60 __TRIVIAL_STUFF(_Slist_node)
63 struct _Slist_iterator_base {
65 typedef size_t size_type;
66 typedef ptrdiff_t difference_type;
67 typedef forward_iterator_tag iterator_category;
69 _Slist_node_base* _M_node;
71 _Slist_iterator_base(_Slist_node_base* __x) : _M_node(__x) {}
74 // _STLP_VERBOSE_ASSERT(_M_node != 0, _StlMsg_INVALID_ADVANCE)
75 _M_node = _M_node->_M_next;
77 bool operator==(const _Slist_iterator_base& __y ) const {
78 return _M_node == __y._M_node;
80 bool operator!=(const _Slist_iterator_base& __y ) const {
81 return _M_node != __y._M_node;
85 # ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
86 inline ptrdiff_t* _STLP_CALL distance_type(const _Slist_iterator_base&) { return 0; }
87 inline forward_iterator_tag _STLP_CALL iterator_category(const _Slist_iterator_base&) { return forward_iterator_tag(); }
90 template <class _Tp, class _Traits>
91 struct _Slist_iterator : public _Slist_iterator_base
93 typedef _Tp value_type;
94 typedef typename _Traits::pointer pointer;
95 typedef typename _Traits::reference reference;
96 typedef forward_iterator_tag iterator_category;
97 typedef size_t size_type;
98 typedef ptrdiff_t difference_type;
100 typedef _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
101 typedef _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
102 typedef _Slist_iterator<_Tp, _Traits> _Self;
104 typedef _Slist_node<value_type> _Node;
106 _Slist_iterator(_Node* __x) : _Slist_iterator_base(__x) {}
107 _Slist_iterator() : _Slist_iterator_base(0) {}
108 _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
110 reference operator*() const { return ((_Node*) _M_node)->_M_data; }
112 _STLP_DEFINE_ARROW_OPERATOR
119 _Self operator++(int)
127 #ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
128 template <class _Tp, class _Traits>
129 inline _Tp* _STLP_CALL value_type(const _Slist_iterator<_Tp, _Traits>&) { return (_Tp*)0; }
130 #endif /* OLD_QUERIES */
132 // Base class that encapsulates details of allocators and simplifies EH
134 template <class _Tp, class _Alloc>
137 _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
138 typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
139 typedef _Slist_node<_Tp> _Node;
141 _Slist_base(const allocator_type& __a) :
142 _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() ) {
143 _M_head._M_data._M_next = 0;
145 ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); }
148 typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type;
150 _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
152 _Node* __next = (_Node*) (__pos->_M_next);
153 _Slist_node_base* __next_next = __next->_M_next;
154 __pos->_M_next = __next_next;
155 _STLP_STD::_Destroy(&__next->_M_data);
156 _M_head.deallocate(__next,1);
159 _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
162 allocator_type get_allocator() const {
163 return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp);
165 _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _M_head;
168 template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
169 class slist : public _Slist_base<_Tp,_Alloc>
172 typedef _Slist_base<_Tp,_Alloc> _Base;
173 typedef slist<_Tp,_Alloc> _Self;
175 typedef _Tp value_type;
176 typedef value_type* pointer;
177 typedef const value_type* const_pointer;
178 typedef value_type& reference;
179 typedef const value_type& const_reference;
180 typedef size_t size_type;
181 typedef ptrdiff_t difference_type;
182 typedef forward_iterator_tag _Iterator_category;
184 typedef _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
185 typedef _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
187 _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
188 typedef typename _Base::allocator_type allocator_type;
192 typedef _Slist_node<_Tp> _Node;
193 typedef _Slist_node_base _Node_base;
194 typedef _Slist_iterator_base _Iterator_base;
196 _Node* _M_create_node(const value_type& __x) {
197 _Node* __node = this->_M_head.allocate(1);
199 _Construct(&__node->_M_data, __x);
202 _STLP_UNWIND(this->_M_head.deallocate(__node, 1));
206 _Node* _M_create_node() {
207 _Node* __node = this->_M_head.allocate(1);
209 _Construct(&__node->_M_data);
212 _STLP_UNWIND(this->_M_head.deallocate(__node, 1));
217 allocator_type get_allocator() const { return _Base::get_allocator(); }
219 explicit slist(const allocator_type& __a = allocator_type()) : _Slist_base<_Tp,_Alloc>(__a) {
223 slist(size_type __n, const value_type& __x,
224 const allocator_type& __a = allocator_type()) : _Slist_base<_Tp,_Alloc>(__a)
226 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
227 _M_insert_after_fill(&this->_M_head._M_data, __n, __x);
228 _STLP_POP_CLEANUP_ITEM
231 explicit slist(size_type __n) : _Slist_base<_Tp,_Alloc>(allocator_type())
233 # ifdef _STLP_USE_TRAP_LEAVE
234 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
236 _STLP_PUSH_CLEANUP_ITEM(_Tp, &__p)
237 _M_insert_after_fill(&this->_M_head._M_data, __n, __p);
238 // unconditional for __p
240 _STLP_POP_CLEANUP_ITEM
242 _M_insert_after_fill(&this->_M_head._M_data, __n, value_type());
246 #ifdef _STLP_MEMBER_TEMPLATES
247 // We don't need any dispatching tricks here, because _M_insert_after_range
248 // already does them.
249 template <class _InputIterator>
250 slist(_InputIterator __first, _InputIterator __last,
251 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) :
252 _Slist_base<_Tp,_Alloc>(__a)
254 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
255 _M_insert_after_range(&this->_M_head._M_data, __first, __last);
256 _STLP_POP_CLEANUP_ITEM
258 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
259 // VC++ needs this crazyness
260 template <class _InputIterator>
261 slist(_InputIterator __first, _InputIterator __last) :
262 _Slist_base<_Tp,_Alloc>(allocator_type())
264 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
265 _M_insert_after_range(&this->_M_head._M_data, __first, __last);
266 _STLP_POP_CLEANUP_ITEM
269 #else /* _STLP_MEMBER_TEMPLATES */
270 slist(const_iterator __first, const_iterator __last,
271 const allocator_type& __a = allocator_type() ) :
272 _Slist_base<_Tp,_Alloc>(__a)
274 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
275 _M_insert_after_range(&this->_M_head._M_data, __first, __last);
276 _STLP_POP_CLEANUP_ITEM
278 slist(const value_type* __first, const value_type* __last,
279 const allocator_type& __a = allocator_type()) :
280 _Slist_base<_Tp,_Alloc>(__a)
282 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
283 _M_insert_after_range(&this->_M_head._M_data, __first, __last);
284 _STLP_POP_CLEANUP_ITEM
286 #endif /* _STLP_MEMBER_TEMPLATES */
288 slist(const _Self& __x) : _Slist_base<_Tp,_Alloc>(__x.get_allocator())
290 _STLP_PUSH_CLEANUP_ITEM(_Base, this)
291 _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end());
292 _STLP_POP_CLEANUP_ITEM
295 _Self& operator= (const _Self& __x);
299 #ifdef _STLP_USE_TRAP_LEAVE
301 static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
302 static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
306 // assign(), a generalized assignment member function. Two
307 // versions: one that takes a count, and one that takes a range.
308 // The range version is a member template, so we dispatch on whether
309 // or not the type is an integer.
311 void assign(size_type __n, const _Tp& __val)
312 { _M_fill_assign(__n, __val); }
314 void _M_fill_assign(size_type __n, const _Tp& __val);
316 #ifdef _STLP_MEMBER_TEMPLATES
318 template <class _InputIterator>
319 void assign(_InputIterator __first, _InputIterator __last) {
320 typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
321 _M_assign_dispatch(__first, __last, _Integral());
324 template <class _Integer>
325 void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
326 { _M_fill_assign((size_type) __n, (_Tp) __val); }
328 template <class _InputIter>
330 _M_assign_dispatch(_InputIter __first, _InputIter __last,
331 const __false_type&) {
332 _Node_base* __prev = &this->_M_head._M_data;
333 _Node* __node = (_Node*) this->_M_head._M_data._M_next;
334 while (__node != 0 && __first != __last) {
335 __node->_M_data = *__first;
337 __node = (_Node*) __node->_M_next;
340 if (__first != __last)
341 _M_insert_after_range(__prev, __first, __last);
343 this->_M_erase_after(__prev, 0);
345 #endif /* _STLP_MEMBER_TEMPLATES */
349 // Experimental new feature: before_begin() returns a
350 // non-dereferenceable iterator that, when incremented, yields
351 // begin(). This iterator may be used as the argument to
352 // insert_after, erase_after, etc. Note that even for an empty
353 // slist, before_begin() is not the same iterator as end(). It
354 // is always necessary to increment before_begin() at least once to
356 iterator before_begin() { return iterator((_Node*) &this->_M_head._M_data); }
357 const_iterator before_begin() const
358 { return const_iterator((_Node*) &this->_M_head._M_data); }
360 iterator begin() { return iterator((_Node*)this->_M_head._M_data._M_next); }
361 const_iterator begin() const
362 { return const_iterator((_Node*)this->_M_head._M_data._M_next);}
364 iterator end() { return iterator(0); }
365 const_iterator end() const { return const_iterator(0); }
367 size_type size() const { return _Sl_global_inst::size(this->_M_head._M_data._M_next); }
369 size_type max_size() const { return size_type(-1); }
371 bool empty() const { return this->_M_head._M_data._M_next == 0; }
373 void swap(_Self& __x) {
374 _STLP_STD::swap(this->_M_head, __x._M_head);
378 reference front() { return ((_Node*) this->_M_head._M_data._M_next)->_M_data; }
379 const_reference front() const
380 { return ((_Node*) this->_M_head._M_data._M_next)->_M_data; }
381 void push_front(const value_type& __x) {
382 __slist_make_link(&this->_M_head._M_data, _M_create_node(__x));
385 # ifndef _STLP_NO_ANACHRONISMS
386 void push_front() { __slist_make_link(&this->_M_head._M_data, _M_create_node());}
390 _Node* __node = (_Node*) this->_M_head._M_data._M_next;
391 this->_M_head._M_data._M_next = __node->_M_next;
392 _STLP_STD::_Destroy(&__node->_M_data);
393 this->_M_head.deallocate(__node, 1);
396 iterator previous(const_iterator __pos) {
397 return iterator((_Node*) _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
399 const_iterator previous(const_iterator __pos) const {
400 return const_iterator((_Node*) _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
404 _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
405 return (_Node*) (__slist_make_link(__pos, _M_create_node(__x)));
408 _Node* _M_insert_after(_Node_base* __pos) {
409 return (_Node*) (__slist_make_link(__pos, _M_create_node()));
412 void _M_insert_after_fill(_Node_base* __pos,
413 size_type __n, const value_type& __x) {
414 for (size_type __i = 0; __i < __n; ++__i)
415 __pos = __slist_make_link(__pos, _M_create_node(__x));
418 #ifdef _STLP_MEMBER_TEMPLATES
420 // Check whether it's an integral type. If so, it's not an iterator.
421 template <class _InIter>
422 void _M_insert_after_range(_Node_base* __pos,
423 _InIter __first, _InIter __last) {
424 typedef typename _Is_integer<_InIter>::_Integral _Integral;
425 _M_insert_after_range(__pos, __first, __last, _Integral());
428 template <class _Integer>
429 void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
430 const __true_type&) {
431 _M_insert_after_fill(__pos, __n, __x);
434 template <class _InIter>
435 void _M_insert_after_range(_Node_base* __pos,
436 _InIter __first, _InIter __last,
437 const __false_type&) {
438 while (__first != __last) {
439 __pos = __slist_make_link(__pos, _M_create_node(*__first));
444 #else /* _STLP_MEMBER_TEMPLATES */
446 void _M_insert_after_range(_Node_base* __pos,
447 const_iterator __first, const_iterator __last) {
448 while (__first != __last) {
449 __pos = __slist_make_link(__pos, _M_create_node(*__first));
453 void _M_insert_after_range(_Node_base* __pos,
454 const value_type* __first,
455 const value_type* __last) {
456 while (__first != __last) {
457 __pos = __slist_make_link(__pos, _M_create_node(*__first));
462 #endif /* _STLP_MEMBER_TEMPLATES */
466 iterator insert_after(iterator __pos, const value_type& __x) {
467 return iterator(_M_insert_after(__pos._M_node, __x));
470 iterator insert_after(iterator __pos) {
471 return insert_after(__pos, value_type());
474 void insert_after(iterator __pos, size_type __n, const value_type& __x) {
475 _M_insert_after_fill(__pos._M_node, __n, __x);
478 #ifdef _STLP_MEMBER_TEMPLATES
480 // We don't need any dispatching tricks here, because _M_insert_after_range
481 // already does them.
482 template <class _InIter>
483 void insert_after(iterator __pos, _InIter __first, _InIter __last) {
484 _M_insert_after_range(__pos._M_node, __first, __last);
487 #else /* _STLP_MEMBER_TEMPLATES */
489 void insert_after(iterator __pos,
490 const_iterator __first, const_iterator __last) {
491 _M_insert_after_range(__pos._M_node, __first, __last);
493 void insert_after(iterator __pos,
494 const value_type* __first, const value_type* __last) {
495 _M_insert_after_range(__pos._M_node, __first, __last);
498 #endif /* _STLP_MEMBER_TEMPLATES */
500 iterator insert(iterator __pos, const value_type& __x) {
501 return iterator(_M_insert_after(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
505 iterator insert(iterator __pos) {
506 return iterator(_M_insert_after(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
510 void insert(iterator __pos, size_type __n, const value_type& __x) {
511 _M_insert_after_fill(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x);
514 #ifdef _STLP_MEMBER_TEMPLATES
516 // We don't need any dispatching tricks here, because _M_insert_after_range
517 // already does them.
518 template <class _InIter>
519 void insert(iterator __pos, _InIter __first, _InIter __last) {
520 _M_insert_after_range(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
524 #else /* _STLP_MEMBER_TEMPLATES */
526 void insert(iterator __pos, const_iterator __first, const_iterator __last) {
527 _M_insert_after_range(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
530 void insert(iterator __pos, const value_type* __first,
531 const value_type* __last) {
532 _M_insert_after_range(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
536 #endif /* _STLP_MEMBER_TEMPLATES */
540 iterator erase_after(iterator __pos) {
541 return iterator((_Node*) this->_M_erase_after(__pos._M_node));
543 iterator erase_after(iterator __before_first, iterator __last) {
544 return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
548 iterator erase(iterator __pos) {
549 return iterator((_Node*) this->_M_erase_after(_Sl_global_inst::__previous(&this->_M_head._M_data,
552 iterator erase(iterator __first, iterator __last) {
553 return iterator((_Node*) this->_M_erase_after(
554 _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node));
557 void resize(size_type new_size, const _Tp& __x);
558 void resize(size_type new_size) { resize(new_size, _Tp()); }
560 this->_M_erase_after(&this->_M_head._M_data, 0);
564 // Moves the range [__before_first + 1, __before_last + 1) to *this,
565 // inserting it immediately after __pos. This is constant time.
566 void splice_after(iterator __pos,
567 iterator __before_first, iterator __before_last)
569 if (__before_first != __before_last) {
570 _Sl_global_inst::__splice_after(__pos._M_node, __before_first._M_node,
571 __before_last._M_node);
575 // Moves the element that follows __prev to *this, inserting it immediately
576 // after __pos. This is constant time.
577 void splice_after(iterator __pos, iterator __prev)
579 _Sl_global_inst::__splice_after(__pos._M_node,
580 __prev._M_node, __prev._M_node->_M_next);
583 // Removes all of the elements from the list __x to *this, inserting
584 // them immediately after __pos. __x must not be *this. Complexity:
585 // linear in __x.size().
586 void splice_after(iterator __pos, _Self& __x)
588 _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data);
591 // Linear in distance(begin(), __pos), and linear in __x.size().
592 void splice(iterator __pos, _Self& __x) {
593 if (__x._M_head._M_data._M_next)
594 _Sl_global_inst::__splice_after(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
595 &__x._M_head._M_data, _Sl_global_inst::__previous(&__x._M_head._M_data, 0));
598 // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
599 void splice(iterator __pos, _Self& __x, iterator __i) {
600 _Sl_global_inst::__splice_after(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
601 _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node),
605 // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
606 // and in distance(__first, __last).
607 void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
609 if (__first != __last)
610 _Sl_global_inst::__splice_after(_Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
611 _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node),
612 _Sl_global_inst::__previous(__first._M_node, __last._M_node));
617 if (this->_M_head._M_data._M_next)
618 this->_M_head._M_data._M_next = _Sl_global_inst::__reverse(this->_M_head._M_data._M_next);
621 void remove(const _Tp& __val);
623 void merge(_Self& __x);
626 #ifdef _STLP_MEMBER_TEMPLATES
627 template <class _Predicate>
628 void remove_if(_Predicate __pred) {
629 _Node_base* __cur = &this->_M_head._M_data;
630 while (__cur->_M_next) {
631 if (__pred(((_Node*) __cur->_M_next)->_M_data))
632 this->_M_erase_after(__cur);
634 __cur = __cur->_M_next;
638 template <class _BinaryPredicate>
639 void unique(_BinaryPredicate __pred) {
640 _Node* __cur = (_Node*) this->_M_head._M_data._M_next;
642 while (__cur->_M_next) {
643 if (__pred(((_Node*)__cur)->_M_data,
644 ((_Node*)(__cur->_M_next))->_M_data))
645 this->_M_erase_after(__cur);
647 __cur = (_Node*) __cur->_M_next;
652 template <class _StrictWeakOrdering>
653 void merge(slist<_Tp,_Alloc>& __x,
654 _StrictWeakOrdering __comp) {
655 _Node_base* __n1 = &this->_M_head._M_data;
656 while (__n1->_M_next && __x._M_head._M_data._M_next) {
657 if (__comp(((_Node*) __x._M_head._M_data._M_next)->_M_data,
658 ((_Node*) __n1->_M_next)->_M_data))
659 _Sl_global_inst::__splice_after(__n1, &__x._M_head._M_data, __x._M_head._M_data._M_next);
660 __n1 = __n1->_M_next;
662 if (__x._M_head._M_data._M_next) {
663 __n1->_M_next = __x._M_head._M_data._M_next;
664 __x._M_head._M_data._M_next = 0;
668 template <class _StrictWeakOrdering>
669 void sort(_StrictWeakOrdering __comp) {
670 if (this->_M_head._M_data._M_next && this->_M_head._M_data._M_next->_M_next) {
675 _Sl_global_inst::__splice_after(&__carry._M_head._M_data, &this->_M_head._M_data, this->_M_head._M_data._M_next);
677 while (__i < __fill && !__counter[__i].empty()) {
678 __counter[__i].merge(__carry, __comp);
679 __carry.swap(__counter[__i]);
682 __carry.swap(__counter[__i]);
687 for (int __i = 1; __i < __fill; ++__i)
688 __counter[__i].merge(__counter[__i-1], __comp);
689 this->swap(__counter[__fill-1]);
692 #endif /* _STLP_MEMBER_TEMPLATES */
696 template <class _Tp, class _Alloc>
697 inline bool _STLP_CALL
698 operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2)
700 typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
701 const_iterator __end1 = _SL1.end();
702 const_iterator __end2 = _SL2.end();
704 const_iterator __i1 = _SL1.begin();
705 const_iterator __i2 = _SL2.begin();
706 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
710 return __i1 == __end1 && __i2 == __end2;
713 # define _STLP_EQUAL_OPERATOR_SPECIALIZED
714 # define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
715 # define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc>
716 # include <stl/_relops_cont.h>
717 # undef _STLP_TEMPLATE_CONTAINER
718 # undef _STLP_TEMPLATE_HEADER
719 # undef _STLP_EQUAL_OPERATOR_SPECIALIZED
723 # if !defined (_STLP_LINK_TIME_INSTANTIATION)
724 # include <stl/_slist.c>
728 # define __slist__ __FULL_NAME(slist)
730 #if defined (_STLP_DEBUG) && !defined (_STLP_INTERNAL_DBG_SLIST_H)
731 # include <stl/debug/_slist.h>
734 _STLP_BEGIN_NAMESPACE
735 // Specialization of insert_iterator so that insertions will be constant
736 // time rather than linear time.
738 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
740 template <class _Tp, class _Alloc>
741 class insert_iterator<slist<_Tp, _Alloc> > {
743 typedef slist<_Tp, _Alloc> _Container;
744 _Container* container;
745 typename _Container::iterator iter;
747 typedef _Container container_type;
748 typedef output_iterator_tag iterator_category;
749 typedef void value_type;
750 typedef void difference_type;
751 typedef void pointer;
752 typedef void reference;
754 insert_iterator(_Container& __x, typename _Container::iterator __i)
756 if (__i == __x.begin())
757 iter = __x.before_begin();
759 iter = __x.previous(__i);
762 insert_iterator<_Container>&
763 operator=(const typename _Container::value_type& __val) {
764 iter = container->insert_after(iter, __val);
767 insert_iterator<_Container>& operator*() { return *this; }
768 insert_iterator<_Container>& operator++() { return *this; }
769 insert_iterator<_Container>& operator++(int) { return *this; }
772 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
777 # if defined ( _STLP_USE_WRAPPER_FOR_ALLOC_PARAM )
778 # include <stl/wrappers/_slist.h>
781 #endif /* _STLP_INTERNAL_SLIST_H */