2#include "gaia/config/config.h"
4#include "gaia/core/iterator.h"
86 auto&
list = m_pNode->get_fwd_llist_link();
102 return m_pNode == other.m_pNode;
108 return m_pNode != other.m_pNode;
133 GAIA_ASSERT(
pNode !=
nullptr);
135 auto&
link =
pNode->get_fwd_llist_link();
137 if (
first !=
nullptr) {
151 GAIA_ASSERT(
pNode !=
nullptr);
153 auto&
link =
pNode->get_fwd_llist_link();
155 if (
link.next !=
nullptr) {
170 GAIA_ASSERT(
pNode !=
nullptr);
172 for (
auto&
curr: *
this) {
183 GAIA_ASSERT(
count == 0);
184 return first ==
nullptr;
Array with variable size of elements of type.
Definition darray_impl.h:27
Each fwd_llist node either has to inherit from fwd_llist_base or it has to provide get_fwd_llist_link...
Definition fwd_llist.h:29
fwd_llist_link< T > & get_fwd_llist_link()
Returns the mutable intrusive link.
Definition fwd_llist.h:35
const fwd_llist_link< T > & get_fwd_llist_link() const
Returns the immutable intrusive link.
Definition fwd_llist.h:40
fwd_llist_link< T > fwd_link_GAIA
Intrusive link storage used by fwd_llist.
Definition fwd_llist.h:31
Forward iterator over an intrusive fwd_llist.
Definition fwd_llist.h:48
iterator operator++(int)
Advances to the next linked node.
Definition fwd_llist.h:92
GAIA_NODISCARD bool operator==(const iterator &other) const
Compares iterator positions.
Definition fwd_llist.h:101
GAIA_NODISCARD bool operator!=(const iterator &other) const
Compares iterator positions.
Definition fwd_llist.h:107
fwd_llist_iterator(T *pNode)
Constructs an iterator at a node.
Definition fwd_llist.h:70
reference operator*() const
Dereferences the current node.
Definition fwd_llist.h:74
pointer operator->() const
Accesses the current node.
Definition fwd_llist.h:79
iterator & operator++()
Advances to the next linked node.
Definition fwd_llist.h:85
Intrusive links maintained for one forward-list node.
Definition fwd_llist.h:11
GAIA_NODISCARD bool linked() const
Returns true if the node is linked with another.
Definition fwd_llist.h:21
T ** prevs_next
Pointer to the memory address of the previous node's "next". This is not meant for traversal....
Definition fwd_llist.h:17
T * next
Pointer the the next element.
Definition fwd_llist.h:13
Forward list container. No memory allocation is performed because the list is stored directly inside ...
Definition fwd_llist.h:118
GAIA_NODISCARD bool empty() const
Returns true if the list is empty. False otherwise.
Definition fwd_llist.h:182
void link(T *pNode)
Links the node in the list.
Definition fwd_llist.h:132
fwd_llist_iterator< const T > cbegin() const
Returns an iterator to the first node.
Definition fwd_llist.h:207
T * first
First linked node, or nullptr when empty.
Definition fwd_llist.h:122
GAIA_NODISCARD uint32_t size() const
Returns the number of nodes linked in the list.
Definition fwd_llist.h:189
GAIA_NODISCARD bool has(T *pNode) const
Checks whether a node is linked in this list.
Definition fwd_llist.h:169
fwd_llist_iterator< const T > begin() const
Returns an iterator to the first node.
Definition fwd_llist.h:201
fwd_llist_iterator< const T > cend() const
Returns the const end sentinel.
Definition fwd_llist.h:225
void unlink(T *pNode)
Unlinks the node from the list.
Definition fwd_llist.h:150
fwd_llist_iterator< T > begin()
Returns an iterator to the first node.
Definition fwd_llist.h:195
uint32_t count
Number of linked nodes.
Definition fwd_llist.h:120
fwd_llist_iterator< T > end()
Returns the mutable end sentinel.
Definition fwd_llist.h:213
fwd_llist_iterator< const T > end() const
Returns the const end sentinel.
Definition fwd_llist.h:219
void clear()
Clears the list.
Definition fwd_llist.h:125