31#ifndef ETL_INTRUSIVE_FORWARD_LIST_INCLUDED
32#define ETL_INTRUSIVE_FORWARD_LIST_INCLUDED
138 template <
typename TLink>
144 typedef TLink link_type;
156 link_type* p_next =
p_unlink->etl_next;
168 template <
typename TIterator>
171#if ETL_IS_DEBUG_BUILD
181 while (first != last)
183 link_type& value = *first++;
187 value.etl_next =
p_last->etl_next;
188 p_last->etl_next = &value;
209#if defined(ETL_CHECK_PUSH_POP)
226 link_type* current =
start.etl_next;
227 link_type* next =
start.etl_next;
231 next = next->etl_next;
232 current->etl_next = previous;
284 return (
size() <= 1U);
302 link_type* p_next = link.etl_next;
304 if (p_next != &this->terminator)
317 return start.etl_next;
325 return start.etl_next;
346 while (
p_link != ETL_NULLPTR)
355 if (
p_link != ETL_NULLPTR)
371 link_type* result = ETL_NULLPTR;
377 link_type* p_next = link.etl_next;
381 if (p_next != &this->terminator)
405 link_type* p_next =
p_unlink->etl_next;
410 if (
p_after == &this->terminator)
421 template <
typename TLink>
429 template <
typename TValue,
typename TLink>
435 typedef typename etl::intrusive_forward_list_base<TLink>::link_type
link_type;
460 : p_value(ETL_NULLPTR)
465 : p_value(
other.p_value)
472 p_value = p_value->etl_next;
480 p_value = p_value->etl_next;
486 p_value =
other.p_value;
493 return *
static_cast<pointer
>(p_value);
499 return static_cast<pointer
>(p_value);
504 return static_cast<pointer
>(p_value);
509 return lhs.p_value ==
rhs.p_value;
537 : p_value(ETL_NULLPTR)
542 : p_value(
other.p_value)
547 : p_value(
other.p_value)
554 p_value = p_value->etl_next;
562 p_value = p_value->etl_next;
568 p_value =
other.p_value;
574 return *
static_cast<const value_type*
>(p_value);
579 return static_cast<const value_type*
>(p_value);
584 return static_cast<const value_type*
>(p_value);
589 return lhs.p_value ==
rhs.p_value;
604 const link_type* p_value;
607 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
626 template <
typename TIterator>
629 this->
assign(first, last);
726 template <
typename TIterator>
729 while (first != last)
764 if (first !=
end() && (first != last))
799 template <
typename TIsEqual>
808 link_type* current = last->etl_next;
813 if (isEqual(*
static_cast<pointer>(current), *
static_cast<pointer>(last)))
823 current = last->etl_next;
860 template <
typename TCompare>
975 void remove(const_reference value)
997 template <
typename TPredicate>
1040 while (last->etl_next != &
other.terminator)
1042 last = last->etl_next;
1065 --other.current_size;
1086 while (last->etl_next !=
end_.p_value)
1088 last = last->etl_next;
1093 etl::unlink_after(*first, *last);
1113 template <
typename TCompare>
1118#if ETL_IS_DEBUG_BUILD
1175 link_type* get_next(link_type* link)
const
1177 return link->etl_next;
const_iterator
Definition intrusive_forward_list.h:531
iterator.
Definition intrusive_forward_list.h:453
Definition intrusive_forward_list.h:140
bool is_trivial_list() const
Is the intrusive_forward_list a trivial length?
Definition intrusive_forward_list.h:282
link_type * is_link_in_list(link_type &search_link)
Definition intrusive_forward_list.h:341
link_type start
The link pointer that acts as the intrusive_forward_list start.
Definition intrusive_forward_list.h:258
void reverse()
Reverses the intrusive_forward_list.
Definition intrusive_forward_list.h:218
void insert_link_after(link_type &position, link_type &link)
Insert a link.
Definition intrusive_forward_list.h:290
~intrusive_forward_list_base()
Destructor.
Definition intrusive_forward_list.h:274
bool empty() const
Returns true if the list has no elements.
Definition intrusive_forward_list.h:243
static link_type terminator
The link that acts as the intrusive_forward_list terminator.
Definition intrusive_forward_list.h:259
size_t current_size
Counts the number of elements in the list.
Definition intrusive_forward_list.h:261
intrusive_forward_list_base()
Constructor.
Definition intrusive_forward_list.h:266
link_type * remove_link(link_type &link)
Definition intrusive_forward_list.h:369
void initialise()
Initialise the intrusive_forward_list.
Definition intrusive_forward_list.h:331
void pop_front()
Removes a value from the front of the intrusive_forward_list.
Definition intrusive_forward_list.h:207
link_type * get_head()
Get the head link.
Definition intrusive_forward_list.h:315
const link_type * get_head() const
Get the head link.
Definition intrusive_forward_list.h:323
void disconnect_link_after(link_type &link)
Remove a link.
Definition intrusive_forward_list.h:300
void assign(TIterator first, TIterator last)
Definition intrusive_forward_list.h:169
size_t size() const
Returns the number of elements.
Definition intrusive_forward_list.h:251
void push_front(link_type &value)
Pushes a value to the front of the intrusive_forward_list.
Definition intrusive_forward_list.h:197
void clear()
Clears the intrusive_forward_list.
Definition intrusive_forward_list.h:149
link_type * remove_link_range_after(link_type *p_first, link_type *p_last)
Remove a range of elements.
Definition intrusive_forward_list.h:393
Definition intrusive_forward_list.h:69
Definition intrusive_forward_list.h:55
Definition intrusive_forward_list.h:97
Definition intrusive_forward_list.h:83
Definition intrusive_forward_list.h:111
Definition intrusive_forward_list.h:125
Definition intrusive_forward_list.h:431
const_iterator before_begin() const
Gets before the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:659
iterator erase_after(iterator first, iterator last)
Erases a range of elements.
Definition intrusive_forward_list.h:762
void sort(TCompare compare)
Definition intrusive_forward_list.h:861
const_iterator cbegin() const
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:667
void splice_after(iterator position, etl::intrusive_forward_list< TValue, TLink > &other)
Splice another list into this one.
Definition intrusive_forward_list.h:1020
~intrusive_forward_list()
Destructor.
Definition intrusive_forward_list.h:619
void unique(TIsEqual isEqual)
Definition intrusive_forward_list.h:800
node_type * erase(node_type &node)
Erases the specified node.
Definition intrusive_forward_list.h:790
void splice_after(iterator position, etl::intrusive_forward_list< TValue, TLink > &other, iterator begin_, iterator end_)
Splice a range of elements from another list into this one.
Definition intrusive_forward_list.h:1072
void splice_after(iterator position, etl::intrusive_forward_list< TValue, TLink > &other, iterator isource)
Splice an element from another list into this one.
Definition intrusive_forward_list.h:1055
void insert_after(iterator position, TIterator first, TIterator last)
Inserts a range of values to the intrusive_forward_list after the specified position.
Definition intrusive_forward_list.h:727
intrusive_forward_list(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Constructor from range.
Definition intrusive_forward_list.h:627
void remove_if(TPredicate predicate)
Removes according to a predicate.
Definition intrusive_forward_list.h:998
iterator erase_after(iterator position)
Erases the value at the specified position.
Definition intrusive_forward_list.h:743
iterator insert_after(iterator position, value_type &value)
Inserts a value to the intrusive_forward_list after the specified position.
Definition intrusive_forward_list.h:715
const_iterator begin() const
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:643
void merge(list_type &other, TCompare compare)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_forward_list.h:1114
iterator end()
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:675
iterator before_begin()
Gets before the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:651
const_iterator end() const
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:683
const_reference front() const
Gets a const reference to the first element.
Definition intrusive_forward_list.h:707
const_iterator cend() const
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:691
void merge(list_type &other)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_forward_list.h:1105
void sort()
Sort using in-place merge sort algorithm.
Definition intrusive_forward_list.h:830
intrusive_forward_list()
Constructor.
Definition intrusive_forward_list.h:612
iterator begin()
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:635
reference front()
Gets a reference to the first element.
Definition intrusive_forward_list.h:699
ETL_CONSTEXPR14 bool operator==(const etl::expected< TValue, TError > &lhs, const etl::expected< TValue2, TError2 > &rhs)
Equivalence operators.
Definition expected.h:968
ETL_NODISCARD ETL_CONSTEXPR14 bool is_sorted(TIterator begin, TIterator end)
Definition algorithm.h:1685
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
Definition exception.h:47
enable_if
Definition type_traits_generator.h:1186
is_integral
Definition type_traits_generator.h:996
bitset_ext
Definition absolute.h:38
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164