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
183 while (first != last)
187 link_type& value = *first++;
191 value.etl_next =
p_last->etl_next;
192 p_last->etl_next = &value;
213#if defined(ETL_CHECK_PUSH_POP)
230 link_type* current =
start.etl_next;
231 link_type* next =
start.etl_next;
235 next = next->etl_next;
236 current->etl_next = previous;
288 return (
size() <= 1U);
306 link_type* p_next = link.etl_next;
308 if (p_next != &this->terminator)
321 return start.etl_next;
329 return start.etl_next;
342 template <
typename TLink>
350 template <
typename TValue,
typename TLink>
356 typedef typename etl::intrusive_forward_list_base<TLink>::link_type
link_type;
379 : p_value(ETL_NULLPTR)
384 : p_value(
other.p_value)
391 p_value = p_value->etl_next;
399 p_value = p_value->etl_next;
405 p_value =
other.p_value;
411 return *
static_cast<pointer
>(p_value);
416 return static_cast<pointer
>(p_value);
421 return static_cast<pointer
>(p_value);
426 return lhs.p_value ==
rhs.p_value;
454 : p_value(ETL_NULLPTR)
459 : p_value(
other.p_value)
464 : p_value(
other.p_value)
471 p_value = p_value->etl_next;
479 p_value = p_value->etl_next;
485 p_value =
other.p_value;
491 return *
static_cast<const value_type*
>(p_value);
496 return static_cast<const value_type*
>(p_value);
501 return static_cast<const value_type*
>(p_value);
506 return lhs.p_value ==
rhs.p_value;
521 const link_type* p_value;
524 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
543 template <
typename TIterator>
546 this->
assign(first, last);
643 template <
typename TIterator>
646 while (first != last)
681 if (first !=
end() && (first != last))
721 template <
typename TIsEqual>
730 link_type* current = last->etl_next;
735 if (isEqual(*
static_cast<pointer>(current), *
static_cast<pointer>(last)))
745 current = last->etl_next;
782 template <
typename TCompare>
897 void remove(const_reference value)
919 template <
typename TPredicate>
962 while (last->etl_next != &
other.terminator)
964 last = last->etl_next;
987 --other.current_size;
1008 while (last->etl_next !=
end_.p_value)
1010 last = last->etl_next;
1015 etl::unlink_after(*first, *last);
1035 template <
typename TCompare>
1040#if ETL_IS_DEBUG_BUILD
1097 link_type* get_next(link_type* link)
const
1099 return link->etl_next;
const_iterator
Definition intrusive_forward_list.h:448
iterator.
Definition intrusive_forward_list.h:372
Definition intrusive_forward_list.h:140
bool is_trivial_list() const
Is the intrusive_forward_list a trivial length?
Definition intrusive_forward_list.h:286
link_type start
The link pointer that acts as the intrusive_forward_list start.
Definition intrusive_forward_list.h:262
void reverse()
Reverses the intrusive_forward_list.
Definition intrusive_forward_list.h:222
void insert_link_after(link_type &position, link_type &link)
Insert a link.
Definition intrusive_forward_list.h:294
~intrusive_forward_list_base()
Destructor.
Definition intrusive_forward_list.h:278
bool empty() const
Returns true if the list has no elements.
Definition intrusive_forward_list.h:247
static link_type terminator
The link that acts as the intrusive_forward_list terminator.
Definition intrusive_forward_list.h:263
size_t current_size
Counts the number of elements in the list.
Definition intrusive_forward_list.h:265
intrusive_forward_list_base()
Constructor.
Definition intrusive_forward_list.h:270
void remove_link_after(link_type &link)
Remove a link.
Definition intrusive_forward_list.h:304
void initialise()
Initialise the intrusive_forward_list.
Definition intrusive_forward_list.h:335
void pop_front()
Removes a value from the front of the intrusive_forward_list.
Definition intrusive_forward_list.h:211
link_type * get_head()
Get the head link.
Definition intrusive_forward_list.h:319
const link_type * get_head() const
Get the head link.
Definition intrusive_forward_list.h:327
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:255
void push_front(link_type &value)
Pushes a value to the front of the intrusive_forward_list.
Definition intrusive_forward_list.h:201
void clear()
Clears the intrusive_forward_list.
Definition intrusive_forward_list.h:149
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:352
const_iterator before_begin() const
Gets before the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:576
iterator erase_after(iterator first, iterator last)
Erases a range of elements.
Definition intrusive_forward_list.h:679
void sort(TCompare compare)
Definition intrusive_forward_list.h:783
const_iterator cbegin() const
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:584
void splice_after(iterator position, etl::intrusive_forward_list< TValue, TLink > &other)
Splice another list into this one.
Definition intrusive_forward_list.h:942
~intrusive_forward_list()
Destructor.
Definition intrusive_forward_list.h:536
void unique(TIsEqual isEqual)
Definition intrusive_forward_list.h:722
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:994
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:977
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:644
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:544
void remove_if(TPredicate predicate)
Removes according to a predicate.
Definition intrusive_forward_list.h:920
iterator erase_after(iterator position)
Erases the value at the specified position.
Definition intrusive_forward_list.h:660
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:632
const_iterator begin() const
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:560
void merge(list_type &other, TCompare compare)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_forward_list.h:1036
iterator end()
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:592
iterator before_begin()
Gets before the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:568
const_iterator end() const
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:600
const_reference front() const
Gets a const reference to the first element.
Definition intrusive_forward_list.h:624
const_iterator cend() const
Gets the end of the intrusive_forward_list.
Definition intrusive_forward_list.h:608
void merge(list_type &other)
Merge another list into this one. Both lists should be sorted.
Definition intrusive_forward_list.h:1027
void sort()
Sort using in-place merge sort algorithm.
Definition intrusive_forward_list.h:752
intrusive_forward_list()
Constructor.
Definition intrusive_forward_list.h:529
iterator begin()
Gets the beginning of the intrusive_forward_list.
Definition intrusive_forward_list.h:552
reference front()
Gets a reference to the first element.
Definition intrusive_forward_list.h:616
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