template<typename TElement>
struct alib::lang::BidiListHook< TElement >
This struct, together with sibling struct lang::BidiNodeBase provide the tools to implement a doubly linked list of TElement instances.
Template type TElement has to extend struct BidiNodeBase<TElement>.
- See also
- Types lang::SidiNodeBase,
lang::SidiListHook, and
lang::BidiNodeBase.
- Template Parameters
-
Definition at line 129 of file bidilist.inl.
|
TNode | hook |
| The root node. Points twice to itself when the list is empty.
|
|
◆ TFNode
template<typename TElement>
An alias for the base type of the node type of this list.
Definition at line 132 of file bidilist.inl.
◆ TNode
template<typename TElement>
An alias for the node type of this list.
Definition at line 135 of file bidilist.inl.
◆ hook
template<typename TElement>
The root node. Points twice to itself when the list is empty.
Definition at line 138 of file bidilist.inl.
◆ BidiListHook() [1/4]
template<typename TElement>
Default constructor. Initializes this list to be empty.
Definition at line 141 of file bidilist.inl.
◆ BidiListHook() [2/4]
template<typename TElement>
Move constructor. Takes elements of move
and sets move
to empty.
- Parameters
-
Definition at line 152 of file bidilist.inl.
◆ BidiListHook() [3/4]
template<typename TElement>
Constructor accepting a pointer to the first element.
- Parameters
-
first | The element to use as the first element of this list. |
Definition at line 174 of file bidilist.inl.
◆ BidiListHook() [4/4]
template<typename TElement>
Constructor accepting a pointer to the first and last element.
- Parameters
-
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 185 of file bidilist.inl.
◆ count()
template<typename TElement>
Counts the number of elements found in the range starting with this list's first element and ending with the element before end.
- Parameters
-
end | The element after the last one to count. Defaults to a nullptr marking the end of the list. |
- Returns
- The number of elements in the range.
Definition at line 271 of file bidilist.inl.
◆ end()
template<typename TElement>
Returns a pointer to the hook node cast to a pointer to a mutable element. This method must only be used in cases where such conversion is allowed i.e., with iterator types that use this pointer exclusively for pointer value comparison but do not allow (by contract) to dereference or otherwise use this pointer.
- Returns
- The first element of this list.
Definition at line 206 of file bidilist.inl.
◆ first()
template<typename TElement>
Returns the first element of this list.
- Returns
- The first element of this list.
Definition at line 213 of file bidilist.inl.
◆ isEmpty()
template<typename TElement>
Tests if this list is empty.
- Returns
false
if the list is empty, true
otherwise.
Definition at line 196 of file bidilist.inl.
◆ isFirst()
template<typename TElement>
Tests if given elem is the first element of this list.
- Parameters
-
elem | The element to test for being the first. |
- Returns
true
if elem is the first element of this list, false
otherwise.
Definition at line 224 of file bidilist.inl.
◆ isLast()
template<typename TElement>
Tests if given elem is the last element of this list.
- Parameters
-
elem | The element to test for being the last. |
- Returns
true
if elem is the last element of this list, false
otherwise.
Definition at line 230 of file bidilist.inl.
◆ last()
template<typename TElement>
Returns the last element of this list.
- Returns
- The last element of this list.
Definition at line 218 of file bidilist.inl.
◆ operator=() [1/2]
template<typename TElement>
Defaulted move assignment operator.
- Returns
- A reference to this list object.
◆ operator=() [2/2]
template<typename TElement>
Deleted copy assignment operator.
- Returns
- A reference to this list object.
◆ popEnd()
template<typename TElement>
Removes and returns the last element from this list. Must not be invoked on empty lists.
- Returns
- A pointer to the last element (which was removed).
Definition at line 258 of file bidilist.inl.
◆ popFront()
template<typename TElement>
Removes and returns the first element from this list. Must not be invoked on empty lists.
- Returns
- A pointer to the first element (which was removed).
Definition at line 253 of file bidilist.inl.
◆ pushEnd() [1/2]
template<typename TElement>
Hooks the given element to the end of this list.
- Parameters
-
elem | The element to insert to at the start. |
Definition at line 243 of file bidilist.inl.
◆ pushEnd() [2/2]
template<typename TElement>
Hooks the given range of elements to the end of this list.
- Parameters
-
first | The first element of the range to insert. |
last | The last element of the range to insert. |
Definition at line 248 of file bidilist.inl.
◆ pushFront() [1/2]
template<typename TElement>
Hooks the given element to the beginning of this list.
- Parameters
-
elem | The element to insert to at the start. |
Definition at line 234 of file bidilist.inl.
◆ pushFront() [2/2]
template<typename TElement>
Hooks the given range of elements to the front of this list.
- Parameters
-
first | The first element of the range to insert. |
last | The last element of the range to insert. |
Definition at line 239 of file bidilist.inl.
◆ reset()
template<typename TElement>
Resets this list to zero elements.
Definition at line 199 of file bidilist.inl.
The documentation for this struct was generated from the following file: