9#include <AH/STL/iterator>
24 template <
class INode>
34 return !(*
this !=
rhs);
52 template <
class INode>
79 template <
class INode>
117 if (
first ==
nullptr)
119 node->previous =
last;
120 if (node->previous !=
nullptr)
121 node->previous->next = node;
123 node->next =
nullptr;
168 template <
class Compare>
173 if (
cmp(*node, *
it)) {
200 if (node->previous !=
nullptr)
201 node->previous->next = node->next;
203 last = node->previous;
204 if (node->next !=
nullptr)
205 node->next->previous = node->previous;
208 node->previous =
nullptr;
209 node->next =
nullptr;
233 if (
nodeB ==
nullptr)
238 if (
nodeA !=
nullptr)
243 nodeB->previous = node;
245 node->previous =
nodeA;
246 if (
nodeD !=
nullptr)
281 return node && (node ==
first || node->next !=
nullptr ||
282 node->previous !=
nullptr);
A class that can be inherited from to allow inserting into a DoublyLinkedList.
DoublyLinkable & operator=(const DoublyLinkable &)
virtual ~DoublyLinkable()=default
DoublyLinkable & operator=(DoublyLinkable &&)
DoublyLinkable(const DoublyLinkable &)
DoublyLinkable(DoublyLinkable &&)
Base class for doubly linked list iterators.
bool operator==(const node_iterator_base &rhs) const
INode & operator*() const
bool operator!=(const node_iterator_base &rhs) const
node_iterator_base(INode *node)
INode * operator->() const
Forward bidirectional doubly linked list iterator.
std::bidirectional_iterator_tag iterator_category
node_iterator & operator--()
Prefix decrement operator.
node_iterator & operator++()
Prefix increment operator.
node_iterator(INode *node)
Reverse bidirectional doubly linked list iterator.
reverse_node_iterator & operator++()
Prefix increment operator.
std::bidirectional_iterator_tag iterator_category
reverse_node_iterator & operator--()
Prefix decrement operator.
reverse_node_iterator(INode *node)
A class for doubly linked lists.
const_reverse_iterator rend() const
const_iterator begin() const
void append(Node *node)
Append a node to a linked list.
bool couldContain(const Node *node) const
Check if the linked list could contain the given node.
void remove(Node *node)
Remove a node from the linked list.
bool couldContain(const Node &node) const
Check if the linked list could contain the given node.
Node * getLast() const
Get a pointer to the last node.
void moveDown(Node &node)
Move down the given node in the linked list.
Node * getFirst() const
Get a pointer to the first node.
void append(Node &node)
Append a node to a linked list.
void moveDown(Node *node)
Move down the given node in the linked list.
void remove(Node &node)
Remove a node from the linked list.
void insertSorted(Node *node)
Insert a new node at the correct location into a sorted list, using operator<.
const_iterator end() const
reverse_iterator rbegin()
void insertBefore(Node *toBeInserted, Node *before)
Insert a node before another node.
void insertSorted(Node *node, Compare cmp)
Insert a new node at the correct location into a sorted list.
void insertBefore(Node &toBeInserted, Node &before)
const_reverse_iterator rbegin() const
Array< T, N > copyAs(const Array< U, N > &src)
Copy an Array to an Array of a different type.