2#include "gaia/config/config.h"
4#include "gaia/core/iterator.h"
43 using difference_type = uint32_t;
44 using size_type = uint32_t;
53 reference operator*()
const {
56 pointer operator->()
const {
61 auto& list = m_pNode->get_fwd_llist_link();
71 GAIA_NODISCARD
bool operator==(
const iterator& other)
const {
72 return m_pNode == other.m_pNode;
74 GAIA_NODISCARD
bool operator!=(
const iterator& other)
const {
75 return m_pNode != other.m_pNode;
97 GAIA_ASSERT(pNode !=
nullptr);
99 auto&
link = pNode->get_fwd_llist_link();
101 if (first !=
nullptr) {
102 auto& linkFirst = first->get_fwd_llist_link();
103 linkFirst.prevs_next = &(
link.next);
106 link.prevs_next = &first;
114 GAIA_ASSERT(pNode !=
nullptr);
116 auto&
link = pNode->get_fwd_llist_link();
118 if (
link.next !=
nullptr) {
119 auto& linkNext =
link.next->get_fwd_llist_link();
120 linkNext.prevs_next =
link.prevs_next;
130 GAIA_NODISCARD
bool has(T* pNode)
const {
131 GAIA_ASSERT(pNode !=
nullptr);
133 for (
auto& curr: *
this) {
143 GAIA_ASSERT(count == 0);
144 return first ==
nullptr;
148 GAIA_NODISCARD uint32_t
size()
const {
156 fwd_llist_iterator<const T> begin()
const {
157 return fwd_llist_iterator((
const T*)first);
160 fwd_llist_iterator<const T> cbegin()
const {
161 return fwd_llist_iterator((
const T*)first);
164 fwd_llist_iterator<T> end() {
165 return fwd_llist_iterator<T>(
nullptr);
168 fwd_llist_iterator<const T> end()
const {
169 return fwd_llist_iterator((
const T*)
nullptr);
172 fwd_llist_iterator<const T> cend()
const {
173 return fwd_llist_iterator((
const T*)
nullptr);
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9
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:26
Definition fwd_llist.h:38
GAIA_NODISCARD bool linked() const
Returns true if the node is linked with another.
Definition fwd_llist.h:18
T ** prevs_next
Pointer to the memory address of the previous node's "next". This is not meant for traversal....
Definition fwd_llist.h:15
T * next
Pointer the the next element.
Definition fwd_llist.h:11
Forward list container. No memory allocation is performed because the list is stored directly inside ...
Definition fwd_llist.h:85
GAIA_NODISCARD bool empty() const
Returns true if the list is empty. False otherwise.
Definition fwd_llist.h:142
void link(T *pNode)
Links the node in the list.
Definition fwd_llist.h:96
GAIA_NODISCARD uint32_t size() const
Returns the number of nodes linked in the list.
Definition fwd_llist.h:148
GAIA_NODISCARD bool has(T *pNode) const
Checks if the node.
Definition fwd_llist.h:130
void unlink(T *pNode)
Unlinks the node from the list.
Definition fwd_llist.h:113
void clear()
Clears the list.
Definition fwd_llist.h:90