31#ifndef ETL_LIST_INCLUDED
32#define ETL_LIST_INCLUDED
47#include "static_assert.h"
70 list_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
71 :
exception(reason_, file_name_, line_number_)
80 class list_full :
public list_exception
84 list_full(string_type file_name_, numeric_type line_number_)
85 : list_exception(ETL_ERROR_TEXT(
"list:full", ETL_LIST_FILE_ID
"A"), file_name_, line_number_)
94 class list_empty :
public list_exception
98 list_empty(string_type file_name_, numeric_type line_number_)
99 : list_exception(ETL_ERROR_TEXT(
"list:empty", ETL_LIST_FILE_ID
"B"), file_name_, line_number_)
108 class list_iterator :
public list_exception
112 list_iterator(string_type file_name_, numeric_type line_number_)
113 : list_exception(ETL_ERROR_TEXT(
"list:iterator", ETL_LIST_FILE_ID
"C"), file_name_, line_number_)
122 class list_unsorted :
public list_exception
126 list_unsorted(string_type file_name_, numeric_type line_number_)
127 : list_exception(ETL_ERROR_TEXT(
"list:unsorted", ETL_LIST_FILE_ID
"D"), file_name_, line_number_)
136 class list_no_pool :
public list_exception
140 list_no_pool(string_type file_name_, numeric_type line_number_)
141 : list_exception(ETL_ERROR_TEXT(
"list:no pool", ETL_LIST_FILE_ID
"E"), file_name_, line_number_)
165 : previous(ETL_NULLPTR)
175 using ETL_OR_STD::swap;
177 swap(previous, next);
206 node_t* p_temp = p_node->previous;
207 p_node->previous = p_node->next;
208 p_node->next = p_temp;
209 p_node = p_node->previous;
213 node_t* p_temp = p_node->previous;
214 p_node->previous = p_node->next;
215 p_node->next = p_temp;
249 p_node = p_node->next;
335 join(*position.previous, node);
336 join(node, position);
345 right.previous = &left;
403 template <
typename T>
408 typedef T value_type;
410 typedef const T* const_pointer;
411 typedef T& reference;
412 typedef const T& const_reference;
414 typedef T&& rvalue_reference;
416 typedef size_t size_type;
427 explicit data_node_t(
const T& value_)
456 static const data_node_t* data_cast(
const node_t* p_node)
458 return reinterpret_cast<const data_node_t*
>(p_node);
474 class iterator :
public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, T>
479 friend class const_iterator;
482 : p_node(ETL_NULLPTR)
491 iterator(
const iterator& other)
492 : p_node(other.p_node)
496 iterator& operator++()
498 p_node = p_node->next;
502 iterator operator++(
int)
504 iterator temp(*
this);
505 p_node = p_node->next;
509 iterator& operator--()
511 p_node = p_node->previous;
515 iterator operator--(
int)
517 iterator temp(*
this);
518 p_node = p_node->previous;
522 iterator& operator=(
const iterator& other)
524 p_node = other.p_node;
528 reference operator*()
const
530 return ilist::data_cast(p_node)->value;
533 pointer operator&()
const
535 return &(ilist::data_cast(p_node)->value);
538 pointer operator->()
const
540 return &(ilist::data_cast(p_node)->value);
543 friend bool operator==(
const iterator& lhs,
const iterator& rhs)
545 return lhs.p_node == rhs.p_node;
548 friend bool operator!=(
const iterator& lhs,
const iterator& rhs)
550 return !(lhs == rhs);
561 class const_iterator :
public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const T>
568 : p_node(ETL_NULLPTR)
572 const_iterator(
node_t& node)
577 const_iterator(
const node_t& node)
583 : p_node(other.p_node)
587 const_iterator(
const const_iterator& other)
588 : p_node(other.p_node)
592 const_iterator& operator++()
594 p_node = p_node->next;
598 const_iterator operator++(
int)
600 const_iterator temp(*
this);
601 p_node = p_node->next;
605 const_iterator& operator--()
607 p_node = p_node->previous;
611 const_iterator operator--(
int)
613 const_iterator temp(*
this);
614 p_node = p_node->previous;
618 const_iterator& operator=(
const const_iterator& other)
620 p_node = other.p_node;
624 const_reference operator*()
const
626 return ilist::data_cast(p_node)->value;
629 const_pointer operator&()
const
631 return &(ilist::data_cast(p_node)->value);
634 const_pointer operator->()
const
636 return &(ilist::data_cast(p_node)->value);
639 friend bool operator==(
const const_iterator& lhs,
const const_iterator& rhs)
641 return lhs.p_node == rhs.p_node;
644 friend bool operator!=(
const const_iterator& lhs,
const const_iterator& rhs)
646 return !(lhs == rhs);
654 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
656 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
657 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
686 const_iterator
end()
const
728 return reverse_iterator(
get_head());
734 const_reverse_iterator
rend()
const
736 return const_reverse_iterator(
get_head());
750 const_reverse_iterator
crend()
const
752 return const_reverse_iterator(
get_head());
805 template <
typename TIterator>
806 void assign(TIterator first, TIterator last,
typename etl::enable_if<!etl::is_integral<TIterator>::value,
int>
::type = 0)
808#if ETL_IS_DEBUG_BUILD
809 difference_type d = etl::distance(first, last);
816 while (first != last)
818 data_node_t& node = allocate_data_node(*first);
830#if ETL_IS_DEBUG_BUILD
839 data_node_t& node = allocate_data_node(value);
850 ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!
full(), ETL_ERROR(
list_full));
861 ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!
full(), ETL_ERROR(
list_full));
867#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_LIST_FORCE_CPP03_IMPLEMENTATION)
871 template <
typename... Args>
874 ETL_ASSERT_CHECK_PUSH_POP(!
full(), ETL_ERROR(list_full));
878 data_node_t* p_data_node = allocate_data_node();
879 ::new (&(p_data_node->value)) T(
etl::forward<Args>(args)...);
880 ETL_INCREMENT_DEBUG_COUNT;
894 data_node_t* p_data_node = allocate_data_node();
895 ::new (&(p_data_node->value)) T();
896 ETL_INCREMENT_DEBUG_COUNT;
904 template <
typename T1>
911 data_node_t* p_data_node = allocate_data_node();
912 ::new (&(p_data_node->value)) T(value1);
913 ETL_INCREMENT_DEBUG_COUNT;
921 template <
typename T1,
typename T2>
928 data_node_t* p_data_node = allocate_data_node();
929 ::new (&(p_data_node->value)) T(value1, value2);
930 ETL_INCREMENT_DEBUG_COUNT;
938 template <
typename T1,
typename T2,
typename T3>
939 reference
emplace_front(
const T1& value1,
const T2& value2,
const T3& value3)
945 data_node_t* p_data_node = allocate_data_node();
946 ::new (&(p_data_node->value)) T(value1, value2, value3);
947 ETL_INCREMENT_DEBUG_COUNT;
955 template <
typename T1,
typename T2,
typename T3,
typename T4>
956 reference
emplace_front(
const T1& value1,
const T2& value2,
const T3& value3,
const T4& value4)
962 data_node_t* p_data_node = allocate_data_node();
963 ::new (&(p_data_node->value)) T(value1, value2, value3, value4);
964 ETL_INCREMENT_DEBUG_COUNT;
986 ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!
full(), ETL_ERROR(
list_full));
997 ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!
full(), ETL_ERROR(
list_full));
1006#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT
1007 template <
typename... Args>
1010 ETL_ASSERT_CHECK_PUSH_POP(!
full(), ETL_ERROR(list_full));
1014 data_node_t* p_data_node = allocate_data_node();
1015 ::new (&(p_data_node->value)) T(
etl::forward<Args>(args)...);
1016 ETL_INCREMENT_DEBUG_COUNT;
1027 data_node_t* p_data_node = allocate_data_node();
1028 ::new (&(p_data_node->value)) T();
1029 ETL_INCREMENT_DEBUG_COUNT;
1034 template <
typename T1>
1042 ::new (&(p_data_node->value)) T(value1);
1043 ETL_INCREMENT_DEBUG_COUNT;
1048 template <typename T1, typename T2>
1056 ::new (&(p_data_node->value)) T(value1, value2);
1057 ETL_INCREMENT_DEBUG_COUNT;
1062 template <typename T1, typename T2, typename T3>
1070 ::new (&(p_data_node->value)) T(value1, value2, value3);
1071 ETL_INCREMENT_DEBUG_COUNT;
1076 template <typename T1, typename T2, typename T3, typename T4>
1084 ::new (&(p_data_node->value)) T(value1, value2, value3, value4);
1085 ETL_INCREMENT_DEBUG_COUNT;
1105 iterator
insert(const_iterator position, const_reference value)
1109 data_node_t& data_node = allocate_data_node(value);
1110 insert_node(*to_iterator(position).p_node, data_node);
1112 return iterator(data_node);
1123 data_node_t& data_node = allocate_data_node(etl::move(value));
1124 insert_node(*to_iterator(position).p_node, data_node);
1133#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_LIST_FORCE_CPP03_IMPLEMENTATION)
1134 template <
typename... Args>
1135 iterator
emplace(const_iterator position, Args&&... args)
1140 data_node_t* p_data_node = allocate_data_node();
1141 ::new (&(p_data_node->value)) T(
etl::forward<Args>(args)...);
1142 ETL_INCREMENT_DEBUG_COUNT;
1143 insert_node(*to_iterator(position).p_node, *p_data_node);
1145 return iterator(*p_data_node);
1153 data_node_t* p_data_node = allocate_data_node();
1154 ::new (&(p_data_node->value)) T();
1155 ETL_INCREMENT_DEBUG_COUNT;
1156 insert_node(*to_iterator(position).p_node, *p_data_node);
1158 return iterator(*p_data_node);
1161 template <
typename T1>
1168 ::new (&(p_data_node->value)) T(value1);
1169 ETL_INCREMENT_DEBUG_COUNT;
1170 insert_node(*to_iterator(position).p_node, *p_data_node);
1175 template <typename T1, typename T2>
1182 ::new (&(p_data_node->value)) T(value1, value2);
1183 ETL_INCREMENT_DEBUG_COUNT;
1184 insert_node(*to_iterator(position).p_node, *p_data_node);
1189 template <typename T1, typename T2, typename T3>
1196 ::new (&(p_data_node->value)) T(value1, value2, value3);
1197 ETL_INCREMENT_DEBUG_COUNT;
1198 insert_node(*to_iterator(position).p_node, *p_data_node);
1203 template <typename T1, typename T2, typename T3, typename T4>
1210 ::new (&(p_data_node->value)) T(value1, value2, value3, value4);
1211 ETL_INCREMENT_DEBUG_COUNT;
1212 insert_node(*to_iterator(position).p_node, *p_data_node);
1221 void insert(const_iterator position,
size_t n, const_reference value)
1223 for (
size_t i = 0UL; i < n; ++i)
1228 insert_node(*to_iterator(position).p_node, allocate_data_node(value));
1235 template <
typename TIterator>
1236 void insert(const_iterator position, TIterator first, TIterator last,
typename etl::enable_if<!etl::is_integral<TIterator>::value,
int>
::type = 0)
1238 while (first != last)
1243 insert_node(*to_iterator(position).p_node, allocate_data_node(*first));
1253 iterator position_ = to_iterator(position);
1256 remove_node(*position_.p_node->previous);
1263 iterator
erase(const_iterator first, const_iterator last)
1265 iterator first_ = to_iterator(first);
1266 iterator last_ = to_iterator(last);
1268 node_t* p_first = first_.p_node;
1269 node_t* p_last = last_.p_node;
1273 join(*(p_first->previous), *p_last);
1276 while (p_first != p_last)
1278 p_next = p_first->next;
1279 destroy_data_node(
static_cast<data_node_t&
>(*p_first));
1307 else if (n <
size())
1309 iterator i_start =
end();
1310 etl::advance(i_start, -difference_type(
size() - n));
1314 else if (n >
size())
1331 void remove(const_reference value)
1335 while (iValue !=
end())
1337 if (value == *iValue)
1339 iValue =
erase(iValue);
1351 template <
typename TPredicate>
1354 iterator iValue =
begin();
1356 while (iValue !=
end())
1358 if (predicate(*iValue))
1360 iValue =
erase(iValue);
1382 template <
typename TIsEqual>
1390 iterator i_item =
begin();
1392 iterator i_previous =
begin();
1394 while (i_item !=
end())
1396 if (isEqual(*i_previous, *i_item))
1398 i_item =
erase(i_item);
1402 i_previous = i_item;
1429 while (itr != other.end())
1431 to =
insert(to, etl::move(*itr));
1435 other.erase(other.begin(), other.end());
1472 insert(to, etl::move(*from));
1486 move(to, first, last);
1492 other.
erase(first, last);
1505 move(to, first, last);
1510 ilist::iterator itr = first;
1513 to =
insert(to, etl::move(*itr));
1518 other.erase(first, last);
1534 template <
typename TCompare>
1537 if ((
this != &other) && !other.
empty())
1539#if ETL_IS_DEBUG_BUILD
1550 while ((this_begin != this_end) && (other_begin != other_end))
1553 while ((this_begin != this_end) && !(
compare(*other_begin, *this_begin)))
1559 if (this_begin != this_end)
1561 while ((other_begin != other_end) && (
compare(*other_begin, *this_begin)))
1563 insert(this_begin, *other_begin);
1570 if ((this_begin == this_end) && (other_begin != other_end))
1572 insert(this_end, other_begin, other_end);
1591 template <
typename TCompare>
1596 #if ETL_IS_DEBUG_BUILD
1601 ilist::iterator other_begin = other.begin();
1602 ilist::iterator other_end = other.end();
1604 ilist::iterator this_begin =
begin();
1605 ilist::iterator this_end =
end();
1607 while ((this_begin != this_end) && (other_begin != other_end))
1610 while ((this_begin != this_end) && !(compare(*other_begin, *this_begin)))
1616 if (this_begin != this_end)
1618 while ((other_begin != other_end) && (compare(*other_begin, *this_begin)))
1620 insert(this_begin, etl::move(*other_begin));
1627 if ((this_begin == this_end) && (other_begin != other_end))
1629 while (other_begin != other_end)
1631 insert(this_end, etl::move(*other_begin));
1675 template <
typename TCompare>
1684 int number_of_merges;
1699 number_of_merges = 0;
1701 while (i_left !=
end())
1708 for (
int i = 0; i < list_size; ++i)
1713 if (i_right ==
end())
1720 right_size = list_size;
1723 while (left_size > 0 || (right_size > 0 && i_right !=
end()))
1732 else if (right_size == 0 || i_right ==
end())
1738 else if (!
compare(*i_right, *i_left))
1754 if (i_head ==
end())
1756 join(*i_head.p_node, *i_node.p_node);
1762 join(*i_tail.p_node, *i_node.p_node);
1774 if (number_of_merges <= 1)
1808 while (itr != rhs.end())
1835 :
list_base(node_pool, max_size_, pool_is_shared_)
1852 ETL_RESET_DEBUG_COUNT;
1859 while (p_first != p_last)
1861 destroy_data_node(
static_cast<data_node_t&
>(*p_first));
1862 p_first = p_first->next;
1875 void move_container(
ilist&& rhs)
1890 ETL_SET_DEBUG_COUNT(ETL_OBJECT_GET_DEBUG_COUNT(rhs));
1893 ETL_OBJECT_RESET_DEBUG_COUNT(rhs);
1894 rhs.join(rhs.terminal_node, rhs.terminal_node);
1902 while (first != last)
1930 node_t& from_node = *from.p_node;
1931 node_t& to_node = *to.p_node;
1934 join(*from_node.previous, *from_node.next);
1937 join(*to_node.previous, from_node);
1938 join(from_node, to_node);
1947 if ((first == to) || (last == to))
1952#if ETL_IS_DEBUG_BUILD
1956 ETL_ASSERT(item != to, ETL_ERROR(list_iterator));
1960 node_t& first_node = *first.p_node;
1961 node_t& last_node = *last.p_node;
1962 node_t& to_node = *to.p_node;
1963 node_t& final_node = *last_node.previous;
1966 join(*first_node.previous, last_node);
1969 join(*to_node.previous, first_node);
1970 join(final_node, to_node);
1976 void remove_node(
node_t& node)
1979 join(*node.previous, *node.next);
1982 destroy_data_node(
static_cast<data_node_t&
>(node));
1988 data_node_t& allocate_data_node(const_reference value)
1993 ::new (&(p_data_node->value)) T(value);
1994 ETL_INCREMENT_DEBUG_COUNT;
1996 return *p_data_node;
2003 data_node_t& allocate_data_node(rvalue_reference value)
2008 ::new (&(p_data_node->value)) T(etl::move(value));
2009 ETL_INCREMENT_DEBUG_COUNT;
2011 return *p_data_node;
2032 ETL_DECREMENT_DEBUG_COUNT;
2038#if defined(ETL_POLYMORPHIC_LIST) || defined(ETL_POLYMORPHIC_CONTAINERS)
2064 template <
typename T, const
size_t MAX_SIZE_>
2069 ETL_STATIC_ASSERT((MAX_SIZE_ > 0U),
"Zero capacity etl::list is not valid");
2071 static ETL_CONSTANT
size_t MAX_SIZE = MAX_SIZE_;
2075 typedef T value_type;
2077 typedef const T* const_pointer;
2078 typedef T& reference;
2079 typedef const T& const_reference;
2081 typedef T&& rvalue_reference;
2083 typedef size_t size_type;
2089 :
etl::
ilist<T>(node_pool, MAX_SIZE, false)
2105 :
etl::
ilist<T>(node_pool, MAX_SIZE, false)
2107 this->
assign(initial_size, T());
2113 list(
size_t initial_size,
const T& value)
2114 :
etl::
ilist<T>(node_pool, MAX_SIZE, false)
2116 this->
assign(initial_size, value);
2123 :
etl::
ilist<T>(node_pool, MAX_SIZE, false)
2136 :
etl::
ilist<T>(node_pool, MAX_SIZE, false)
2143 while (itr != other.end())
2145 this->push_back(etl::move(*itr));
2157 template <
typename TIterator>
2158 list(TIterator first, TIterator last,
typename etl::enable_if<!etl::is_integral<TIterator>::value,
int>
::type = 0)
2159 :
ilist<T>(node_pool, MAX_SIZE, false)
2161 this->
assign(first, last);
2164#if ETL_HAS_INITIALIZER_LIST
2168 list(std::initializer_list<T> init)
2169 :
ilist<T>(node_pool, MAX_SIZE, false)
2171 this->assign(init.begin(), init.end());
2194 this->move_container(etl::move(rhs));
2206 template <
typename T, const
size_t MAX_SIZE_>
2212#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST
2213 template <
typename... T>
2214 list(T...) -> list<
typename etl::common_type_t<T...>,
sizeof...(T)>;
2220#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
2221 template <
typename... T>
2222 constexpr auto make_list(T... t) -> etl::list<
typename etl::common_type_t<T...>,
sizeof...(T)>
2224 return {etl::forward<T>(t)...};
2231 template <
typename T>
2236 typedef T value_type;
2238 typedef const T* const_pointer;
2239 typedef T& reference;
2240 typedef const T& const_reference;
2241 typedef size_t size_type;
2257 :
etl::
ilist<T>(node_pool, node_pool.max_size(), true)
2273 :
etl::
ilist<T>(node_pool, node_pool.max_size(), true)
2275 this->
assign(initial_size, T());
2282 :
etl::
ilist<T>(node_pool, node_pool.max_size(), true)
2284 this->
assign(initial_size, value);
2303 :
etl::
ilist<T>(node_pool, node_pool.max_size(), true)
2316 :
etl::
ilist<T>(*other.p_node_pool, other.p_node_pool->max_size(), true)
2318 this->move_container(etl::move(other));
2324 list_ext(list_ext&& other,
etl::ipool& node_pool)
2325 :
etl::ilist<T>(node_pool, node_pool.max_size(), true)
2327 this->move_container(etl::move(other));
2334 template <
typename TIterator>
2335 list_ext(TIterator first, TIterator last,
etl::ipool& node_pool,
typename etl::enable_if<!etl::is_integral<TIterator>::value,
int>
::type = 0)
2336 :
ilist<T>(node_pool, node_pool.max_size(), true)
2338 this->
assign(first, last);
2341#if ETL_HAS_INITIALIZER_LIST
2346 :
ilist<T>(node_pool, node_pool.max_size(), true)
2348 this->assign(init.begin(), init.end());
2371 this->move_container(etl::move(rhs));
2406 template <
typename T>
2418 template <
typename T>
2421 return !(lhs == rhs);
2431 template <
typename T>
2434 return etl::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(), rhs.
end());
2444 template <
typename T>
2458 template <
typename T>
2461 return !(lhs > rhs);
2471 template <
typename T>
2474 return !(lhs < rhs);
const_iterator
Definition list.h:562
iterator.
Definition list.h:475
Template deduction guides.
Definition list.h:2233
list_ext(const list_ext &other, etl::ipool &node_pool)
Copy constructor. Explicit pool.
Definition list.h:2302
list_ext(size_t initial_size, etl::ipool &node_pool)
Construct from size.
Definition list.h:2272
void set_pool(etl::ipool &pool)
Set the pool instance.
Definition list.h:2380
list_ext(size_t initial_size, const T &value, etl::ipool &node_pool)
Construct from size and value.
Definition list.h:2281
list_ext(TIterator first, TIterator last, etl::ipool &node_pool, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Construct from range.
Definition list.h:2335
list_ext()
Default constructor.
Definition list.h:2248
etl::ipool & get_pool() const
Get the pool instance.
Definition list.h:2394
list_ext & operator=(const list_ext &rhs)
Assignment operator.
Definition list.h:2355
list_ext(etl::ipool &node_pool)
Default constructor.
Definition list.h:2256
~list_ext()
Destructor.
Definition list.h:2264
list_ext(const list_ext &other)
Copy constructor. Implicit pool.
Definition list.h:2290
A templated list implementation that uses a fixed size buffer.
Definition list.h:2066
~list()
Destructor.
Definition list.h:2096
list(const list &other)
Copy constructor.
Definition list.h:2122
list(size_t initial_size, const T &value)
Construct from size and value.
Definition list.h:2113
list(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Construct from range.
Definition list.h:2158
list & operator=(const list &rhs)
Assignment operator.
Definition list.h:2178
list(size_t initial_size)
Construct from size.
Definition list.h:2104
list()
Default constructor.
Definition list.h:2088
ETL_NODISCARD ETL_CONSTEXPR14 bool is_sorted(TIterator begin, TIterator end)
Definition algorithm.h:1660
ETL_CONSTEXPR14 TIterator remove(TIterator first, TIterator last, const T &value)
Definition algorithm.h:2344
ETL_CONSTEXPR14 bool operator!=(const etl::bitset< Active_Bits, TElement > &lhs, const etl::bitset< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
Definition bitset_new.h:2529
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
ilist(etl::ipool &node_pool, size_t max_size_, bool pool_is_shared_)
Constructor.
Definition list.h:1834
const_reverse_iterator rend() const
Gets the reverse end of the list.
Definition list.h:734
void clear()
Clears the list.
Definition list.h:1323
const_iterator cbegin() const
Gets the beginning of the list.
Definition list.h:694
iterator end()
Gets the end of the list.
Definition list.h:678
void push_back(const T &value)
Pushes a value to the back of the list.
Definition list.h:984
iterator emplace(const_iterator position)
Emplaces a value to the list at the specified position.
Definition list.h:1148
ilist(bool pool_is_shared_)
Constructor.
Definition list.h:1826
reference back()
Definition list.h:782
size_t size_type
The type used for determining the size of list.
Definition list.h:154
void reverse()
Reverses the list.
Definition list.h:195
const_reverse_iterator crend() const
Gets the reverse end of the list.
Definition list.h:750
reference emplace_front(const T1 &value1)
Emplaces a value to the front of the list.
Definition list.h:905
void splice(iterator to, ilist &other, iterator from)
Splices an element from another list to this.
Definition list.h:1443
size_type size() const
Gets the size of the list.
Definition list.h:237
void sort(TCompare compare)
Definition list.h:1676
size_type available() const
Definition list.h:281
void splice(iterator to, ilist &other, iterator first, iterator last)
Splices a range of elements from another list to this.
Definition list.h:1481
void join(node_t &left, node_t &right)
Join two nodes.
Definition list.h:342
void insert(const_iterator position, size_t n, const_reference value)
Inserts 'n' copies of a value to the list at the specified position.
Definition list.h:1221
void unique(TIsEqual isEqual)
Definition list.h:1383
void insert(const_iterator position, TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Inserts a range of values to the list at the specified position.
Definition list.h:1236
const_reverse_iterator rbegin() const
Gets the reverse beginning of the list.
Definition list.h:718
list_base(bool pool_is_shared_)
The constructor that is called from derived classes.
Definition list.h:351
etl::ipool * p_node_pool
The pool of data nodes used in the list.
Definition list.h:392
size_type max_size() const
Gets the maximum possible size of the list.
Definition list.h:221
void resize(size_t n)
Resizes the list.
Definition list.h:1289
list_base(etl::ipool &node_pool_, size_type max_size_, bool pool_is_shared_)
The constructor that is called from derived classes.
Definition list.h:362
bool full() const
Checks to see if the list is full.
Definition list.h:271
reverse_iterator rend()
Gets the reverse end of the list.
Definition list.h:726
reverse_iterator rbegin()
Gets the reverse beginning of the list.
Definition list.h:710
reference emplace_front()
Emplaces a value to the front of the list.
Definition list.h:888
ilist & operator=(const ilist &rhs)
Assignment operator.
Definition list.h:1787
iterator insert(const_iterator position, const_reference value)
Inserts a value to the list at the specified position.
Definition list.h:1105
size_type MAX_SIZE
The maximum size of the list.
Definition list.h:394
node_t terminal_node
The node that acts as the list start and end.
Definition list.h:393
void push_front(const T &value)
Pushes a value to the front of the list.
Definition list.h:848
void initialise()
Initialise the list.
Definition list.h:1842
bool pool_is_shared
If true then the pool is shared between lists.
Definition list.h:395
void splice(iterator to, ilist &other)
Splices from another list to this.
Definition list.h:1411
const_iterator end() const
Gets the end of the list.
Definition list.h:686
ETL_DECLARE_DEBUG_COUNT
Internal debugging.
Definition list.h:396
reference front()
Definition list.h:760
void pop_front()
Removes a value from the front of the list.
Definition list.h:973
const_iterator begin() const
Gets the beginning of the list.
Definition list.h:670
void merge(ilist &other)
Merge another list into this one. Both lists should be sorted.
Definition list.h:1526
bool is_trivial_list() const
Is the list a trivial length?
Definition list.h:292
void assign(size_t n, const T &value)
Assigns 'n' copies of a value to the list.
Definition list.h:828
iterator erase(const_iterator first, const_iterator last)
Erases a range of elements.
Definition list.h:1263
reference emplace_front(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Emplaces a value to the front of the list.
Definition list.h:956
void set_node_pool(etl::ipool &node_pool_)
Set the node pool instance.
Definition list.h:373
reference emplace_front(const T1 &value1, const T2 &value2, const T3 &value3)
Emplaces a value to the front of the list.
Definition list.h:939
void merge(ilist &other, TCompare compare)
Merge another list into this one. Both lists should be sorted.
Definition list.h:1535
void resize(size_t n, const_reference value)
Resizes the list.
Definition list.h:1297
size_type capacity() const
Gets the maximum possible size of the list.
Definition list.h:229
reference emplace_back()
Emplaces a value to the back of the list.
Definition list.h:1021
bool empty() const
Checks to see if the list is empty.
Definition list.h:263
etl::ipool * get_node_pool()
Get the node pool instance.
Definition list.h:382
iterator begin()
Gets the beginning of the list.
Definition list.h:662
void sort()
Definition list.h:1645
const_reference back() const
Definition list.h:793
void unique()
Definition list.h:1373
const_reference front() const
Definition list.h:771
node_t & get_head()
Get the head node.
Definition list.h:300
const node_t & get_head() const
Get the head node.
Definition list.h:308
void insert_node(node_t &position, node_t &node)
Insert a node before 'position'.
Definition list.h:332
const node_t & get_tail() const
Get the tail node.
Definition list.h:324
const_iterator cend() const
Gets the end of the list.
Definition list.h:702
const_reverse_iterator crbegin() const
Gets the reverse beginning of the list.
Definition list.h:742
~list_base()
Destructor.
Definition list.h:390
void remove_if(TPredicate predicate)
Removes according to a predicate.
Definition list.h:1352
void assign(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Definition list.h:806
node_t & get_tail()
Get the tail node.
Definition list.h:316
iterator erase(const_iterator position)
Erases the value at the specified position.
Definition list.h:1251
bool has_shared_pool() const
true if the list has a shared pool.
Definition list.h:187
void pop_back()
Removes a value from the back of the list.
Definition list.h:1094
reference emplace_front(const T1 &value1, const T2 &value2)
Emplaces a value to the front of the list.
Definition list.h:922
T * allocate()
Definition ipool.h:333
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR14 void swap(etl::typed_storage_ext< T > &lhs, etl::typed_storage_ext< T > &rhs) ETL_NOEXCEPT
Swap two etl::typed_storage_ext.
Definition alignment.h:856
ETL_CONSTEXPR14 bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1081
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1133
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1147
ETL_CONSTEXPR14 bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1093
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1106
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1120
Definition functional.h:305
The data node element in the list.
Definition list.h:426
iterator
Definition iterator.h:424
Definition functional.h:201
The node element in the list.
Definition list.h:160
void reverse()
Reverses the previous & next pointers.
Definition list.h:173
node_t()
Constructor.
Definition list.h:164
etl::conditional< etl::is_fundamental< T >::value||etl::is_pointer< T >::value, T, constT & >::type type
By default fundamental and pointer types are passed by value.
Definition parameter_type.h:46