A class for doubly linked lists.
More...
#include <AH/Containers/LinkedList.hpp>
template<class Node>
class DoublyLinkedList< Node >
A class for doubly linked lists.
- Template Parameters
-
Node | The type of the nodes of the list. |
Definition at line 25 of file LinkedList.hpp.
◆ iterator
◆ const_iterator
◆ reverse_iterator
◆ const_reverse_iterator
◆ append() [1/2]
void append |
( |
Node * |
node | ) |
|
|
inline |
Append a node to a linked list.
- Parameters
-
node | A pointer to the node to be appended. |
Definition at line 115 of file LinkedList.hpp.
◆ append() [2/2]
void append |
( |
Node & |
node | ) |
|
|
inline |
Append a node to a linked list.
- Parameters
-
node | A reference to the node to be appended. |
Definition at line 131 of file LinkedList.hpp.
◆ insertBefore() [1/2]
void insertBefore |
( |
Node * |
toBeInserted, |
|
|
Node * |
before |
|
) |
| |
|
inline |
Insert a node before another node.
- Parameters
-
toBeInserted | The new node to be inserted. |
before | The node to insert the new node before. It must be in the list already. |
Definition at line 142 of file LinkedList.hpp.
◆ insertBefore() [2/2]
void insertBefore |
( |
Node & |
toBeInserted, |
|
|
Node & |
before |
|
) |
| |
|
inline |
◆ insertSorted() [1/2]
void insertSorted |
( |
Node * |
node, |
|
|
Compare |
cmp |
|
) |
| |
|
inline |
Insert a new node at the correct location into a sorted list.
- Parameters
-
node | The new node to be inserted. |
cmp | The function to order the nodes. |
- Template Parameters
-
Compare | A functor that compares two Nodes and returns a boolean. |
Definition at line 168 of file LinkedList.hpp.
◆ insertSorted() [2/2]
void insertSorted |
( |
Node * |
node | ) |
|
|
inline |
Insert a new node at the correct location into a sorted list, using operator<
.
- Parameters
-
node | The new node to be inserted. |
Definition at line 188 of file LinkedList.hpp.
◆ remove() [1/2]
void remove |
( |
Node * |
node | ) |
|
|
inline |
Remove a node from the linked list.
- Parameters
-
node | A pointer to the node to be removed. |
Definition at line 198 of file LinkedList.hpp.
◆ remove() [2/2]
void remove |
( |
Node & |
node | ) |
|
|
inline |
Remove a node from the linked list.
- Parameters
-
node | A reference to the node to be removed. |
Definition at line 217 of file LinkedList.hpp.
◆ moveDown() [1/2]
void moveDown |
( |
Node * |
node | ) |
|
|
inline |
Move down the given node in the linked list.
For example: moving down node C
:
Before: ... →
A →
B →
C →
D → ...
After: ... →
A →
C →
B →
D → ...
- Parameters
-
node | A pointer to the node to be moved down. |
Definition at line 230 of file LinkedList.hpp.
◆ moveDown() [2/2]
void moveDown |
( |
Node & |
node | ) |
|
|
inline |
Move down the given node in the linked list.
For example: moving down node C
:
Before: ... →
A →
B →
C →
D → ...
After: ... →
A →
C →
B →
D → ...
- Parameters
-
node | A reference to the node to be moved down. |
Definition at line 262 of file LinkedList.hpp.
◆ couldContain() [1/2]
bool couldContain |
( |
const Node * |
node | ) |
const |
|
inline |
Check if the linked list could contain the given node.
- Return values
-
true | The given node is part of some linked list or it is the first node of the given linked list.
It could be that the node is part of a different linked list if it was ever added to a different list. However, if this function returns true and the node was never added to another linked list, it means that this linked list contains the given node. |
false | The given node is not part of any linked list, or it is the only element of a different linked list. |
Definition at line 281 of file LinkedList.hpp.
◆ couldContain() [2/2]
bool couldContain |
( |
const Node & |
node | ) |
const |
|
inline |
Check if the linked list could contain the given node.
- Return values
-
true | The given node is part of some linked list or it is the first node of the given linked list.
It could be that the node is part of a different linked list if it was ever added to a different list. However, if this function returns true and the node was never added to another linked list, it means that this linked list contains the given node. |
false | The given node is not part of any linked list, or it is the only element of a different linked list. |
Definition at line 287 of file LinkedList.hpp.
◆ begin() [1/2]
◆ end() [1/2]
◆ begin() [2/2]
◆ end() [2/2]
◆ rbegin() [1/2]
◆ rend() [1/2]
◆ rbegin() [2/2]
◆ rend() [2/2]
◆ getFirst()
◆ getLast()
◆ first
◆ last
The documentation for this class was generated from the following file: