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)
385 template <
typename TValue,
typename TLink>
391 typedef typename etl::intrusive_list_base<TLink>::link_type
link_type;
414 : p_value(ETL_NULLPTR)
419 : p_value(
other.p_value)
426 p_value = p_value->etl_next;
434 p_value = p_value->etl_next;
441 p_value = p_value->etl_previous;
449 p_value = p_value->etl_previous;
455 p_value =
other.p_value;
461 return *
static_cast<pointer
>(p_value);
466 return static_cast<pointer
>(p_value);
471 return static_cast<pointer
>(p_value);
476 return lhs.p_value ==
rhs.p_value;
504 : p_value(ETL_NULLPTR)
509 : p_value(
other.p_value)
514 : p_value(
other.p_value)
521 p_value = p_value->etl_next;
529 p_value = p_value->etl_next;
536 p_value = p_value->etl_previous;
544 p_value = p_value->etl_previous;
550 p_value =
other.p_value;
571 return lhs.p_value ==
rhs.p_value;
586 const link_type* p_value;
589 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
610 template <
typename TIterator>
613 this->
assign(first, last);
701 this->
insert_link(position.p_value->link_type::etl_previous, value);
708 template <
typename TIterator>
711 while (first != last)
714 this->
insert_link(*position.p_value->link_type::etl_previous, *first);
783 template <
typename TIsEqual>
842 template <
typename TCompare>
953 void remove(const_reference value)
973 template <
typename TPredicate>
1033 --other.current_size;
1055 etl::unlink(first, last);
1075 template <
typename TCompare>
1080#if ETL_IS_DEBUG_BUILD
const_iterator
Definition intrusive_list.h:498
iterator.
Definition intrusive_list.h:407
Definition intrusive_list.h:127
void remove_link(link_type &link)
Remove a link.
Definition intrusive_list.h:323
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
size_t current_size
Counts the number of elements in the list.
Definition intrusive_list.h:263
void remove_link(link_type *link)
Remove a link.
Definition intrusive_list.h:332
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
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:387
~intrusive_list()
Destructor.
Definition intrusive_list.h:602
const_iterator end() const
Gets the end of the intrusive_list.
Definition intrusive_list.h:651
reference back()
Gets a reference to the last element.
Definition intrusive_list.h:683
iterator begin()
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:619
void unique(TIsEqual isEqual)
Definition intrusive_list.h:784
const_iterator begin() const
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:627
void splice(iterator position, list_type &other)
Splice another list into this one.
Definition intrusive_list.h:994
iterator erase(const_iterator position)
Erases the value at the specified position.
Definition intrusive_list.h:735
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:1040
reference front()
Gets a reference to the first element.
Definition intrusive_list.h:667
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:709
void merge(list_type &other, TCompare compare)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_list.h:1076
void sort(TCompare compare)
Definition intrusive_list.h:843
void splice(iterator position, list_type &other, iterator isource)
Splice an element from another list into this one.
Definition intrusive_list.h:1023
intrusive_list()
Constructor.
Definition intrusive_list.h:594
iterator erase(const_iterator first, const_iterator last)
Definition intrusive_list.h:749
const_iterator cend() const
Gets the end of the intrusive_list.
Definition intrusive_list.h:659
iterator erase(iterator position)
Erases the value at the specified position.
Definition intrusive_list.h:722
const_iterator cbegin() const
Gets the beginning of the intrusive_list.
Definition intrusive_list.h:635
void remove_if(TPredicate predicate)
Removes according to a predicate.
Definition intrusive_list.h:974
void sort()
Sort using in-place merge sort algorithm.
Definition intrusive_list.h:812
iterator insert(const_iterator position, value_type &value)
Inserts a value to the intrusive_list before the specified position.
Definition intrusive_list.h:699
const_reference front() const
Gets a const reference to the first element.
Definition intrusive_list.h:675
iterator end()
Gets the end of the intrusive_list.
Definition intrusive_list.h:643
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:611
const_reference back() const
Gets a const reference to the last element.
Definition intrusive_list.h:691
void merge(list_type &other)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_list.h:1067
ETL_CONSTEXPR14 bool operator==(const etl::unexpected< TError > &lhs, const etl::unexpected< TError > &rhs)
Equivalence operator.
Definition expected.h:950
ETL_NODISCARD ETL_CONSTEXPR14 bool is_sorted(TIterator begin, TIterator end)
Definition algorithm.h:1441
#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
ETL_CONSTEXPR14 bool operator!=(const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
Inequality test for etl::to_arithmetic_result.
Definition to_arithmetic.h:1017