12 #ifndef ESTD_INTRUSIVEFORWARDLIST_HPP_ 13 #define ESTD_INTRUSIVEFORWARDLIST_HPP_ 25 class IntrusiveForwardListBase;
281 while (
empty() ==
false)
386 const auto splicedNode = beforeSplicedNode->
getNextNode();
427 template<
typename T, IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
476 node_{&(element.*NodePointer)}
478 static_assert(std::is_same<U, T>::value ==
true || std::is_convertible<U*, T*>::value ==
true,
479 "U* must be implicitly convertible to T*!");
524 const auto temporary = *
this;
552 static_assert(std::is_same<U, T>::value ==
true || std::is_convertible<U*, T*>::value ==
true,
553 "U* must be implicitly convertible to T*!");
555 const auto offset = reinterpret_cast<size_t>(&(static_cast<pointer>(
nullptr)->*NodePointer));
556 return reinterpret_cast<pointer>(reinterpret_cast<size_t>(
node_) - offset);
577 template<
typename T, IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
581 return (left == right) ==
false;
595 template<
typename T, const IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
645 node_{&(element.*NodePointer)}
647 static_assert(std::is_same<U, T>::value ==
true || std::is_convertible<U*, T*>::value ==
true,
648 "U* must be implicitly convertible to T*!");
661 template<IntrusiveForwardListNode T::* NonConstNodePo
inter>
711 const auto temporary = *
this;
740 static_assert(std::is_same<U, T>::value ==
true || std::is_convertible<U*, T*>::value ==
true,
741 "U* must be implicitly convertible to T*!");
743 const auto offset = reinterpret_cast<size_t>(&(static_cast<pointer>(
nullptr)->*NodePointer));
744 return reinterpret_cast<pointer>(reinterpret_cast<size_t>(
node_) - offset);
765 template<
typename T, const IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
769 return (left == right) ==
false;
787 template<
typename T, IntrusiveForwardListNode T::* NodePointer,
const IntrusiveForwardListNode T::* ConstNodePointer,
792 return decltype(right){left} == right;
810 template<
typename T, IntrusiveForwardListNode T::* NodePointer,
const IntrusiveForwardListNode T::* ConstNodePointer,
815 return (left == right) ==
false;
833 template<
typename T, IntrusiveForwardListNode T::* NodePointer,
const IntrusiveForwardListNode T::* ConstNodePointer,
838 return right != left;
854 template<
typename T, IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
1050 auto& positionNode = (*position).*NodePointer;
1068 static_assert(std::is_same<U, T>::value ==
true || std::is_convertible<U*, T*>::value ==
true,
1069 "U* must be implicitly convertible to T*!");
1071 auto& positionNode = (*position).*NodePointer;
1072 auto& newElementNode = newElement.*NodePointer;
1089 auto& positionNode = (*position).*NodePointer;
1090 auto& beforeSplicedElementNode = (*beforeSplicedElement).*NodePointer;
1117 template<
typename T, IntrusiveForwardListNode T::* NodePo
inter,
typename U = T>
1125 #endif // ESTD_INTRUSIVEFORWARDLIST_HPP_ Collection of useful templates.
Definition: DmaChannel.hpp:121
constexpr IntrusiveForwardListConstIterator(const IntrusiveForwardListNode *const node)
IntrusiveForwardListConstIterator's constructor.
Definition: IntrusiveForwardList.hpp:632
static void splice_after(IntrusiveForwardListNode *const position, IntrusiveForwardListNode *const beforeSplicedNode)
Transfers the node from one list to another list after position.
Definition: IntrusiveForwardList.hpp:383
std::forward_iterator_tag iterator_category
category of the iterator
Definition: IntrusiveForwardList.hpp:604
QueueNode & reference
reference to value linked in the list
Definition: IntrusiveForwardList.hpp:875
const_reference front() const
Definition: IntrusiveForwardList.hpp:1002
Definition: IntrusiveForwardList.hpp:44
ptrdiff_t difference_type
difference type
Definition: IntrusiveForwardList.hpp:433
bool operator==(const IntrusiveForwardListIterator &other) const
IntrusiveForwardListIterator's "equal to" comparison operator.
Definition: IntrusiveForwardList.hpp:537
IntrusiveForwardListNode * before_begin()
Definition: IntrusiveForwardList.hpp:216
constexpr IntrusiveForwardListConstIterator()
IntrusiveForwardListConstIterator's constructor.
Definition: IntrusiveForwardList.hpp:619
const_iterator before_begin() const
Definition: IntrusiveForwardList.hpp:903
bool empty() const
Definition: IntrusiveForwardList.hpp:289
const IntrusiveForwardListNode * cend() const
Definition: IntrusiveForwardList.hpp:270
U & reference
reference to object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:442
void push_front(reference newElement)
Links the element at the beginning of the list.
Definition: IntrusiveForwardList.hpp:1022
constexpr IntrusiveForwardListConstIterator(const IntrusiveForwardListIterator< T, NonConstNodePointer, U > &iterator)
IntrusiveForwardListConstIterator's constructor.
Definition: IntrusiveForwardList.hpp:663
IntrusiveForwardListIterator class is an iterator of elements on IntrusiveForwardList.
Definition: IntrusiveForwardList.hpp:428
const U * pointer
pointer to object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:607
void swap(IntrusiveForwardList< T, NodePointer, U > &left, IntrusiveForwardList< T, NodePointer, U > &right)
Swaps contents of two lists.
Definition: IntrusiveForwardList.hpp:1118
IntrusiveForwardList class is an intrusive linear singly linked list.
Definition: IntrusiveForwardList.hpp:855
IntrusiveForwardListNode rootNode_
root node of the intrusive forward list
Definition: IntrusiveForwardList.hpp:399
IntrusiveForwardListBase class provides base functionalities for IntrusiveForwardList class,...
Definition: IntrusiveForwardList.hpp:187
const IntrusiveForwardListNode * before_begin() const
Definition: IntrusiveForwardList.hpp:225
static iterator insert_after(const iterator position, reference newElement)
Links the element in the list after position.
Definition: IntrusiveForwardList.hpp:1066
IntrusiveForwardListConstIterator operator++(int)
IntrusiveForwardListConstIterator's unary postfix increment operator.
Definition: IntrusiveForwardList.hpp:709
const QueueNode & const_reference
const reference to value linked in the list
Definition: IntrusiveForwardList.hpp:866
reference operator *() const
IntrusiveForwardListIterator's unary prefix dereference operator.
Definition: IntrusiveForwardList.hpp:499
pointer getPointer() const
Converts contained pointer to IntrusiveForwardListNode to pointer to object that contains this node.
Definition: IntrusiveForwardList.hpp:738
IntrusiveForwardListConstIterator class is a const iterator of elements on IntrusiveForwardList.
Definition: IntrusiveForwardList.hpp:596
U * pointer
pointer to object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:439
iterator before_begin()
Definition: IntrusiveForwardList.hpp:894
bool operator!=(const IntrusiveForwardListIterator< T, NodePointer, U > &left, const IntrusiveForwardListIterator< T, NodePointer, U > &right)
IntrusiveForwardListIterator's "not equal to" comparison operator.
Definition: IntrusiveForwardList.hpp:578
IntrusiveForwardListNode class is the node that is needed for the object to be linked in IntrusiveFor...
Definition: IntrusiveForwardList.hpp:38
pointer operator->() const
IntrusiveForwardListConstIterator's binary infix pointer member access operator.
Definition: IntrusiveForwardList.hpp:675
const_iterator begin() const
Definition: IntrusiveForwardList.hpp:921
const IntrusiveForwardListNode * begin() const
Definition: IntrusiveForwardList.hpp:243
pointer getPointer() const
Converts contained pointer to IntrusiveForwardListNode to pointer to object that contains this node.
Definition: IntrusiveForwardList.hpp:550
const_iterator cbefore_begin() const
Definition: IntrusiveForwardList.hpp:930
constexpr IntrusiveForwardListNode()
IntrusiveForwardListNode's constructor.
Definition: IntrusiveForwardList.hpp:67
const IntrusiveForwardListNode * end() const
Definition: IntrusiveForwardList.hpp:307
reference front()
Definition: IntrusiveForwardList.hpp:993
IntrusiveForwardListConstIterator & operator++()
IntrusiveForwardListConstIterator's unary prefix increment operator.
Definition: IntrusiveForwardList.hpp:697
constexpr IntrusiveForwardListBase()
IntrusiveForwardListBase's constructor.
Definition: IntrusiveForwardList.hpp:195
void pop_front()
Unlinks the first node from the list.
Definition: IntrusiveForwardList.hpp:316
constexpr IntrusiveForwardList()
IntrusiveForwardList's constructor.
Definition: IntrusiveForwardList.hpp:884
~IntrusiveForwardListBase()
IntrusiveForwardListBase's destructor.
Definition: IntrusiveForwardList.hpp:207
IntrusiveForwardListNode * begin()
Definition: IntrusiveForwardList.hpp:234
void reset()
Resets the node to the same state as right after construction.
Definition: IntrusiveForwardList.hpp:156
const QueueNode * const_pointer
const pointer to value linked in the list
Definition: IntrusiveForwardList.hpp:863
constexpr AccessKey()
AccessKey's constructor.
Definition: IntrusiveForwardList.hpp:52
reference operator *() const
IntrusiveForwardListConstIterator's unary prefix dereference operator.
Definition: IntrusiveForwardList.hpp:686
void clear()
Unlinks all elements from the list.
Definition: IntrusiveForwardList.hpp:957
void push_front(IntrusiveForwardListNode &newNode)
Links the node at the beginning of the list.
Definition: IntrusiveForwardList.hpp:327
constexpr IntrusiveForwardListIterator()
IntrusiveForwardListIterator's constructor.
Definition: IntrusiveForwardList.hpp:451
constexpr IntrusiveForwardListIterator(reference element)
IntrusiveForwardListIterator's constructor.
Definition: IntrusiveForwardList.hpp:475
constexpr IntrusiveForwardListIterator(IntrusiveForwardListNode *const node)
IntrusiveForwardListIterator's constructor.
Definition: IntrusiveForwardList.hpp:463
static IntrusiveForwardListNode * erase_after(IntrusiveForwardListNode *const position)
Unlinks the node following position from the list.
Definition: IntrusiveForwardList.hpp:353
static void insert_after(IntrusiveForwardListNode *const position, IntrusiveForwardListNode &newNode)
Links the node in the list after position.
Definition: IntrusiveForwardList.hpp:368
bool operator==(const IntrusiveForwardListConstIterator &other) const
IntrusiveForwardListConstIterator's "equal to" comparison operator.
Definition: IntrusiveForwardList.hpp:725
void unlinkNext(AccessKey)
Unlinks the node following this one from the list.
Definition: IntrusiveForwardList.hpp:138
const_iterator cend() const
Definition: IntrusiveForwardList.hpp:948
std::forward_iterator_tag iterator_category
category of the iterator
Definition: IntrusiveForwardList.hpp:436
iterator end()
Definition: IntrusiveForwardList.hpp:975
internal::IntrusiveForwardListBase intrusiveForwardListBase_
internal IntrusiveForwardListBase object
Definition: IntrusiveForwardList.hpp:1102
U value_type
value "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:613
const_iterator cbegin() const
Definition: IntrusiveForwardList.hpp:939
void swap(IntrusiveForwardListNode &left, IntrusiveForwardListNode &right)
Swaps contents of two nodes.
Definition: IntrusiveForwardList.hpp:172
ptrdiff_t difference_type
difference type
Definition: IntrusiveForwardList.hpp:601
void swap(IntrusiveForwardList &other)
Swaps contents with another list.
Definition: IntrusiveForwardList.hpp:1033
void linkAfter(IntrusiveForwardListNode *const position, AccessKey)
Links the node in the list after position.
Definition: IntrusiveForwardList.hpp:112
const IntrusiveForwardListNode * cbefore_begin() const
Definition: IntrusiveForwardList.hpp:252
void swap(IntrusiveForwardListBase &other)
Swaps contents with another list.
Definition: IntrusiveForwardList.hpp:338
const IntrusiveForwardListNode * node_
pointer to const IntrusiveForwardListNode of the object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:748
IntrusiveForwardListIterator & operator++()
IntrusiveForwardListIterator's unary prefix increment operator.
Definition: IntrusiveForwardList.hpp:510
IntrusiveForwardListNode * end()
Definition: IntrusiveForwardList.hpp:298
bool isLinked() const
Definition: IntrusiveForwardList.hpp:98
IntrusiveForwardListNode(IntrusiveForwardListNode &&other)
IntrusiveForwardListNode's move constructor.
Definition: IntrusiveForwardList.hpp:79
IntrusiveForwardListNode * node_
pointer to IntrusiveForwardListNode of the object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:560
void swap(IntrusiveForwardListNode &other)
Swaps contents with another node.
Definition: IntrusiveForwardList.hpp:124
const IntrusiveForwardListNode * cbegin() const
Definition: IntrusiveForwardList.hpp:261
bool operator==(const IntrusiveForwardListIterator< T, NodePointer, U > &left, const IntrusiveForwardListConstIterator< T, ConstNodePointer, U > &right)
"Equal to" comparison operator for IntrusiveForwardListIterator and IntrusiveForwardListConstIterator
Definition: IntrusiveForwardList.hpp:789
void clear()
Unlinks all nodes from the list.
Definition: IntrusiveForwardList.hpp:279
iterator begin()
Definition: IntrusiveForwardList.hpp:912
IntrusiveForwardListNode * nextNode_
pointer to next node on the list
Definition: IntrusiveForwardList.hpp:162
bool empty() const
Definition: IntrusiveForwardList.hpp:966
const_iterator end() const
Definition: IntrusiveForwardList.hpp:984
void swap(IntrusiveForwardListBase &left, IntrusiveForwardListBase &right)
Swaps contents of two lists.
Definition: IntrusiveForwardList.hpp:409
pointer operator->() const
IntrusiveForwardListIterator's binary infix pointer member access operator.
Definition: IntrusiveForwardList.hpp:488
QueueNode value_type
value linked in the list
Definition: IntrusiveForwardList.hpp:878
QueueNode * pointer
pointer to value linked in the list
Definition: IntrusiveForwardList.hpp:872
U value_type
value "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:445
void pop_front()
Unlinks the first element from the list.
Definition: IntrusiveForwardList.hpp:1011
IntrusiveForwardListIterator operator++(int)
IntrusiveForwardListIterator's unary postfix increment operator.
Definition: IntrusiveForwardList.hpp:522
const U & reference
reference to object "pointed to" by the iterator
Definition: IntrusiveForwardList.hpp:610
static iterator erase_after(const iterator position)
Unlinks the element following position from the list.
Definition: IntrusiveForwardList.hpp:1048
constexpr IntrusiveForwardListConstIterator(reference element)
IntrusiveForwardListConstIterator's constructor.
Definition: IntrusiveForwardList.hpp:644
IntrusiveForwardListNode * getNextNode() const
Definition: IntrusiveForwardList.hpp:89
static void splice_after(const iterator position, const iterator beforeSplicedElement)
Transfers the element from one list to another list after position.
Definition: IntrusiveForwardList.hpp:1087