ReactOS  0.4.15-dev-439-g292f67a
_list.h File Reference
#include <stl/_algobase.h>
#include <stl/_alloc.h>
#include <stl/_iterator.h>
#include <stl/_construct.h>
#include <stl/_function_base.h>
#include <stl/_list.c>
#include <stl/_relops_cont.h>
Include dependency graph for _list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _List_node_base
 
class  _List_global< _Dummy >
 
class  _List_node< _Tp >
 
struct  _List_iterator_base
 
struct  _List_iterator< _Tp, _Traits >
 
class  _List_base< _Tp, _Alloc >
 
struct  list< _Tp, >
 
struct  list< _Tp, >
 

Macros

#define _STLP_EQUAL_OPERATOR_SPECIALIZED
 
#define _STLP_TEMPLATE_HEADER   template <class _Tp, class _Alloc>
 
#define _STLP_TEMPLATE_CONTAINER   list<_Tp, _Alloc>
 

Typedefs

typedef _List_global< bool_List_global_inst
 

Functions

template<class _Tp , class _Alloc , class _Predicate >
_STLP_MOVE_TO_PRIV_NAMESPACE void _S_remove_if (list< _Tp, _Alloc > &__that, _Predicate __pred)
 
template<class _Tp , class _Alloc , class _BinaryPredicate >
void _S_unique (list< _Tp, _Alloc > &__that, _BinaryPredicate __binary_pred)
 
template<class _Tp , class _Alloc , class _StrictWeakOrdering >
void _S_merge (list< _Tp, _Alloc > &__that, list< _Tp, _Alloc > &__x, _StrictWeakOrdering __comp)
 
template<class _Tp , class _Alloc , class _StrictWeakOrdering >
void _S_sort (list< _Tp, _Alloc > &__that, _StrictWeakOrdering __comp)
 
template<class _Tp , class _Alloc >
_STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP bool _STLP_CALL operator== (const list< _Tp, _Alloc > &__x, const list< _Tp, _Alloc > &__y)
 

Macro Definition Documentation

◆ _STLP_EQUAL_OPERATOR_SPECIALIZED

#define _STLP_EQUAL_OPERATOR_SPECIALIZED

Definition at line 720 of file _list.h.

◆ _STLP_TEMPLATE_CONTAINER

#define _STLP_TEMPLATE_CONTAINER   list<_Tp, _Alloc>

Definition at line 722 of file _list.h.

◆ _STLP_TEMPLATE_HEADER

#define _STLP_TEMPLATE_HEADER   template <class _Tp, class _Alloc>

Definition at line 721 of file _list.h.

Typedef Documentation

◆ _List_global_inst

Definition at line 73 of file _list.h.

Function Documentation

◆ _S_merge()

template<class _Tp , class _Alloc , class _StrictWeakOrdering >
void _S_merge ( list< _Tp, _Alloc > &  __that,
list< _Tp, _Alloc > &  __x,
_StrictWeakOrdering  __comp 
)

Definition at line 168 of file _list.c.

169  {
170  typedef typename list<_Tp, _Alloc>::iterator _Literator;
171  _Literator __first1 = __that.begin();
172  _Literator __last1 = __that.end();
173  _Literator __first2 = __x.begin();
174  _Literator __last2 = __x.end();
175  if (__that.get_allocator() == __x.get_allocator()) {
176  while (__first1 != __last1 && __first2 != __last2) {
177  if (__comp(*__first2, *__first1)) {
178  _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
179  _Literator __next = __first2;
180  _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node);
181  __first2 = __next;
182  }
183  else
184  ++__first1;
185  }
186  if (__first2 != __last2)
187  _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node);
188  }
189  else {
190  while (__first1 != __last1 && __first2 != __last2) {
191  if (__comp(*__first2, *__first1)) {
192  _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
193  __first1 = __that.insert(__first1, *__first2);
194  }
195  else
196  ++__first1;
197  }
198  if (__first2 != __last2) {
199  __that.insert(__first1, __first2, __last2);
200  }
201  __x.clear();
202  }
203 }
iterator begin()
Definition: _list.h:367
allocator_type get_allocator() const
Definition: _list.h:161
iterator insert(iterator __pos, const_reference __x=value_type())
Definition: _list.h:420
void clear()
Definition: _list.h:352
_STLP_PRIV _List_iterator< _Tp, _Nonconst_traits< _Tp > > iterator
Definition: _list.h:275
static void _STLP_CALL _Transfer(_Node_base *__pos, _Node_base *__first, _Node_base *__last)
iterator end()
Definition: _list.h:370
#define _STLP_VERBOSE_ASSERT(expr, diagnostic)
Definition: _debug.h:439

Referenced by _S_sort(), and list< BookmarkNode >::merge().

◆ _S_remove_if()

template<class _Tp , class _Alloc , class _Predicate >
_STLP_MOVE_TO_PRIV_NAMESPACE void _S_remove_if ( list< _Tp, _Alloc > &  __that,
_Predicate  __pred 
)

Definition at line 139 of file _list.c.

139  {
140  typedef typename list<_Tp, _Alloc>::iterator _Literator;
141  _Literator __first = __that.begin();
142  _Literator __last = __that.end();
143  while (__first != __last) {
144  _Literator __next = __first;
145  ++__next;
146  if (__pred(*__first)) __that.erase(__first);
147  __first = __next;
148  }
149 }
iterator begin()
Definition: _list.h:367
iterator erase(iterator __pos)
Definition: _list.h:518
_STLP_INLINE_LOOP _InputIter _Predicate __pred
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_PRIV _List_iterator< _Tp, _Nonconst_traits< _Tp > > iterator
Definition: _list.h:275
iterator end()
Definition: _list.h:370

◆ _S_sort()

template<class _Tp , class _Alloc , class _StrictWeakOrdering >
void _S_sort ( list< _Tp, _Alloc > &  __that,
_StrictWeakOrdering  __comp 
)

Definition at line 206 of file _list.c.

206  {
207  // Do nothing if the list has length 0 or 1.
208  if (__that._M_node._M_data._M_next == &__that._M_node._M_data ||
209  __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data)
210  return;
211 
212  list<_Tp, _Alloc> __carry(__that.get_allocator());
213  const int NB = 64;
214  _STLP_PRIV _CArray<list<_Tp, _Alloc>, NB> __counter(__carry);
215  int __fill = 0;
216  while (!__that.empty()) {
217  __carry.splice(__carry.begin(), __that, __that.begin());
218  int __i = 0;
219  while (__i < __fill && !__counter[__i].empty()) {
220  _S_merge(__counter[__i], __carry, __comp);
221  __carry.swap(__counter[__i++]);
222  }
223  __carry.swap(__counter[__i]);
224  if (__i == __fill) {
225  ++__fill;
226  if (__fill >= NB) {
227  //Looks like the list has too many elements to be sorted with this algorithm:
228  __stl_throw_overflow_error("list::sort");
229  }
230  }
231  }
232 
233  for (int __i = 1; __i < __fill; ++__i)
234  _S_merge(__counter[__i], __counter[__i - 1], __comp);
235  __that.swap(__counter[__fill - 1]);
236 }
void _S_merge(list< _Tp, _Alloc > &__that, list< _Tp, _Alloc > &__x, _StrictWeakOrdering __comp)
Definition: _list.c:168
iterator begin()
Definition: _list.h:367
allocator_type get_allocator() const
Definition: _list.h:161
void swap(_Self &__x)
Definition: _list.h:401
#define _STLP_PRIV
Definition: _dm.h:70
Definition: _list.h:228
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_overflow_error(const char *__msg)
Definition: _range_errors.c:78
BOOL empty
Definition: button.c:170
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val, const input_iterator_tag &, _Distance *)
Definition: _algobase.h:417
bool empty() const
Definition: _list.h:177

Referenced by list< BookmarkNode >::sort().

◆ _S_unique()

template<class _Tp , class _Alloc , class _BinaryPredicate >
void _S_unique ( list< _Tp, _Alloc > &  __that,
_BinaryPredicate  __binary_pred 
)

Definition at line 152 of file _list.c.

152  {
153  typedef typename list<_Tp, _Alloc>::iterator _Literator;
154  _Literator __first = __that.begin();
155  _Literator __last = __that.end();
156  if (__first == __last) return;
157  _Literator __next = __first;
158  while (++__next != __last) {
159  if (__binary_pred(*__first, *__next))
160  __that.erase(__next);
161  else
162  __first = __next;
163  __next = __first;
164  }
165 }
iterator begin()
Definition: _list.h:367
iterator erase(iterator __pos)
Definition: _list.h:518
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_PRIV _List_iterator< _Tp, _Nonconst_traits< _Tp > > iterator
Definition: _list.h:275
iterator end()
Definition: _list.h:370

Referenced by list< BookmarkNode >::unique().

◆ operator==()

template<class _Tp , class _Alloc >
_STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP bool _STLP_CALL operator== ( const list< _Tp, _Alloc > &  __x,
const list< _Tp, _Alloc > &  __y 
)

Definition at line 706 of file _list.h.

706  {
707  typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
708  const_iterator __end1 = __x.end();
709  const_iterator __end2 = __y.end();
710 
711  const_iterator __i1 = __x.begin();
712  const_iterator __i2 = __y.begin();
713  while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
714  ++__i1;
715  ++__i2;
716  }
717  return __i1 == __end1 && __i2 == __end2;
718 }
iterator begin()
Definition: _list.h:367
_STLP_PRIV _List_iterator< _Tp, _Const_traits< _Tp > > const_iterator
Definition: _list.h:276
iterator end()
Definition: _list.h:370