31#ifndef ETL_INTRUSIVE_LIST_INCLUDED
32#define ETL_INTRUSIVE_LIST_INCLUDED
40#include "static_assert.h"
125 template <
typename TLink>
138 template <
typename TIterator>
141#if ETL_IS_DEBUG_BUILD
151 while (first != last)
175#if defined(ETL_CHECK_PUSH_POP)
196#if defined(ETL_CHECK_PUSH_POP)
453 template <
typename TValue,
typename TLink>
459 typedef typename etl::intrusive_list_base<TLink>::link_type
link_type;
484 : p_value(ETL_NULLPTR)
489 : p_value(
other.p_value)
496 p_value = p_value->etl_next;
504 p_value = p_value->etl_next;
511 p_value = p_value->etl_previous;
519 p_value = p_value->etl_previous;
525 p_value =
other.p_value;
532 return *
static_cast<pointer
>(p_value);
538 return static_cast<pointer
>(p_value);
543 return static_cast<pointer
>(p_value);
548 return lhs.p_value ==
rhs.p_value;
576 : p_value(ETL_NULLPTR)
581 : p_value(
other.p_value)
586 : p_value(
other.p_value)
593 p_value = p_value->etl_next;
601 p_value = p_value->etl_next;
608 p_value = p_value->etl_previous;
616 p_value = p_value->etl_previous;
622 p_value =
other.p_value;
643 return lhs.p_value ==
rhs.p_value;
658 const link_type* p_value;
661 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
682 template <
typename TIterator>
685 this->
assign(first, last);
773 this->
insert_link(position.p_value->link_type::etl_previous, value);
780 template <
typename TIterator>
783 while (first != last)
786 this->
insert_link(*position.p_value->link_type::etl_previous, *first);
833 if (
p_last == ETL_NULLPTR)
855 template <
typename TIsEqual>
914 template <
typename TCompare>
1025 void remove(const_reference value)
1045 template <
typename TPredicate>
1105 --other.current_size;
1127 etl::unlink(first, last);
1147 template <
typename TCompare>
1152#if ETL_IS_DEBUG_BUILD
const_iterator
Definition intrusive_list.h:570
iterator.
Definition intrusive_list.h:477
Definition intrusive_list.h:127
void disconnect_link(link_type *link)
Remove a link.
Definition intrusive_list.h:332
link_type * remove_link(link_type &link)
Definition intrusive_list.h:403
size_t size() const
Returns the number of elements.
Definition intrusive_list.h:253
link_type * get_tail()
Get the tail link.
Definition intrusive_list.h:357
void insert_link(link_type &previous, link_type &new_link)
Insert a link.
Definition intrusive_list.h:283
~intrusive_list_base()
Destructor.
Definition intrusive_list.h:268
void assign(TIterator first, TIterator last)
Definition intrusive_list.h:139
bool is_link_in_list(link_type &search_link) const
Tests if the link is in this list.
Definition intrusive_list.h:382
size_t current_size
Counts the number of elements in the list.
Definition intrusive_list.h:263
void disconnect_link(link_type &link)
Remove a link.
Definition intrusive_list.h:323
void insert_link(link_type &previous, link_type *new_link)
Insert a link.
Definition intrusive_list.h:303
void pop_back()
Removes a value from the back of the intrusive_list.
Definition intrusive_list.h:194
link_type * get_head()
Get the head link.
Definition intrusive_list.h:341
bool empty() const
Returns true if the list has no elements.
Definition intrusive_list.h:245
link_type * remove_link_range(link_type *p_first, link_type *p_last)
Removes a range of links.
Definition intrusive_list.h:425
void initialise()
Initialise the intrusive_list.
Definition intrusive_list.h:373
void reverse()
Reverses the list.
Definition intrusive_list.h:223
void insert_link(link_type *previous, link_type *new_link)
Insert a link.
Definition intrusive_list.h:313
const link_type * get_head() const
Get the head link.
Definition intrusive_list.h:349
link_type terminal_link
The link that acts as the intrusive_list start & end.
Definition intrusive_list.h:261
void insert_link(link_type *previous, link_type &new_link)
Insert a link.
Definition intrusive_list.h:293
void clear()
Clears the intrusive_list.
Definition intrusive_list.h:205
void push_front(link_type &value)
Pushes a value to the front of the intrusive_list.
Definition intrusive_list.h:163
void push_back(link_type &value)
Pushes a value to the back of the intrusive_list.
Definition intrusive_list.h:184
void pop_front()
Removes a value from the front of the intrusive_list.
Definition intrusive_list.h:173
const link_type * get_tail() const
Get the tail link.
Definition intrusive_list.h:365
bool is_trivial_list() const
Is the intrusive_list a trivial length?
Definition intrusive_list.h:275
Definition intrusive_list.h:70
Definition intrusive_list.h:56
Definition intrusive_list.h:84
Definition intrusive_list.h:98
Definition intrusive_list.h:112
Definition intrusive_list.h:455
~intrusive_list()
Destructor.
Definition intrusive_list.h:674
node_type * erase(node_type &node)
Erases the specified node.
Definition intrusive_list.h:846
const_iterator end() const
Gets the end of the intrusive_list.
Definition intrusive_list.h:723
reference back()
Gets a reference to the last element.
Definition intrusive_list.h:755
iterator begin()
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:691
void unique(TIsEqual isEqual)
Definition intrusive_list.h:856
const_iterator begin() const
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:699
void splice(iterator position, list_type &other)
Splice another list into this one.
Definition intrusive_list.h:1066
iterator erase(const_iterator position)
Erases the value at the specified position.
Definition intrusive_list.h:807
void splice(iterator position, list_type &other, iterator begin_, iterator end_)
Splice a range of elements from another list into this one.
Definition intrusive_list.h:1112
reference front()
Gets a reference to the first element.
Definition intrusive_list.h:739
void insert(const_iterator position, TIterator first, TIterator last)
Inserts a range of values to the intrusive_list after the specified position.
Definition intrusive_list.h:781
void merge(list_type &other, TCompare compare)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_list.h:1148
void sort(TCompare compare)
Definition intrusive_list.h:915
void splice(iterator position, list_type &other, iterator isource)
Splice an element from another list into this one.
Definition intrusive_list.h:1095
intrusive_list()
Constructor.
Definition intrusive_list.h:666
iterator erase(const_iterator first, const_iterator last)
Definition intrusive_list.h:821
const_iterator cend() const
Gets the end of the intrusive_list.
Definition intrusive_list.h:731
iterator erase(iterator position)
Erases the value at the specified position.
Definition intrusive_list.h:794
const_iterator cbegin() const
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:707
void remove_if(TPredicate predicate)
Removes according to a predicate.
Definition intrusive_list.h:1046
void sort()
Sort using in-place merge sort algorithm.
Definition intrusive_list.h:884
iterator insert(const_iterator position, value_type &value)
Inserts a value to the intrusive_list before the specified position.
Definition intrusive_list.h:771
const_reference front() const
Gets a const reference to the first element.
Definition intrusive_list.h:747
iterator end()
Gets the end of the intrusive_list.
Definition intrusive_list.h:715
intrusive_list(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Constructor from range.
Definition intrusive_list.h:683
const_reference back() const
Gets a const reference to the last element.
Definition intrusive_list.h:763
void merge(list_type &other)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_list.h:1139
ETL_CONSTEXPR14 bool operator==(const etl::expected< TValue, TError > &lhs, const etl::expected< TValue2, TError2 > &rhs)
Equivalence operators.
Definition expected.h:966
ETL_NODISCARD ETL_CONSTEXPR14 bool is_sorted(TIterator begin, TIterator end)
Definition algorithm.h:1673
#define ETL_ASSERT(b, e)
Definition error_handler.h:316
Definition exception.h:47
enable_if
Definition type_traits_generator.h:1191
is_integral
Definition type_traits_generator.h:1001
bitset_ext
Definition absolute.h:38
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164