28#ifndef CMSIS_PLUS_UTILS_LISTS_H_
29#define CMSIS_PLUS_UTILS_LISTS_H_
44#pragma GCC diagnostic push
47#pragma clang diagnostic ignored "-Wc++98-compat"
225 template<
typename T,
typename N, T* N::* MP,
typename U = T>
567 template<
typename T,
typename N, N T::* MP,
typename U = T>
719 template<
typename T,
typename N, N T::* MP,
typename U = T>
866 return (
next_ ==
nullptr);
909 template<
typename T,
typename N, T* N::* MP,
typename U>
918 template<
typename T,
typename N, T* N::* MP,
typename U>
928 template<
typename T,
typename N, T* N::* MP,
typename U>
935 static_assert(std::is_convertible<U, T>::value ==
true,
"U must be implicitly convertible to T!");
938 template<
typename T,
typename N, T* N::* MP,
typename U>
942 return get_pointer ();
945 template<
typename T,
typename N, T* N::* MP,
typename U>
949 return *get_pointer ();
952 template<
typename T,
typename N, T* N::* MP,
typename U>
956 node_ =
static_cast<N*
> (node_->next ());
960 template<
typename T,
typename N, T* N::* MP,
typename U>
964 const auto tmp = *
this;
969 template<
typename T,
typename N, T* N::* MP,
typename U>
977 template<
typename T,
typename N, T* N::* MP,
typename U>
981 const auto tmp = *
this;
986 template<
typename T,
typename N, T* N::* MP,
typename U>
991 return node_ == other.
node_;
994 template<
typename T,
typename N, T* N::* MP,
typename U>
999 return node_ != other.
node_;
1003 template<
typename T,
typename N, T* N::* MP,
typename U>
1007 return (node_->*MP);
1010 template<
typename T,
typename N, T* N::* MP,
typename U>
1069 template<
typename T,
typename N, N T::* MP,
typename U>
1078 template<
typename T,
typename N, N T::* MP,
typename U>
1088 template<
typename T,
typename N, N T::* MP,
typename U>
1095 static_assert(std::is_convertible<U, T>::value ==
true,
"U must be implicitly convertible to T!");
1098 template<
typename T,
typename N, N T::* MP,
typename U>
1102 return get_pointer ();
1105 template<
typename T,
typename N, N T::* MP,
typename U>
1109 return *get_pointer ();
1112 template<
typename T,
typename N, N T::* MP,
typename U>
1120 template<
typename T,
typename N, N T::* MP,
typename U>
1124 const auto tmp = *
this;
1129 template<
typename T,
typename N, N T::* MP,
typename U>
1137 template<
typename T,
typename N, N T::* MP,
typename U>
1141 const auto tmp = *
this;
1146 template<
typename T,
typename N, N T::* MP,
typename U>
1151 return node_ == other.
node_;
1154 template<
typename T,
typename N, N T::* MP,
typename U>
1159 return node_ != other.
node_;
1162 template<
typename T,
typename N, N T::* MP,
typename U>
1171 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1179 template<
typename T,
typename N, N T::* MP,
typename U>
1188 template<
typename T,
typename N, N T::* MP,
typename U>
1195 template<
typename T,
typename N, N T::* MP,
typename U>
1205 template<
typename T,
typename N, N T::* MP,
typename U>
1212 template<
typename T,
typename N, N T::* MP,
typename U>
1216 if (uninitialized ())
1225 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1237 template<
typename T,
typename N, N T::* MP,
typename U>
1241 if (uninitialized ())
1250 template<
typename T,
typename N, N T::* MP,
typename U>
1259 template<
typename T,
typename N, N T::* MP,
typename U>
1268 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1276 template<
typename T,
typename N, N T::* MP,
typename U>
1286 return get_pointer (
link);
1289 template<
typename T,
typename N, N T::* MP,
typename U>
1299 return get_pointer (
link);
1305#pragma GCC diagnostic pop
Template for a double linked list iterator.
reference operator*() const
double_list_iterator & operator--()
N * iterator_pointer
Type of reference to the iterator internal pointer.
pointer get_pointer(void) const
Get the object node from the intrusive node.
pointer operator->() const
U value_type
Type of value "pointed to" by the iterator.
bool operator!=(const double_list_iterator &other) const
std::forward_iterator_tag iterator_category
Category of iterator.
iterator_pointer get_iterator_pointer() const
bool operator==(const double_list_iterator &other) const
U * pointer
Type of pointer to object "pointed to" by the iterator.
double_list_iterator & operator++()
constexpr double_list_iterator()
ptrdiff_t difference_type
Type of pointer difference.
iterator_pointer node_
Pointer to intrusive node.
U & reference
Type of reference to object "pointed to" by the iterator.
The core of a double linked list, pointers to next, previous.
~double_list_links()
Destruct the node.
double_list_links()
Construct a list node (explicitly set to nullptr).
Circular double linked list of nodes.
double_list()
Construct a list.
~double_list()
Destruct the list.
Template for an intrusive list iterator.
bool operator!=(const intrusive_list_iterator &other) const
std::forward_iterator_tag iterator_category
Category of iterator.
constexpr intrusive_list_iterator()
intrusive_list_iterator & operator++()
pointer operator->() const
iterator_pointer node_
Pointer to intrusive node.
N * iterator_pointer
Type of reference to the iterator internal pointer.
ptrdiff_t difference_type
Type of pointer difference.
iterator_pointer get_iterator_pointer() const
U value_type
Type of value "pointed to" by the iterator.
intrusive_list_iterator & operator--()
pointer get_pointer(void) const
Get the object node from the intrusive node.
reference operator*() const
bool operator==(const intrusive_list_iterator &other) const
U & reference
Type of reference to object "pointed to" by the iterator.
U * pointer
Type of pointer to object "pointed to" by the iterator.
ptrdiff_t difference_type
pointer get_pointer(iterator_pointer node) const
~intrusive_list()
Destruct the list.
pointer unlink_tail(void)
Unlink the last element from the list.
pointer unlink_head(void)
Unlink the first element from the list.
intrusive_list()
Construct an intrusive list.
iterator end() const
Iterator begin.
N * iterator_pointer
Type of reference to the iterator internal pointer.
iterator begin()
Iterator begin.
void link(reference node)
Add a node to the tail of the list.
Statically allocated core of a double linked list, pointers to next, previous.
bool unlinked(void)
Check if the node is unlinked.
static_double_list_links()
Construct a list node (BSS initialised).
static_double_list_links * prev_
Pointer to previous node.
static_double_list_links * next(void) const
static_double_list_links * next_
Pointer to next node.
~static_double_list_links()
Destruct the node.
static_double_list_links * prev(void) const
void unlink(void)
Remove the node from the list.
Statically allocated circular double linked list of nodes.
static_double_list_links head_
A list node used to point to head and tail.
void insert_after(static_double_list_links &node, static_double_list_links *after)
Insert a new node after existing node.
bool empty(void) const
Check if the list is empty.
~static_double_list()
Destruct the list.
void clear(void)
Clear the list.
volatile static_double_list_links * tail(void) const
Get the list tail.
volatile static_double_list_links * head(void) const
Get the list head.
bool uninitialized(void) const
Check if the list is uninitialised.
static_double_list()
Construct a list.
int link(const char *existing, const char *_new)