ALib C++ Library
Library Version: 1912 R0
Documentation generated by doxygen
forwardlist.hpp
Go to the documentation of this file.
1 /** ************************************************************************************************
2  * \file
3  * This header file is part of module \alib_monomem of the \aliblong.
4  *
5  * \emoji :copyright: 2013-2019 A-Worx GmbH, Germany.
6  * Published under \ref mainpage_license "Boost Software License".
7  **************************************************************************************************/
8 #ifndef HPP_ALIB_FS_LISTS_FORWARDLIST
9 #define HPP_ALIB_FS_LISTS_FORWARDLIST 1
10 
11 #if !defined(HPP_ALIB_FS_INTEGERS_INTEGERS)
13 #endif
14 
15 #if !defined (_GLIBCXX_ITERATOR) && !defined (_ITERATOR_)
16 # include <iterator>
17 #endif
18 
19 namespace aworx { namespace lib {
20 
21 // forwards
22 template<typename TElement> struct ForwardList;
23 template<typename TElement> struct ForwardListIterator;
24 template<typename TElement> struct BidiNode;
25 template<typename TElement> struct BidiList;
26 template<typename TElement> struct BidiListIterator;
27 
28 /** ************************************************************************************************
29  * This is a generic base type that represents a node of a single linked lists.
30  * The effective (instantiated) nodes of the list are to be derived from this type with specifying
31  * their very own type name as template parameter \p{TElement}. The following quick sample
32  * demonstrates this:
33  *
34  * \code{.cpp}
35  * // The contents to store with each element of a list
36  * class MyData
37  * {
38  * //....
39  * };
40  *
41  * // The custom list node derived from this type, giving its own type as template parameter
42  * struct MyElement : public ForwardNode<MyElement> 4
43  * {
44  * MyData nodeValue;
45  * };
46  * \endcode
47  *
48  * This documentation, as well as the documentation of types \alib{ForwardList}
49  * and \alib{ForwardListIterator}, uses the terms <b>"node"</b> for this type
50  * and <b>"element"</b> for the custom derived type \p{TElement} that contains the custom
51  * (container) data.
52  *
53  * With this simple mechanism in place, node instances may be used as "anchors" to the first element
54  * of a list. Pointers to nodes of this type may either point to a node or to an element. Instances
55  * of nodes always point to an element instance.
56  *
57  * While pointers to nodes and elements are statically castable to each other (which is a "noop"
58  * because it does not change the pointer's address on common platforms/compilers), most methods
59  * accept and/or return pointers to derived type \p{TElement}, and if so, it has to be assured by
60  * the caller that the input parameters in fact point to those derived instances. Likewise it is
61  * assured by this type and types \alib{ForwardList} and
62  * \alib{ForwardListIterator}, that a returned pointer to an element does so.
63  *
64  * This "contract" provides maximum type safety while dealing with start pointers to element
65  * lists (which are usually non-castable instances of this base type as provided with
66  * \alib{ForwardList}), while avoiding the need of code clutter by
67  * inserting <c>static_cast</c> to \p{TElement} in the using code as much as possible.
68  * Furthermore, this concept allows to have field #forward of type \p{TElement} which makes
69  * debugging much easier, because the custom values of the derived types are always visible.
70  *
71  * @tparam TElement The "final" node type, containing custom data fields, that is to be derived from
72  * this struct.
73  **************************************************************************************************/
74 template<typename TElement>
76 {
77  #if !defined(ALIB_DOX)
78  friend struct ForwardList <TElement>;
79  friend struct ForwardListIterator<TElement>;
80  friend struct BidiNode <TElement>;
81  friend struct BidiList <TElement>;
82  friend struct BidiListIterator <TElement>;
83  #endif
84 
85  /** Alias name for the an instantiation of this template. */
87 
88  private:
89 
90  /** In case of derived type \p{TElement} this is the pointer to the next element.
91  * In case of derived class \alib{ForwardList}, this is the pointer to the
92  * first element of the list. */
93  TElement* forward;
94 
95  public:
96 
97  /** Default constructor. (Does not initialize the pointer!) */
98  ForwardNode() noexcept = default;
99 
100  /** Deleted copy constructor. This is deleted because it is dangerous, respectively often
101  * not possible and also mostly not wanted to be able to create copies of derived type
102  * \p{TElement} */
103  ForwardNode( const TNode& ) = delete;
104 
105  /** Defaulted move constructor. */
106  ForwardNode( TNode&& ) noexcept = default;
107 
108  /** Deleted copy assignment operator. This is deleted because it is dangerous, respectively
109  * often not possible and also mostly not wanted to created copies of derived type
110  * \p{TElement}
111  * @return Not defined.*/
112  ForwardNode& operator=( const TNode& ) = delete;
113 
114  /** Defaulted move assignment operator.
115  * @return A reference to this object.*/
116  ForwardNode& operator=( TNode&& ) noexcept = default;
117 
118 
119  /** Constructor accepting a pointer to the next element.
120  * @param next Pointer to the next element. Assigned to field #forward. */
121  ForwardNode( TElement* next ) noexcept
122  : forward(next)
123  {}
124 
125 
126  /** Test if this element is the last element of the list.
127  * @return \c true if field #forward equals \c nullptr, otherwise \c false. */
128  bool isLast() const
129  {
130  return forward == nullptr;
131  }
132 
133  /** Test if this node or element has a next element linked.
134  * @return \c false if field #forward equals \c nullptr, otherwise \c true. */
135  bool hasNext() const
136  {
137  return forward != nullptr;
138  }
139 
140  /** Test if \p{elem} is the successor fo this node or element.
141  * @param elem The element to test for being a successor of this.
142  * @return \c true if field #forward equals \p{elem} , otherwise \c false. */
143  bool pointsTo( TElement* elem ) const
144  {
145  return forward == elem;
146  }
147 
148  /** Sets field #forward to \c nullptr.
149  * @return The element that this node or element pointed to before the invocation. */
150  TElement* makeLast()
151  {
152  TElement* result= forward;
153  forward= nullptr;
154  return result;
155  }
156 
157  /** Sets field #forward to \p{elem}.
158  * @param elem The element that this node or element is to point to.
159  * @return The element that this node or element pointed to before the invocation. */
160  TElement* makePointTo( TElement* elem )
161  {
162  TElement* result= forward;
163  forward= elem;
164  return result;
165  }
166 
167 
168  /** Returns the successor of this node or element.
169  * @return The element following this one, respectively \c nullptr if this is the last
170  * element of the list. */
171  TElement* next() const
172  {
173  return forward;
174  }
175 
176  /** Unhooks and returns the element after this node or element.
177  * \note
178  * Field #forward of the returned element is \b not set to \c nullptr.
179  *
180  * @return The unhooked element. */
181  TElement* removeNext()
182  {
183  auto* result= forward;
184  forward = forward->forward;
185  return result;
186  }
187 
188  /** Unhooks successors until \p{last}. If \p{last} equals field #forward, only one
189  * element is unhooked.
190  * \attention
191  * Field #forward of given \p{last} is \b not set to \c nullptr.
192  *
193  * @param last The last element of the range
194  * <b>[</b>\ref forward "forward"<b>, </b> \p{last}<b>]</b> which is removed.
195  *
196  * @return The start of the range (the current successor of this node or element). */
197  TElement* removeRangeBehind( TElement* last )
198  {
199  TElement* result= forward;
200  forward = last->forward;
201  return result;
202  }
203 
204  /** Hooks the given element behind this node or element.
205  * @param elem The element to insert behind this node or element.
206  * @return The element that given \p{elem} pointed to before the insertion. */
207  TElement* addBehind( TElement* elem )
208  {
209  TElement* result = elem->forward;
210  elem->forward= forward;
211  forward = elem;
212  return result;
213  }
214 
215 
216  /** Hooks the given range of elements behind this node or element.
217  * @param first The first element of the range to insert.
218  * @param last The last element of the range to insert.
219  * @return The element that given \p{last} pointed to before the insertion. */
220  TElement* addBehind( TElement* first, TElement* last )
221  {
222  TElement* result = last->forward;
223  last->forward= forward;
224  forward = first;
225  return result;
226  }
227 
228  // #############################################################################################
229  // ### Iterator interface
230  // #############################################################################################
231  /** The mutable <c>std::iterator</c> type. */
233 
234  /** The constant <c>std::iterator</c> type. */
236 
237  /** Interprets (casts) this node to an element and returns an iterator referring to it
238  * constituting a start of a range of elements.
239  * @return The first of element in the list. */
240  Iterator begin() { return Iterator( static_cast<TElement*>(this) ); }
241 
242  /** Returns an iterator referring to the end of a range of elements (aka a \c nullptr).
243  * @return The end of the list. */
244  Iterator end() { return Iterator( nullptr ); }
245 
246  /** Interprets (casts) this node to an element and returns an iterator referring to it
247  * constituting a start of a range of elements.
248  * @return The first of element in the list. */
249  ConstIterator begin() const { return ConstIterator( static_cast<TElement*>(this) ); }
250 
251  /** Returns an iterator referring to the end of a range of elements (aka a \c nullptr).
252  * @return The end of the list. */
253  ConstIterator end() const { return ConstIterator( nullptr ); }
254 
255  /** Interprets (casts) this node to an element and returns an iterator referring to it
256  * constituting a start of a range of elements.
257  * @return The first of element in the list. */
258  ConstIterator cbegin() const { return ConstIterator( static_cast<TElement*>(this) ); }
259 
260  /** Returns an iterator referring to the end of a range of elements (aka a \c nullptr).
261  * @return The end of the list. */
262  ConstIterator cend() const { return ConstIterator( nullptr ); }
263 
264  // #############################################################################################
265  // ### static helpers
266  // #############################################################################################
267 
268  /** Counts the number of elements found in the range starting with \p{start} and ending with
269  * the element before \p{end}.
270  * @param start Pointer to the first element to count.
271  * @param end Pointer to the element after the last one to count.
272  * Defaults to \c nullptr, marking the end of a list.
273  * @return The number of elements in the range. */
274  static integer count( TElement* start, TElement* end= nullptr )
275  {
276  integer result= 0;
277  for( ConstIterator it= ConstIterator(start) ; it != ConstIterator(end) ; ++it )
278  ++result;
279  return result;
280  }
281 
282  /** Moves the given node pointer reference to point to the next node.
283  * The result is the moved pointer, casted to an element.
284  *
285  * \note
286  * It is matter of taste to use this static method for better code readability.
287  *
288  * @param pointer A reference to the pointer to move forward.
289  * @return The moved pointer, casted to an element. */
290  static TElement* moveForward( TNode*& pointer )
291  {
292  return static_cast<TElement*>(pointer= pointer->forward);
293  }
294 
295  /** Moves the given element pointer reference to point to the next element.
296  * \note
297  * It is matter of taste to use this static method for better code readability.
298  *
299  * @param pointer A reference to the pointer to move forward. */
300  static void moveForward( TElement*& pointer )
301  {
302  pointer= pointer->forward;
303  }
304 }; // struct ForwardNode
305 
306 /** ************************************************************************************************
307  * Implementation of \c std::iterator for types
308  * \alib{ForwardNode} and \alib{ForwardList}.
309  *
310  * As the name of the class indicates, this iterator satisfies the C++ standard library concept
311  * \https{ForwardIterator,en.cppreference.com/w/cpp/concept/ForwardIterator}.
312  *
313  * \note
314  * Iterators of this type may be received with the common <b>begin/end</b> methods found in
315  * types \b ForwardNode and \b ForwardList, but also be created autonomously by passing
316  * a pointer to \p{TElement} to the corresponding public constructor.
317  *
318  * @tparam TElement The "final" element type that by contract is derived from struct
319  * \alib{ForwardNode}.
320  **************************************************************************************************/
321 template<typename TElement>
322 struct ForwardListIterator
323  : public std::iterator< std::forward_iterator_tag, // iterator_category
324  ForwardNode<TElement>, // value_type
325  integer, // distance type
326  ForwardNode<TElement>*, // pointer
327  ForwardNode<TElement>& // reference
328  >
329 {
330  private:
331  /** The current element this iterator refers to. */
332  TElement* element;
333 
334  public:
335 
336  /** Constructor.
337  * @param start Pointer to the initial element. */
338  ForwardListIterator( TElement* start ) noexcept
339  : element( start )
340  {}
341 
342  // ###################### To satisfy concept of InputIterator ######################
343 
344  /** Prefix increment operator.
345  * @return A reference to this object. */
347  {
348  element= element->next();
349  return *this;
350  }
351 
352  /** Postfix increment operator.
353  * @return An iterator value that is not increased, yet. */
355  {
356  return ForwardListIterator( element->next() );
357  }
358 
359  /** Comparison operator.
360  * @param other The iterator to compare ourselves to.
361  * @return \c true if this and the given iterator are pointing to the same element,
362  * \c false otherwise. */
363  bool operator==(ForwardListIterator other) const
364  {
365  return element == other.element;
366  }
367 
368  /** Comparison operator.
369  * @param other The iterator to compare ourselves to.
370  * @return \c true if this and given iterator are not equal, \c false otherwise. */
371  bool operator!=(ForwardListIterator other) const
372  {
373  return !(*this == other);
374  }
375 
376  // ###################### Member access ######################
377 
378  /** Retrieves a reference to the referred element.
379  * @return A reference to the referred element. */
380  TElement& operator*() const
381  {
382  return *element;
383  }
384 
385  /** Retrieves a pointer to the referred element.
386  * @return A pointer to the referred element. */
387  TElement* operator->() const
388  {
389  return *element;
390  }
391 
392 }; // struct ForwardListIterator
393 
394 
395 /** ************************************************************************************************
396  * Implements a single linked list of \p{TElement} instances.
397  * This class inherits \b ForwardNode<TElement>, like \p{TElement} does (by contract).
398  * This way methods that return a pointer to \b ForwardNode<TElement> may return either this
399  * object itself (the "start hook" of the list) or a pointer to an element instance.
400  *
401  * Other methods (the larger part) return an object of \p{TElement}.
402  * It has to be taken care that the result of methods that return type
403  * \b ForwardNode are not casted to pointers of \p{TElement} by the calling code
404  * (which is statically possible!). Only if a method returns \p{TElement}, it is assured that
405  * a custom element type is returned.
406  *
407  * \note
408  * A good sample that demonstrates this difference in return types are methods #findLast and
409  * #findLastBefore.
410  * The first returns a pointer to type \p{TElement}. In contrast to this, the second
411  * returns a pointer to type \b ForwardNode because the result may be a pointer
412  * to this list instance itself - which has no custom data attached!
413  *
414  * @tparam TElement The "final" custom type that (by contract) is derived from
415  * \alib{ForwardNode} the same type as this struct is.
416  **************************************************************************************************/
417 template<typename TElement>
418 struct ForwardList : private ForwardNode<TElement>
419 {
420  /** An alias for the node type of this list, which is also the type this struct is derived
421  * from. */
423 
425 
426  /** Default constructor. Initializes this list to be empty. */
427  ForwardList() noexcept
428  {
429  TNode::forward= nullptr;
430  }
431 
432  /** Copy constructor.
433  * After construction, this instance points to the first start object as \p{copy} does.
434  * @param copy The list to copy the link from. */
435  ForwardList( const ForwardList& copy ) noexcept
436  {
437  TNode::forward= copy.forward;
438  }
439 
440 
441  /** Move constructor.
442  * Copies the link from \p{move} and sets the link of \p{move} to \c nullptr.
443  * @param move The list to move. */
444  ForwardList( ForwardList&& move ) noexcept
445  {
446  TNode::forward= move.forward;
447  move.forward= nullptr;
448  }
449 
450  /** Copy assignment operator.
451  * Copies the link to the first element from \p{copy}.
452  * @param copy The list to copy the link from.
453  * @return A reference to this list object. */
454  ForwardList& operator= ( const ForwardList& copy ) noexcept
455  {
456  TNode::forward= copy.forward;
457  }
458 
459  /** Move assignment operator.
460  * Copies the link to the first element from \p{move} and sets the link in \p{move} to
461  * \c nullptr.
462  * @param move The list to move the link from.
463  * @return A reference to this list object. */
464  ForwardList& operator= ( ForwardList&& move ) noexcept
465  {
466  TNode::forward= move.forward;
467  move.forward= nullptr;
468  }
469 
470 
471  /** Constructor accepting a pointer to the first element.
472  * @param first The element to use as the first element of this list. */
473  ForwardList( TElement* first ) noexcept
474  {
475  TNode::forward= first;
476  }
477 
478  /** Casts this list to the node type. This method is needed because this list type inherits
479  * the node type privately.
480  *
481  * \note
482  * This method simply returns <c>this</c>, which performs the static cast.
483  * If this type inherited \b ForwardNode publically, a simple ampersand operator
484  * (<c>&</c>) could be used on a value of this type instead of invoking this method.
485  *
486  * @return Returns this list as a pointer to base type \b ForwardNode. */
488  {
489  return this;
490  }
491 
492  /** Tests if this list is empty.
493  * @return \c false if the list is empty, \c true otherwise. */
494  bool isEmpty() const
495  {
496  return start() == nullptr;
497  }
498 
499  /** Tests if this list is not empty.
500  * @return \c true if the list is empty, \c false otherwise. */
501  bool isNotEmpty() const
502  {
503  return start() != nullptr;
504  }
505 
506  /** Resets this list to zero elements. */
507  void reset()
508  {
509  TNode::forward= nullptr;
510  }
511 
512  /** Returns the start element of this list.
513  * @return The first element of this list, respectively \c nullptr if this list is empty. */
514  TElement* start() const
515  {
516  return TNode::forward;
517  }
518 
519  /** Sets given element \p{elem} as the start of this list.
520  * @param elem The element to set as the new start of this list.
521  */
522  void setStart( TElement* elem )
523  {
524  TNode::forward= elem;
525  }
526 
527  /** Hooks the given element to the beginning of this list.
528  * @param elem The element to insert to at the start. */
529  void pushFront( TElement* elem )
530  {
531  elem->forward= start();
532  setStart( elem );
533  }
534 
535  /** Hooks the given range of elements to the front of this list.
536  * @param first The first element of the range to insert.
537  * @param last The last element of the range to insert. */
538  void pushFront( TElement* first, TElement* last )
539  {
540  last->forward= start();
541  setStart(first);
542  }
543 
544  /** Removes and returns the first element from this list.
545  * @return A pointer to the element, respectively \c nullptr if the list was empty. */
546  TElement* popFront()
547  {
548  if( isEmpty() )
549  return nullptr;
550 
551  auto* result= start();
552  setStart(start()->forward);
553  return result;
554  }
555 
556  /** Searches and returns the last element.
557  * \note
558  * This method must only be invoked on non-empty lists (#isNotEmpty returns \c true).
559  * Otherwise this method has undefined behavior (dereference of a \c nullptr).
560  * To find the pointer to the last element use #findLastBefore providing \c nullptr.
561  * @return The last element of this list. */
562  TElement* findLast() const
563  {
564  TElement* elem= start();
565  while( elem->hasNext() )
566  TNode::moveForward(elem);
567  return elem;
568  }
569 
570  /** Searches and returns the last element.
571  * @param hint An element of this list used to start the search.
572  * @return The last element of this list. */
573  TElement* findLast( TElement* hint ) const
574  {
575  TElement* elem= hint;
576  while( elem->hasNext() )
577  TNode::moveForward(elem);
578  return elem;
579  }
580 
581  /** Searches the node or element that points to the given element.
582  * @param elem The element to search for.
583  * @return The node (this object) or element pointing to \p{elem}. */
584  TNode* findLastBefore( TElement* elem )
585  {
586  TNode* it= this;
587  while( !it->pointsTo(elem) )
588  TNode::moveForward(it);
589  return it;
590  }
591 
592  /** Searches the predecessor of the given element using #findLastBefore and unhooks the element
593  * from the list.
594  * \note
595  * It is not checked whether a predecessor was found, aka whether \p{elem} is an element
596  * of this list. If not, behavior is undefined (<c>nullptr access</c>).<br>
597  * Furthermore, the successor of given \p{elem} is not changed, although it is removed
598  * from the list.
599  *
600  * @param elem The element to remove.
601  * @return The node (this object) or element that pointed to given \p{elem} before the
602  * invocation and now points to the successor of \p{elem}. */
603  TNode* findAndRemove( TElement* elem )
604  {
605  TNode* previous= findLastBefore(elem);
606  previous->removeNext();
607  return previous;
608  }
609 
610  /** Counts the number of elements found in the range starting with this list's first element and
611  * ending with the element before \p{end}.
612  * @param end The element after the last one to count.
613  * Defaults to a \c nullptr marking the end of the list.
614  * @return The number of elements in the range. */
615  integer count( TElement* end= nullptr ) const
616  {
617  return TNode::count( start(), end );
618  }
619 
620 
621  /** The mutable iterator type. */
623 
624  /** The constant iterator type. */
626 
627  /** Returns an iterator referring to a mutable element at the start of this list.
628  * @return An iterator to the first element in the list. */
629  Iterator begin() { return Iterator( start() ); }
630 
631  /** Returns an iterator referring to a mutable, non-existing element.
632  * @return The end of the list. */
633  Iterator end() { return Iterator( nullptr ); }
634 
635  /** Returns an iterator referring to a constant element at the start of this list.
636  * @return An iterator to the first element in the list, limited to constant element access. */
637  ConstIterator begin() const { return ConstIterator( start() ); }
638 
639  /** Returns an iterator referring to a constant, non-existing element.
640  * @return The end of the list. */
641  ConstIterator end() const { return ConstIterator( nullptr ); }
642 
643  /** Returns an iterator referring to a constant element at the start of this list.
644  * @return An iterator to the first element in the list, limited to constant element access. */
645  ConstIterator cbegin() const { return ConstIterator( start() ); }
646 
647  /** Returns an iterator referring to a constant, non-existing element.
648  * @return The end of the list. */
649  ConstIterator cend() const { return ConstIterator( nullptr ); }
650 
651 }; // struct ForwardList
652 
653 }} // namespace [aworx::lib]
654 
655 
656 #endif // HPP_ALIB_FS_LISTS_FORWARDLIST
aworx::lib::ForwardNode::Iterator
ForwardListIterator< TElement > Iterator
Definition: forwardlist.hpp:232
aworx::lib::ForwardList::operator=
ForwardList & operator=(const ForwardList &copy) noexcept
Definition: forwardlist.hpp:454
aworx::lib::ForwardListIterator::ForwardListIterator
ForwardListIterator(TElement *start) noexcept
Definition: forwardlist.hpp:338
aworx::lib::ForwardList::Iterator
ForwardListIterator< TElement > Iterator
Definition: forwardlist.hpp:622
aworx::lib::ForwardNode::begin
ConstIterator begin() const
Definition: forwardlist.hpp:249
aworx::lib::ForwardNode::ForwardNode
ForwardNode() noexcept=default
aworx::lib::integer
platform_specific integer
Definition: integers.hpp:53
aworx::lib::ForwardListIterator::operator++
ForwardListIterator operator++(int)
Definition: forwardlist.hpp:354
aworx::lib::ForwardList::start
TElement * start() const
Definition: forwardlist.hpp:514
integers.hpp
aworx::lib::ForwardList::ForwardList
ForwardList(const ForwardList &copy) noexcept
Definition: forwardlist.hpp:435
aworx::lib::ForwardNode::begin
Iterator begin()
Definition: forwardlist.hpp:240
aworx::lib::ForwardList::reset
void reset()
Definition: forwardlist.hpp:507
aworx::lib::ForwardListIterator::operator==
bool operator==(ForwardListIterator other) const
Definition: forwardlist.hpp:363
aworx::lib::ForwardListIterator::operator!=
bool operator!=(ForwardListIterator other) const
Definition: forwardlist.hpp:371
aworx::lib::ForwardList::findLastBefore
TNode * findLastBefore(TElement *elem)
Definition: forwardlist.hpp:584
aworx::lib::ForwardList::setStart
void setStart(TElement *elem)
Definition: forwardlist.hpp:522
aworx::lib::ForwardListIterator::operator++
ForwardListIterator & operator++()
Definition: forwardlist.hpp:346
aworx::lib::ForwardNode::makePointTo
TElement * makePointTo(TElement *elem)
Definition: forwardlist.hpp:160
aworx::lib::ForwardList::findLast
TElement * findLast(TElement *hint) const
Definition: forwardlist.hpp:573
aworx::lib::ForwardList::isNotEmpty
bool isNotEmpty() const
Definition: forwardlist.hpp:501
aworx::lib::ForwardNode::moveForward
static TElement * moveForward(TNode *&pointer)
Definition: forwardlist.hpp:290
aworx::lib::BidiListIterator
Definition: bidilist.hpp:25
aworx::lib::ForwardNode::forward
TElement * forward
Definition: forwardlist.hpp:93
aworx::lib::ForwardListIterator
Definition: forwardlist.hpp:23
aworx::lib::BidiList
Definition: bidilist.hpp:24
aworx::lib::ForwardList::ConstIterator
ForwardListIterator< const TElement > ConstIterator
Definition: forwardlist.hpp:625
aworx::lib::ForwardList::castToNode
TNode * castToNode()
Definition: forwardlist.hpp:487
aworx::lib::ForwardNode::addBehind
TElement * addBehind(TElement *first, TElement *last)
Definition: forwardlist.hpp:220
aworx::lib::ForwardListIterator::element
TElement * element
Definition: forwardlist.hpp:332
aworx::lib::BidiNode
Definition: bidilist.hpp:41
aworx::lib::ForwardList::isEmpty
bool isEmpty() const
Definition: forwardlist.hpp:494
aworx::lib::ForwardList::end
Iterator end()
Definition: forwardlist.hpp:633
aworx::lib::ForwardList
Definition: forwardlist.hpp:22
aworx::lib::ForwardList::begin
Iterator begin()
Definition: forwardlist.hpp:629
aworx::lib::ForwardList::ForwardList
ForwardList() noexcept
Definition: forwardlist.hpp:427
aworx::lib::ForwardNode::addBehind
TElement * addBehind(TElement *elem)
Definition: forwardlist.hpp:207
aworx::lib::ForwardNode::end
ConstIterator end() const
Definition: forwardlist.hpp:253
aworx
Definition: alox/alox.hpp:40
aworx::lib::ForwardNode
Definition: forwardlist.hpp:75
aworx::lib::ForwardList::findLast
TElement * findLast() const
Definition: forwardlist.hpp:562
aworx::lib::ForwardListIterator::operator*
TElement & operator*() const
Definition: forwardlist.hpp:380
aworx::lib::ForwardList::pushFront
void pushFront(TElement *elem)
Definition: forwardlist.hpp:529
aworx::lib::ForwardList::popFront
TElement * popFront()
Definition: forwardlist.hpp:546
aworx::lib::ForwardList::count
integer count(TElement *end=nullptr) const
Definition: forwardlist.hpp:615
aworx::lib::ForwardNode::count
static integer count(TElement *start, TElement *end=nullptr)
Definition: forwardlist.hpp:274
aworx::lib::ForwardList::ForwardList
ForwardList(ForwardList &&move) noexcept
Definition: forwardlist.hpp:444
aworx::lib::ForwardNode::end
Iterator end()
Definition: forwardlist.hpp:244
aworx::lib::ForwardNode::pointsTo
bool pointsTo(TElement *elem) const
Definition: forwardlist.hpp:143
aworx::lib::ForwardNode::next
TElement * next() const
Definition: forwardlist.hpp:171
aworx::lib::ForwardNode::ConstIterator
ForwardListIterator< const TElement > ConstIterator
Definition: forwardlist.hpp:235
aworx::lib::ForwardNode::isLast
bool isLast() const
Definition: forwardlist.hpp:128
aworx::lib::ForwardNode::removeRangeBehind
TElement * removeRangeBehind(TElement *last)
Definition: forwardlist.hpp:197
aworx::lib::ForwardList::cbegin
ConstIterator cbegin() const
Definition: forwardlist.hpp:645
aworx::lib::ForwardList::begin
ConstIterator begin() const
Definition: forwardlist.hpp:637
aworx::lib::ForwardList::ForwardList
ForwardList(TElement *first) noexcept
Definition: forwardlist.hpp:473
aworx::lib::ForwardNode::moveForward
static void moveForward(TElement *&pointer)
Definition: forwardlist.hpp:300
aworx::lib::ForwardList::pushFront
void pushFront(TElement *first, TElement *last)
Definition: forwardlist.hpp:538
aworx::lib::ForwardListIterator::operator->
TElement * operator->() const
Definition: forwardlist.hpp:387
aworx::lib::ForwardNode::makeLast
TElement * makeLast()
Definition: forwardlist.hpp:150
aworx::lib::ForwardNode::cbegin
ConstIterator cbegin() const
Definition: forwardlist.hpp:258
aworx::lib::ForwardList::end
ConstIterator end() const
Definition: forwardlist.hpp:641
aworx::lib::ForwardNode::cend
ConstIterator cend() const
Definition: forwardlist.hpp:262
aworx::lib::ForwardList::findAndRemove
TNode * findAndRemove(TElement *elem)
Definition: forwardlist.hpp:603
aworx::lib::ForwardNode::removeNext
TElement * removeNext()
Definition: forwardlist.hpp:181
aworx::lib::ForwardNode::hasNext
bool hasNext() const
Definition: forwardlist.hpp:135
aworx::lib::ForwardList::cend
ConstIterator cend() const
Definition: forwardlist.hpp:649