#include <bidilist.hpp>
Implements a doubly linked list of TElement instances. This class inherits BidiNode<TElement>, like TElement does (by contract). This way methods that return a pointer to BidiNode<TElement> may return either this object itself (the "start hook" of the list) or a pointer to an element instance.
Other methods (the larger part) accept or return object(s) of type TElement. It has to be taken care that the result of methods that return type BidiNode are not casted to pointers of TElement by the calling code (which is statically possible!). Only if a method returns TElement, it is assured that a custom element type is returned.
| TElement | The "final" custom type that (by contract) is derived from BidiNode the same type as this struct is. |
Definition at line 24 of file bidilist.hpp.
Public Types | |
| using | ConstIterator = BidiListIterator< const TElement > |
| using | ConstReverseIterator = std::reverse_iterator< ConstIterator > |
| using | Iterator = BidiListIterator< TElement > |
| using | ReverseIterator = std::reverse_iterator< Iterator > |
| using | TFNode = ForwardNode< TElement > |
| using | TNode = BidiNode< TElement > |
Public Methods | |
| BidiList () noexcept | |
| BidiList (BidiList &&move) noexcept | |
| BidiList (const BidiList &)=delete | |
| BidiList (TElement *first) | |
| BidiList (TElement *first, TElement *last) | |
| Iterator | begin () |
| ConstIterator | begin () const |
| TNode * | castToNode () |
| ConstIterator | cbegin () const |
| ConstIterator | cend () const |
| integer | count (TElement *end=nullptr) const |
| ConstReverseIterator | crbegin () const |
| ConstReverseIterator | crend () const |
| Iterator | end () |
| ConstIterator | end () const |
| TElement * | first () const |
| bool | isEmpty () const |
| bool | isFirst (TElement *elem) const |
| bool | isLast (TElement *elem) const |
| bool | isNotEmpty () const |
| TElement * | last () const |
| BidiList & | operator= (BidiList &&) noexcept=default |
| BidiList & | operator= (const BidiList &)=delete |
| TElement * | popEnd () |
| TElement * | popFront () |
| void | pushEnd (TElement *elem) |
| void | pushEnd (TElement *first, TElement *last) |
| void | pushFront (TElement *elem) |
| void | pushFront (TElement *first, TElement *last) |
| ReverseIterator | rbegin () |
| ConstReverseIterator | rbegin () const |
| ReverseIterator | rend () |
| ConstReverseIterator | rend () const |
| void | reset () |
| TElement * | stopper () const |
Additional Inherited Members | |
Private Static Methods inherited from ForwardNode< TElement > | |
| static integer | count (TElement *start, TElement *end=nullptr) |
| static void | moveForward (TElement *&pointer) |
| static TElement * | moveForward (TNode *&pointer) |
Private Methods inherited from BidiNode< TElement > | |
| BidiNode () noexcept=default | |
| BidiNode (const TNode &)=delete | |
| BidiNode (TElement *next, TElement *previous) noexcept | |
| BidiNode (TNode &&) noexcept=default | |
| void | addBefore (TElement *elem) |
| void | addBefore (TElement *first, TElement *last) |
| void | addBehind (TElement *elem) |
| void | addBehind (TElement *first, TElement *last) |
| TElement * | next () const |
| BidiNode & | operator= (const TNode &)=delete |
| BidiNode & | operator= (TNode &&) noexcept=default |
| TElement * | prev () const |
| void | remove () |
| void | remove (TElement *last) |
| TElement * | self () |
Private Methods inherited from ForwardNode< TElement > | |
| ForwardNode () noexcept=default | |
| ForwardNode (const TNode &)=delete | |
| ForwardNode (TElement *next) noexcept | |
| ForwardNode (TNode &&) noexcept=default | |
| TElement * | addBehind (TElement *elem) |
| TElement * | addBehind (TElement *first, TElement *last) |
| Iterator | begin () |
| ConstIterator | begin () const |
| ConstIterator | cbegin () const |
| ConstIterator | cend () const |
| Iterator | end () |
| ConstIterator | end () const |
| bool | hasNext () const |
| bool | isLast () const |
| TElement * | makeLast () |
| TElement * | makePointTo (TElement *elem) |
| TElement * | next () const |
| ForwardNode & | operator= (const TNode &)=delete |
| ForwardNode & | operator= (TNode &&) noexcept=default |
| bool | pointsTo (TElement *elem) const |
| TElement * | removeNext () |
| TElement * | removeRangeBehind (TElement *last) |
Private Types inherited from BidiNode< TElement > | |
| using | TFNode = ForwardNode< TElement > |
| using | TNode = BidiNode< TElement > |
Private Types inherited from ForwardNode< TElement > | |
| using | ConstIterator = ForwardListIterator< const TElement > |
| using | Iterator = ForwardListIterator< TElement > |
| using | TNode = ForwardNode< TElement > |
| using ConstIterator = BidiListIterator<const TElement> |
The constant iterator type.
Definition at line 561 of file bidilist.hpp.
| using ConstReverseIterator = std::reverse_iterator<ConstIterator> |
The constant reverse iterator type.
Definition at line 567 of file bidilist.hpp.
| using Iterator = BidiListIterator< TElement> |
The mutable iterator type.
Definition at line 558 of file bidilist.hpp.
| using ReverseIterator = std::reverse_iterator< Iterator> |
The mutable reverse iterator type.
Definition at line 564 of file bidilist.hpp.
| using TFNode = ForwardNode<TElement> |
An alias for the base type of the node type of this list.
Definition at line 343 of file bidilist.hpp.
An alias for the node type of this list, which is also the type this struct is derived from.
Definition at line 347 of file bidilist.hpp.
|
inlinenoexcept |
Default constructor. Initializes this list to be empty.
Definition at line 350 of file bidilist.hpp.
Defaulted move constructor.
| move | The list to move. |
Definition at line 362 of file bidilist.hpp.
|
inline |
Constructor accepting a pointer to the first element.
| first | The element to use as the first element of this list. |
Definition at line 388 of file bidilist.hpp.
|
inline |
Constructor accepting a pointer to the first and last element.
| first | The element to use as the first element of this list. |
| last | The element to use as the last element of this list. |
Definition at line 399 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a mutable element at the start of this list.
Definition at line 573 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant element at the start of this list.
Definition at line 581 of file bidilist.hpp.
|
inline |
Casts this list to the node type. This method is needed because this list type inherits the node type privately.
this, which performs the static cast. If this type inherited BidiNode publically, a simple ampersand operator (&) could be used on a value of this type instead of invoking this method.Definition at line 417 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant element at the start of this list.
Definition at line 589 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant, non-existing element.
Definition at line 593 of file bidilist.hpp.
|
inline |
Counts the number of elements found in the range starting with this list's first element and ending with the element before end.
| end | The element after the last one to count. Defaults to a nullptr marking the end of the list. |
Definition at line 541 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant element at the start of this list.
Definition at line 613 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant, non-existing element.
Definition at line 617 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a mutable, non-existing element.
Definition at line 577 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant, non-existing element.
Definition at line 585 of file bidilist.hpp.
|
inline |
Returns the first element of this list.
Definition at line 445 of file bidilist.hpp.
|
inline |
Tests if this list is empty.
false if the list is empty, true otherwise. Definition at line 424 of file bidilist.hpp.
|
inline |
Tests if given elem is the first element of this list.
| elem | The element to test for being the first. |
true if elem is the first element of this list, false otherwise. Definition at line 460 of file bidilist.hpp.
|
inline |
Tests if given elem is the last element of this list.
| elem | The element to test for being the last. |
true if elem is the last element of this list, false otherwise. Definition at line 468 of file bidilist.hpp.
|
inline |
Tests if this list is not empty.
true if the list is empty, false otherwise. Definition at line 431 of file bidilist.hpp.
|
inline |
Returns the last element of this list.
Definition at line 452 of file bidilist.hpp.
Defaulted move assignment operator.
Deleted copy assignment operator.
|
inline |
Removes and returns the last element from this list. Must not be invoked on empty lists.
Definition at line 528 of file bidilist.hpp.
|
inline |
Removes and returns the first element from this list. Must not be invoked on empty lists.
Definition at line 518 of file bidilist.hpp.
|
inline |
Hooks the given element to the beginning of this list.
| elem | The element to insert to at the start. |
Definition at line 501 of file bidilist.hpp.
|
inline |
Hooks the given range of elements to the front of this list.
| first | The first element of the range to insert. |
| last | The last element of the range to insert. |
Definition at line 509 of file bidilist.hpp.
|
inline |
Hooks the given element to the beginning of this list.
| elem | The element to insert to at the start. |
Definition at line 485 of file bidilist.hpp.
|
inline |
Hooks the given range of elements to the front of this list.
| first | The first element of the range to insert. |
| last | The last element of the range to insert. |
Definition at line 494 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a mutable element at the start of this list.
Definition at line 597 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant element at the start of this list.
Definition at line 605 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a mutable, non-existing element.
Definition at line 601 of file bidilist.hpp.
|
inline |
Returns an iterator referring to a constant, non-existing element.
Definition at line 609 of file bidilist.hpp.
|
inline |
Resets this list to zero elements.
Definition at line 437 of file bidilist.hpp.
|
inline |
Returns an "illegal" stopper element. This is illegal in respect to that it must not be dereferenced, as in fact the returned object is a node, but not an element including the custom value.
Definition at line 477 of file bidilist.hpp.