AGX Dynamics  2.37.3.2
List.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_LIST_H
18 #define AGX_LIST_H
19 
20 #define AGX_USE_AGX_LIST_IMPL 1
21 
22 #if AGX_USE_AGX_LIST_IMPL
23 
24 #include <agx/Math.h>
25 #include <iterator>
26 
27 #ifdef __linux__
28 #include <cstddef>
29 #endif
30 
31 namespace agx
32 {
33 #define AGX_LIST_ITERATOR_TYPEDEFS \
34  typedef std::bidirectional_iterator_tag iterator_category; \
35  typedef T& reference; \
36  typedef const T& const_reference; \
37  typedef T* pointer; \
38  typedef const T* const_pointer; \
39  typedef T value_type; \
40  typedef ptrdiff_t difference_type
41 
42  template < typename T >
43  class LNode
44  {
45  public:
46  LNode() : m_element( T() ), m_next( nullptr ), m_prev( nullptr ) {}
47  LNode( T element ) : m_element( element ), m_next( nullptr ), m_prev( nullptr ) {}
51  };
52 
53  class ItOp
54  {
55  public:
57 
58  public:
59  struct PPOp
60  {
61  template< typename T >
62  T& operator()( T& val ) const
63  {
64  return ++val;
65  }
66  };
67 
68  struct MMOp
69  {
70  template< typename T >
71  T& operator()( T& val ) const
72  {
73  return --val;
74  }
75  };
76 
77  public:
78  explicit ItOp( value_type num )
79  : m_num( num ) {}
80 
81  template< typename ItT, typename Op >
82  ItT operator()( const ItT& org, Op op ) const
83  {
84  ItT ret = org;
85  for ( value_type i = value_type( 0 ); i < m_num; ++i )
86  op( ret );
87  return ret;
88  }
89 
90  private:
91  value_type m_num;
92  };
93 
94  template< typename ItT >
95  ItT operator + ( const ItT& it, const agx::ItOp& inc )
96  {
97  return inc( it, agx::ItOp::PPOp() );
98  }
99 
100  template< typename ItT >
101  ItT operator - ( const ItT& it, const agx::ItOp& inc )
102  {
103  return inc( it, agx::ItOp::MMOp() );
104  }
105 
106  template < typename T >
107  class List
108  {
109  public:
111  typedef T value_type;
112  typedef T& reference;
113  typedef const T& const_reference;
114  typedef T* pointer;
115  typedef const T* const_pointer;
116  typedef size_t size_type;
120 
121  public:
123  {
124  public:
126 
127  public:
128  friend class List;
129 
130  inline const_iterator() : m_ptr( nullptr ) {}
131  inline explicit const_iterator( node_ptr_type ptr ) : m_ptr( ptr ) {}
132  inline const_iterator( const const_iterator& rhs )
133  {
134  *this = rhs;
135  }
137  {
138  m_ptr = rhs.m_ptr;
139  return *this;
140  }
142  {
143  m_ptr = m_ptr->m_next;
144  return *this;
145  }
147  {
148  const_iterator tmp = *this;
149  ++(*this);
150  return tmp;
151  }
152  inline const_iterator operator+( const agx::ItOp& inc ) const
153  {
154  return inc( *this, ItOp::PPOp() );
155  }
157  {
158  m_ptr = m_ptr->m_prev;
159  return *this;
160  }
162  {
163  const_iterator tmp = *this;
164  --(*this);
165  return tmp;
166  }
167  inline const_iterator operator-( const agx::ItOp& inc ) const
168  {
169  return inc( *this, ItOp::MMOp() );
170  }
171  inline const_reference operator*() const
172  {
173  return m_ptr->m_element;
174  }
175  inline const_pointer operator->() const
176  {
177  return &(m_ptr->m_element);
178  }
179  inline bool operator==(const const_iterator& i) const
180  {
181  return m_ptr == i.m_ptr;
182  }
183  inline bool operator!=(const const_iterator& i) const
184  {
185  return m_ptr != i.m_ptr;
186  }
187  private:
188  node_ptr_type m_ptr;
189  };
190 
191  class iterator
192  {
193  public:
195 
196  public:
197  friend class List;
198 
199  inline iterator() : m_ptr( nullptr ) {}
200  inline explicit iterator( node_ptr_type ptr ) : m_ptr( ptr ) {}
201  inline iterator( const iterator& rhs )
202  {
203  *this = rhs;
204  }
205  inline iterator& operator=( const iterator& rhs )
206  {
207  m_ptr = rhs.m_ptr;
208  return *this;
209  }
211  {
212  m_ptr = m_ptr->m_next;
213  return *this;
214  }
215  inline iterator operator++(int)
216  {
217  iterator tmp = *this;
218  ++(*this);
219  return tmp;
220  }
221  inline iterator operator+( const agx::ItOp& inc ) const
222  {
223  return inc( *this, ItOp::PPOp() );
224  }
226  {
227  m_ptr = m_ptr->m_prev;
228  return *this;
229  }
230  inline iterator operator--(int)
231  {
232  iterator tmp = *this;
233  --(*this);
234  return tmp;
235  }
236  inline iterator operator-( const agx::ItOp& inc ) const
237  {
238  return inc( *this, ItOp::MMOp() );
239  }
240  inline reference operator*() const
241  {
242  return m_ptr->m_element;
243  }
244  inline pointer operator->() const
245  {
246  return &(m_ptr->m_element);
247  }
248  inline bool operator==(const iterator& i) const
249  {
250  return m_ptr == i.m_ptr;
251  }
252  inline bool operator==(const const_iterator& i) const
253  {
254  return m_ptr == i.m_ptr;
255  }
256  inline bool operator!=(const iterator& i) const
257  {
258  return m_ptr != i.m_ptr;
259  }
260  inline bool operator!=(const const_iterator& i) const
261  {
262  return m_ptr != i.m_ptr;
263  }
264  inline operator const_iterator() const
265  {
266  return const_iterator(m_ptr);
267  }
268  private:
269  node_ptr_type m_ptr;
270  };
271 
273  {
274  public:
276 
277  public:
278  friend class List;
279 
280  inline const_reverse_iterator() : m_ptr( nullptr ) {}
281  inline explicit const_reverse_iterator( node_ptr_type ptr ) : m_ptr( ptr ) {}
283  {
284  *this = rhs;
285  }
286  inline const_reverse_iterator( const iterator& rhs )
287  {
288  *this = rhs;
289  }
291  {
292  *this = rhs;
293  }
295  {
296  m_ptr = rhs.m_ptr;
297  return *this;
298  }
300  {
301  m_ptr = rhs.m_ptr;
302  return *this;
303  }
305  {
306  m_ptr = rhs.m_ptr;
307  return *this;
308  }
310  {
311  m_ptr = m_ptr->m_prev;
312  return *this;
313  }
315  {
316  const_reverse_iterator tmp = *this;
317  ++(*this);
318  return tmp;
319  }
320  inline const_reverse_iterator operator+( const agx::ItOp& inc ) const
321  {
322  return inc( *this, ItOp::PPOp() );
323  }
325  {
326  m_ptr = m_ptr->m_next;
327  return *this;
328  }
330  {
331  const_iterator tmp = *this;
332  --(*this);
333  return tmp;
334  }
335  inline const_reverse_iterator operator-( const agx::ItOp& inc ) const
336  {
337  return inc( *this, ItOp::MMOp() );
338  }
339  inline const_reference operator*() const
340  {
341  return m_ptr->m_prev->m_element;
342  }
343  inline const_pointer operator->() const
344  {
345  return &(m_ptr->m_prev->m_element);
346  }
347  inline bool operator==(const const_reverse_iterator& i) const
348  {
349  return m_ptr == i.m_ptr;
350  }
351  inline bool operator!=(const const_reverse_iterator& i) const
352  {
353  return m_ptr != i.m_ptr;
354  }
355  private:
356  node_ptr_type m_ptr;
357  };
358 
360  {
361  public:
363 
364  public:
365  friend class List;
366 
367  inline reverse_iterator() : m_ptr( nullptr ) {}
368  inline explicit reverse_iterator( node_ptr_type ptr ) : m_ptr( ptr ) {}
369  inline reverse_iterator( const reverse_iterator& rhs )
370  {
371  *this = rhs;
372  }
373  inline reverse_iterator( const iterator& rhs )
374  {
375  *this = rhs;
376  }
377  inline reverse_iterator& operator=( const iterator& rhs ) {
378  m_ptr = rhs.m_ptr;
379  return *this;
380  }
382  m_ptr = rhs.m_ptr;
383  return *this;
384  }
386  {
387  m_ptr = m_ptr->m_prev;
388  return *this;
389  }
391  {
392  reverse_iterator tmp = *this;
393  ++(*this);
394  return tmp;
395  }
396  inline reverse_iterator operator+( const agx::ItOp& inc ) const
397  {
398  return inc( *this, ItOp::PPOp() );
399  }
401  {
402  m_ptr = m_ptr->m_next;
403  return *this;
404  }
406  {
407  reverse_iterator tmp = *this;
408  --(*this);
409  return tmp;
410  }
411  inline reverse_iterator operator-( const agx::ItOp& inc ) const
412  {
413  return inc( *this, ItOp::MMOp() );
414  }
415  inline reference operator*() const
416  {
417  return m_ptr->m_prev->m_element;
418  }
419  inline pointer operator->() const
420  {
421  return &(m_ptr->m_prev->m_element);
422  }
423  inline bool operator==(const reverse_iterator& i) const
424  {
425  return m_ptr == i.m_ptr;
426  }
427  inline bool operator!=(const reverse_iterator& i) const
428  {
429  return m_ptr != i.m_ptr;
430  }
431  inline operator const_reverse_iterator()
432  {
433  return const_reverse_iterator(m_ptr);
434  }
435  private:
436  node_ptr_type m_ptr;
437  };
438 
440  {
441  public:
442  EqualPred1( const_reference obj ) : m_obj( obj ) {}
443  bool operator()( const_reference obj ) const { return m_obj == obj; }
444  private:
445  value_type m_obj;
446  // Not defined.
447  private:
448  EqualPred1();
449  };
450 
452  {
453  public:
454  bool operator()( const_reference left, const_reference right ) const { return left == right; }
455  };
456 
457  class LessPred1
458  {
459  public:
460  LessPred1( const_reference obj ) : m_obj( obj ) {}
461  bool operator()( const_reference obj ) const { return m_obj == obj; }
462  private:
463  value_type m_obj;
464  // Not defined.
465  private:
466  LessPred1();
467  };
468 
469  class LessPred2
470  {
471  public:
472  bool operator()( const_reference left, const_reference right ) const { return left < right; }
473  };
474 
475  public:
480  : m_size( 0 ), m_end( allocate() ), m_front( m_end )
481  {
482  }
483 
487  List( const List& other )
488  : m_size( 0 ), m_end( allocate() ), m_front( m_end )
489  {
490  *this = other;
491  }
492 
497  {
498  clear();
499  if ( m_front == m_end && m_front != nullptr )
500  deallocate( m_front );
501  }
502 
509  List& operator=( const my_type& other )
510  {
511  if ( this == &other )
512  return *this;
513 
514  clear();
515  insert( end(), other.begin(), other.end() );
516  return *this;
517  }
518 
524  bool operator==( const my_type& other ) const
525  {
526  if ( size() != other.size() )
527  return false;
528 
529  for ( const_iterator myIt = begin(), otherIt = other.begin(), endIt = end(); myIt != endIt; ++myIt, ++otherIt )
530  if ( *myIt != *otherIt )
531  return false;
532 
533  return true;
534  }
535 
541  const_iterator find( const_reference _val ) const
542  {
543  iterator i(m_front);
544  iterator iend(m_end);
545  for ( ; i != iend; ++i ) {
546  if ( *i == _val ) return i;
547  }
548  return end();
549  }
550 
556  iterator find( const_reference _val )
557  {
558  iterator i(m_front);
559  iterator iend(m_end);
560  for ( ; i != iend; ++i ) {
561  if ( *i == _val ) return i;
562  }
563  return end();
564  }
565 
571  bool contains( const_reference _val )
572  {
573  return find( _val ) != end();
574  }
575 
579  inline iterator begin() { return iterator( m_front ); }
580 
584  inline const_iterator begin() const { return const_iterator( m_front ); }
585 
589  inline iterator end() { return iterator( m_end ); }
590 
594  inline const_iterator end() const { return const_iterator( m_end ); }
595 
599  inline reverse_iterator rbegin() { return reverse_iterator( m_end ); }
600 
604  inline const_reverse_iterator rbegin() const { return const_reverse_iterator( m_end ); }
605 
609  inline reverse_iterator rend() { return reverse_iterator( m_front ); }
610 
614  inline const_reverse_iterator rend() const { return const_reverse_iterator( m_front ); }
615 
619  inline size_type size() const { return m_size; }
620 
624  inline bool empty() const { return m_size == 0; }
625 
630  inline reference front() { agxAssert( !empty() ); return m_front->m_element; }
631 
636  inline const_reference front() const { agxAssert( !empty() ); return m_front->m_element; }
637 
642  inline reference back() { agxAssert( !empty() ); return m_end->m_prev->m_element; }
643 
648  inline const_reference back() const { agxAssert( !empty() ); return m_end->m_prev->m_element; }
649 
656  inline iterator insert( const_iterator _where, const_reference c_ref )
657  {
658  node_ptr_type node = allocate();
659  node->m_element = c_ref;
660  node->m_prev = _where.m_ptr->m_prev;
661  node->m_next = _where.m_ptr;
662  _where.m_ptr->m_prev = node;
663  ++m_size;
664  if ( node->m_prev == nullptr ) {
665  m_front = node;
666  }
667  else {
668  node->m_prev->m_next = node;
669  }
670  return iterator(node);
671  }
672 
679  template< typename InputIterator >
680  void insert( const_iterator _where, InputIterator _first, InputIterator _last )
681  {
682  for ( ; _first != _last; ++_first ) {
683  insert( _where, *_first );
684  }
685  }
686 
691  inline void push_back( const_reference c_ref )
692  {
693  insert( end(), c_ref );
694  }
695 
700  inline void push_front( const_reference c_ref )
701  {
702  insert( begin(), c_ref );
703  }
704 
709  inline void pop_front()
710  {
711  agxAssert( !empty() );
712  erase( begin() );
713  }
714 
719  inline void pop_back()
720  {
721  agxAssert( !empty() );
722  erase( --end() );
723  }
724 
728  void clear()
729  {
730  while ( !empty() ) {
731  pop_back();
732  }
733  }
734 
740  inline iterator erase( const_iterator _where )
741  {
742  if ( _where.m_ptr == m_front ) {
743  m_front = m_front->m_next;
744  m_front->m_prev = nullptr;
745 
746  deallocate( _where.m_ptr );
747 
748  agxAssert( m_size > 0 );
749  --m_size;
750  agxAssert( m_size > 0 || (m_size == 0 && m_front == m_end) );
751 
752  return iterator(m_front);
753  }
754  else {
755  _where.m_ptr->m_prev->m_next = _where.m_ptr->m_next;
756  _where.m_ptr->m_next->m_prev = _where.m_ptr->m_prev;
757 
758  node_ptr_type ret = _where.m_ptr->m_prev;
759 
760  deallocate( _where.m_ptr );
761 
762  agxAssert( m_size > 0 );
763  --m_size;
764 
765  return iterator(ret);
766  }
767  }
768 
773  template< typename Pred >
774  void remove_if( Pred pred )
775  {
776  node_ptr_type node = m_front;
777 
778  while ( node != m_end ) {
779  if ( pred( node->m_element ) )
780  node = erase( const_iterator( node ) ).m_ptr;
781  else
782  node = node->m_next;
783  }
784  }
785 
790  inline void remove( const_reference valArg )
791  {
792  remove_if( EqualPred1( valArg ) );
793  }
794 
801  template< typename Pred >
802  void merge( my_type& other, Pred pred )
803  {
804  if ( this != &other ) {
805  iterator myIt = begin();
806  iterator myEnd = end();
807 
808  const_iterator otherIt = other.begin();
809  const_iterator otherEnd = other.end();
810 
811  while ( myIt != myEnd && otherIt != otherEnd ) {
812  if ( pred( *otherIt, *myIt ) ) {
813  const_iterator otherNext = otherIt;
814  splice( myIt, other, otherIt, ++otherNext, 1 );
815  otherIt = otherNext;
816  }
817  else ++myIt;
818  }
819 
820  if ( otherIt != otherEnd )
821  splice( myEnd, other, otherIt, otherEnd, other.m_size );
822 
823  agxVerify( other.empty() );
824  }
825  }
826 
832  void merge( my_type& other )
833  {
834  merge( other, LessPred2() );
835  }
836 
841  template< typename Pred >
842  void unique( Pred pred )
843  {
844  if ( empty() )
845  return;
846 
847  const const_iterator endIt = end();
848  iterator curr = begin();
849  iterator prev = curr++;
850  while ( curr != endIt ) {
851  // Erase? Yes - let prev be what it was and increment curr.
852  // Note that erase wont return end since we always have prev.
853  if ( pred( *prev, *curr ) )
854  curr = ++erase( curr );
855  // Erase? No - continue.
856  else
857  prev = curr++;
858  }
859  }
860 
864  void unique()
865  {
866  unique( EqualPred2() );
867  }
868 
872  void reverse()
873  {
874  if ( m_size < 2 )
875  return;
876 
877  node_ptr_type node = m_front;
878  for ( ; ; ) {
879  const node_ptr_type next = node->m_next;
880  node->m_next = node->m_prev;
881  node->m_prev = next;
882  if ( node == m_end ) {
883  node_ptr_type tmp = m_front;
884  m_front = m_end->m_next;
885  m_front->m_prev = nullptr;
886  m_end->m_prev = tmp;
887  tmp->m_next = m_end;
888  break;
889  }
890  node = next;
891  }
892  }
893 
897  void swap( my_type& other )
898  {
899  std::swap( m_front, other.m_front );
900  std::swap( m_end, other.m_end );
901  std::swap( m_size, other.m_size );
902  }
903 
907  template< typename Pred >
908  void sort( Pred pred )
909  {
910  if ( m_size < 2 )
911  return;
912 
913  const size_type MAXBINS = 25;
914  my_type tmpList;
915  my_type binList[ MAXBINS + 1 ];
916 
917  size_type maxBin = 0;
918  while ( !empty() ) {
919  tmpList.splice( tmpList.begin(), *this, begin(), ++begin(), 1 );
920 
921  size_type bin = 0;
922  for ( ; bin < maxBin && !binList[ bin ].empty(); ++bin ) {
923  binList[ bin ].merge( tmpList, pred );
924  binList[ bin ].swap( tmpList );
925  }
926 
927  if ( bin == MAXBINS )
928  binList[ bin - 1 ].merge( tmpList, pred );
929  else {
930  binList[ bin ].swap( tmpList );
931  maxBin += size_type( bin == maxBin );
932  }
933  }
934 
935  for ( size_type bin = 1; bin < maxBin; ++bin )
936  binList[ bin ].merge( binList[ bin - 1 ], pred );
937 
938  splice( end(), binList[ maxBin - 1 ], binList[ maxBin - 1 ].begin(), binList[ maxBin - 1 ].end(), binList[ maxBin - 1 ].size() );
939  }
940 
949  void splice( const_iterator _where, my_type& other, const_iterator first, const_iterator last, size_type count )
950  {
951  if ( count == 0 )
952  return;
953 
954  if ( this != &other ) {
955  m_size += count;
956  other.m_size -= count;
957  }
958 
959  // If first is other.begin(), other gets a new m_front.
960  if ( first.m_ptr->m_prev == nullptr )
961  other.m_front = last.m_ptr;
962  else
963  first.m_ptr->m_prev->m_next = last.m_ptr;
964 
965  last.m_ptr->m_prev->m_next = _where.m_ptr;
966 
967  if ( _where.m_ptr->m_prev == nullptr )
968  m_front = first.m_ptr;
969  else
970  _where.m_ptr->m_prev->m_next = first.m_ptr;
971 
972  node_ptr_type node = _where.m_ptr->m_prev;
973  _where.m_ptr->m_prev = last.m_ptr->m_prev;
974  last.m_ptr->m_prev = first.m_ptr->m_prev;
975  first.m_ptr->m_prev = node;
976  }
977 
983  void splice( const_iterator _where, my_type& other )
984  {
985  splice( _where, other, other.begin(), other.end(), other.size() );
986  }
987 
996  void splice( const_iterator _where, my_type& other, const_iterator first, const_iterator last )
997  {
998  size_type count = 0;
999  if ( first == other.begin() && last == other.end() )
1000  count = other.size();
1001  else for ( const_iterator i = first; i != last; ++i, ++count )
1002  ;
1003  splice( _where, other, first, last, count );
1004  }
1005 
1009  void sort()
1010  {
1011  sort( LessPred2() );
1012  }
1013 
1014  private:
1015  node_ptr_type allocate()
1016  {
1017  return new node_type();
1018  }
1019 
1020  void deallocate( node_ptr_type node )
1021  {
1022  delete node;
1023  }
1024 
1025  private:
1026  size_type m_size;
1027  node_ptr_type m_end;
1028  node_ptr_type m_front;
1029  };
1030 }
1031 
1032 
1033 #else
1034 
1035 #include <list>
1036 
1037 namespace agx
1038 {
1039  template< typename T >
1040  class List : public std::list< T > {};
1041 }
1042 
1043 #endif
1044 
1045 #endif
List< T > my_type
Definition: List.h:110
iterator(const iterator &rhs)
Definition: List.h:201
const_pointer operator->() const
Definition: List.h:343
void sort(Pred pred)
Sorts the content in this list given pred.
Definition: List.h:908
AGX_LIST_ITERATOR_TYPEDEFS
Definition: List.h:194
AGXTERRAIN_EXPORT void clear()
LNode< T > & node_ref_type
Definition: List.h:119
iterator operator++(int)
Definition: List.h:215
const_reverse_iterator(const const_iterator &rhs)
Definition: List.h:290
T & operator()(T &val) const
Definition: List.h:62
reverse_iterator(const iterator &rhs)
Definition: List.h:373
reverse_iterator operator+(const agx::ItOp &inc) const
Definition: List.h:396
reference back()
Definition: List.h:642
List(const List &other)
Copy constructor.
Definition: List.h:487
bool operator()(const_reference left, const_reference right) const
Definition: List.h:472
reverse_iterator(node_ptr_type ptr)
Definition: List.h:368
bool operator!=(const const_reverse_iterator &i) const
Definition: List.h:351
void swap(my_type &other)
Swap this with other.
Definition: List.h:897
void remove_if(Pred pred)
Erase (all) elements matching pred.
Definition: List.h:774
reverse_iterator rend()
Definition: List.h:609
LNode< T > * node_ptr_type
Definition: List.h:118
reverse_iterator & operator=(const const_reverse_iterator &rhs)
Definition: List.h:381
agx::UInt value_type
Definition: List.h:56
pointer operator->() const
Definition: List.h:419
const_iterator & operator=(const const_iterator &rhs)
Definition: List.h:136
bool operator==(const my_type &other) const
Comparison of lists of same size.
Definition: List.h:524
void pop_back()
Remove last element in this list.
Definition: List.h:719
reference operator*() const
Definition: List.h:240
reference operator*() const
Definition: List.h:415
void push_front(const_reference c_ref)
Add element to the front of this list.
Definition: List.h:700
#define m_size
Definition: Vector.h:429
pointer operator->() const
Definition: List.h:244
void sort()
Sorts the content in this list given operator<.
Definition: List.h:1009
T & operator()(T &val) const
Definition: List.h:71
EqualPred1(const_reference obj)
Definition: List.h:442
iterator operator+(const agx::ItOp &inc) const
Definition: List.h:221
void merge(my_type &other, Pred pred)
Merge in elements from other, both this and other are ordered by pred.
Definition: List.h:802
T m_element
Definition: List.h:48
const T * const_pointer
Definition: List.h:115
const_reference front() const
Definition: List.h:636
reverse_iterator & operator++()
Definition: List.h:385
#define agxVerify(expr)
Definition: debug.h:131
iterator operator-(const agx::ItOp &inc) const
Definition: List.h:236
const_iterator(node_ptr_type ptr)
Definition: List.h:131
T value_type
Definition: List.h:111
ItOp(value_type num)
Definition: List.h:78
iterator & operator--()
Definition: List.h:225
reverse_iterator rbegin()
Definition: List.h:599
const_reverse_iterator(const const_reverse_iterator &rhs)
Definition: List.h:282
const_iterator operator++(int)
Definition: List.h:146
void pop_front()
Remove first element in this list.
Definition: List.h:709
AgXString< T > operator+(const Indentation &indentation, const AgXString< T > &str)
Definition: Indentation.h:66
iterator begin()
Definition: List.h:579
const_reverse_iterator operator+(const agx::ItOp &inc) const
Definition: List.h:320
iterator insert(const_iterator _where, const_reference c_ref)
Insert an element c_ref before _where.
Definition: List.h:656
size_type size() const
Definition: List.h:619
const_reverse_iterator & operator=(const const_iterator &rhs)
Definition: List.h:304
void merge(my_type &other)
Merge in elements from other, both this and other are ordered by operator<.
Definition: List.h:832
const_reverse_iterator operator--(int)
Definition: List.h:329
bool operator==(const const_reverse_iterator &i) const
Definition: List.h:347
iterator(node_ptr_type ptr)
Definition: List.h:200
const_iterator & operator--()
Definition: List.h:156
void insert(const_iterator _where, InputIterator _first, InputIterator _last)
Insert N elements before _where.
Definition: List.h:680
bool operator()(const_reference left, const_reference right) const
Definition: List.h:454
const T & const_reference
Definition: List.h:113
uint32_t UInt
Definition: Integer.h:34
List()
Default constructor, size zero and begin() == end().
Definition: List.h:479
const_iterator operator-(const agx::ItOp &inc) const
Definition: List.h:167
reverse_iterator operator--(int)
Definition: List.h:405
bool contains(const_reference _val)
Check if a value _val is part of this list (at least one time).
Definition: List.h:571
size_t size_type
Definition: List.h:116
void clear()
Clear this list of all elements.
Definition: List.h:728
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
ItT operator-(const ItT &it, const agx::ItOp &inc)
Definition: List.h:101
const_reverse_iterator & operator++()
Definition: List.h:309
reverse_iterator & operator=(const iterator &rhs)
Definition: List.h:377
const_reverse_iterator(node_ptr_type ptr)
Definition: List.h:281
bool operator!=(const reverse_iterator &i) const
Definition: List.h:427
LNode()
Definition: List.h:46
LNode(T element)
Definition: List.h:47
const_iterator operator--(int)
Definition: List.h:161
const_reverse_iterator rend() const
Definition: List.h:614
bool operator!=(const const_iterator &i) const
Definition: List.h:260
T * pointer
Definition: List.h:114
const_reverse_iterator & operator=(const iterator &rhs)
Definition: List.h:299
bool empty() const
Definition: List.h:624
void splice(const_iterator _where, my_type &other)
Splice other [other.begin(), other.end()) at _where.
Definition: List.h:983
~List()
Destructor.
Definition: List.h:496
bool operator!=(const iterator &i) const
Definition: List.h:256
bool operator==(const iterator &i) const
Definition: List.h:248
bool operator==(const const_iterator &i) const
Definition: List.h:179
ItT operator()(const ItT &org, Op op) const
Definition: List.h:82
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
iterator find(const_reference _val)
Find iterator to FIRST element with value _val.
Definition: List.h:556
const_reverse_iterator & operator=(const const_reverse_iterator &rhs)
Definition: List.h:294
#define agxAssert(expr)
Definition: debug.h:143
const_reverse_iterator rbegin() const
Definition: List.h:604
reverse_iterator operator-(const agx::ItOp &inc) const
Definition: List.h:411
reverse_iterator(const reverse_iterator &rhs)
Definition: List.h:369
const_reverse_iterator operator-(const agx::ItOp &inc) const
Definition: List.h:335
reverse_iterator operator++(int)
Definition: List.h:390
bool operator()(const_reference obj) const
Definition: List.h:443
List & operator=(const my_type &other)
Assignment operator.
Definition: List.h:509
const_iterator & operator++()
Definition: List.h:141
reverse_iterator & operator--()
Definition: List.h:400
iterator & operator=(const iterator &rhs)
Definition: List.h:205
bool operator==(const reverse_iterator &i) const
Definition: List.h:423
const_reverse_iterator(const iterator &rhs)
Definition: List.h:286
LNode * m_next
Definition: List.h:49
LNode * m_prev
Definition: List.h:50
iterator operator--(int)
Definition: List.h:230
void reverse()
Reverse sequence.
Definition: List.h:872
iterator erase(const_iterator _where)
Erase element at _where.
Definition: List.h:740
LNode< T > node_type
Definition: List.h:117
const_iterator(const const_iterator &rhs)
Definition: List.h:132
iterator end()
Definition: List.h:589
LessPred1(const_reference obj)
Definition: List.h:460
const_reverse_iterator & operator--()
Definition: List.h:324
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
void splice(const_iterator _where, my_type &other, const_iterator first, const_iterator last)
Splice other [first, last) at _where.
Definition: List.h:996
const_iterator begin() const
Definition: List.h:584
Definition: List.h:53
const_reverse_iterator operator++(int)
Definition: List.h:314
const_iterator operator+(const agx::ItOp &inc) const
Definition: List.h:152
const_iterator end() const
Definition: List.h:594
T & reference
Definition: List.h:112
void splice(const_iterator _where, my_type &other, const_iterator first, const_iterator last, size_type count)
Splice other [first, last) at _where.
Definition: List.h:949
const_reference back() const
Definition: List.h:648
void unique(Pred pred)
Erases each element satisfying pred with previous.
Definition: List.h:842
void unique()
Erases each element satisfying operator== with previous.
Definition: List.h:864
bool operator==(const const_iterator &i) const
Definition: List.h:252
const_iterator find(const_reference _val) const
Find iterator to FIRST element with value _val.
Definition: List.h:541
iterator & operator++()
Definition: List.h:210
const_pointer operator->() const
Definition: List.h:175
const_reference operator*() const
Definition: List.h:171
reference front()
Definition: List.h:630
void push_back(const_reference c_ref)
Add element to the back of this list.
Definition: List.h:691
bool operator!=(const const_iterator &i) const
Definition: List.h:183
const_reference operator*() const
Definition: List.h:339
bool operator()(const_reference obj) const
Definition: List.h:461