A class for doubly linked lists. More...
#include <LinkedList.hpp>
Classes | |
class | node_iterator |
Forward bidirectional doubly linked list iterator. More... | |
class | node_iterator_base |
Base class for doubly linked list iterators. More... | |
class | reverse_node_iterator |
Reverse bidirectional doubly linked list iterator. More... | |
Public Types | |
using | iterator = node_iterator< Node > |
using | const_iterator = node_iterator< const Node > |
using | reverse_iterator = reverse_node_iterator< Node > |
using | const_reverse_iterator = reverse_node_iterator< const Node > |
Public Member Functions | |
void | append (Node *node) |
Append a node to a linked list. More... | |
void | append (Node &node) |
Append a node to a linked list. More... | |
void | insertBefore (Node *toBeInserted, Node *before) |
Insert a node before another node. More... | |
void | insertBefore (Node &toBeInserted, Node &before) |
template<class Compare > | |
void | insertSorted (Node *node, Compare cmp) |
Insert a new node at the correct location into a sorted list. More... | |
void | insertSorted (Node *node) |
Insert a new node at the correct location into a sorted list, using operator< . More... | |
void | remove (Node *node) |
Remove a node from the linked list. More... | |
void | remove (Node &node) |
Remove a node from the linked list. More... | |
void | moveDown (Node *node) |
Move down the given node in the linked list. More... | |
bool | couldContain (Node *node) |
Check if the linked list could contain the given node. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
Node * | getFirst () const |
Get a pointer to the first node. More... | |
Node * | getLast () const |
Get a pointer to the last node. More... | |
Private Attributes | |
Node * | first = nullptr |
Node * | last = nullptr |
A class for doubly linked lists.
Node | The type of the nodes of the list. |
Definition at line 27 of file LinkedList.hpp.
using DoublyLinkedList< Node >::iterator = node_iterator<Node> |
Definition at line 106 of file LinkedList.hpp.
using DoublyLinkedList< Node >::const_iterator = node_iterator<const Node> |
Definition at line 107 of file LinkedList.hpp.
using DoublyLinkedList< Node >::reverse_iterator = reverse_node_iterator<Node> |
Definition at line 108 of file LinkedList.hpp.
using DoublyLinkedList< Node >::const_reverse_iterator = reverse_node_iterator<const Node> |
Definition at line 109 of file LinkedList.hpp.
|
inline |
Append a node to a linked list.
node | A pointer to the node to be appended. |
Definition at line 117 of file LinkedList.hpp.
|
inline |
Append a node to a linked list.
node | A reference to the node to be appended. |
Definition at line 133 of file LinkedList.hpp.
|
inline |
Insert a node before another node.
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 144 of file LinkedList.hpp.
|
inline |
Definition at line 155 of file LinkedList.hpp.
|
inline |
Insert a new node at the correct location into a sorted list.
node | The new node to be inserted. |
cmp | The function to order the nodes. |
Compare | A functor that compares two Nodes and returns a boolean. |
Definition at line 170 of file LinkedList.hpp.
|
inline |
Insert a new node at the correct location into a sorted list, using operator<
.
node | The new node to be inserted. |
Definition at line 190 of file LinkedList.hpp.
|
inline |
Remove a node from the linked list.
node | A pointer to the node to be removed. |
Definition at line 200 of file LinkedList.hpp.
|
inline |
Remove a node from the linked list.
node | A reference to the node to be removed. |
Definition at line 219 of file LinkedList.hpp.
|
inline |
|
inline |
Check if the linked list could contain the given node.
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 268 of file LinkedList.hpp.
|
inline |
Definition at line 273 of file LinkedList.hpp.
|
inline |
Definition at line 274 of file LinkedList.hpp.
|
inline |
Definition at line 276 of file LinkedList.hpp.
|
inline |
Definition at line 277 of file LinkedList.hpp.
|
inline |
Definition at line 279 of file LinkedList.hpp.
|
inline |
Definition at line 280 of file LinkedList.hpp.
|
inline |
Definition at line 282 of file LinkedList.hpp.
|
inline |
Definition at line 283 of file LinkedList.hpp.
|
inline |
Get a pointer to the first node.
Definition at line 286 of file LinkedList.hpp.
|
inline |
Get a pointer to the last node.
Definition at line 288 of file LinkedList.hpp.
|
private |
Definition at line 291 of file LinkedList.hpp.
|
private |
Definition at line 292 of file LinkedList.hpp.