13#ifndef CMSIS_PLUS_UTILS_LISTS_H_
14#define CMSIS_PLUS_UTILS_LISTS_H_
29#pragma GCC diagnostic push
31#pragma clang diagnostic ignored "-Wc++98-compat"
209 template<
typename T,
typename N, T* N::* MP,
typename U = T>
551 template<
typename T,
typename N, N T::* MP,
typename U = T>
703 template<
typename T,
typename N, N T::* MP,
typename U = T>
849 return (
next_ ==
nullptr);
891 template<
typename T,
typename N, T* N::* MP,
typename U>
899 template<
typename T,
typename N, T* N::* MP,
typename U>
908 template<
typename T,
typename N, T* N::* MP,
typename U>
915 static_assert(std::is_convertible<U, T>::value ==
true,
"U must be implicitly convertible to T!");
918 template<
typename T,
typename N, T* N::* MP,
typename U>
922 return get_pointer ();
925 template<
typename T,
typename N, T* N::* MP,
typename U>
929 return *get_pointer ();
932 template<
typename T,
typename N, T* N::* MP,
typename U>
936 node_ =
static_cast<N*
> (node_->next ());
940 template<
typename T,
typename N, T* N::* MP,
typename U>
944 const auto tmp = *
this;
949 template<
typename T,
typename N, T* N::* MP,
typename U>
957 template<
typename T,
typename N, T* N::* MP,
typename U>
961 const auto tmp = *
this;
966 template<
typename T,
typename N, T* N::* MP,
typename U>
971 return node_ == other.
node_;
974 template<
typename T,
typename N, T* N::* MP,
typename U>
979 return node_ != other.
node_;
983 template<
typename T,
typename N, T* N::* MP,
typename U>
990 template<
typename T,
typename N, T* N::* MP,
typename U>
1048 template<
typename T,
typename N, N T::* MP,
typename U>
1056 template<
typename T,
typename N, N T::* MP,
typename U>
1065 template<
typename T,
typename N, N T::* MP,
typename U>
1072 static_assert(std::is_convertible<U, T>::value ==
true,
"U must be implicitly convertible to T!");
1075 template<
typename T,
typename N, N T::* MP,
typename U>
1079 return get_pointer ();
1082 template<
typename T,
typename N, N T::* MP,
typename U>
1086 return *get_pointer ();
1089 template<
typename T,
typename N, N T::* MP,
typename U>
1097 template<
typename T,
typename N, N T::* MP,
typename U>
1101 const auto tmp = *
this;
1106 template<
typename T,
typename N, N T::* MP,
typename U>
1114 template<
typename T,
typename N, N T::* MP,
typename U>
1118 const auto tmp = *
this;
1123 template<
typename T,
typename N, N T::* MP,
typename U>
1128 return node_ == other.
node_;
1131 template<
typename T,
typename N, N T::* MP,
typename U>
1136 return node_ != other.
node_;
1139 template<
typename T,
typename N, N T::* MP,
typename U>
1148 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1156 template<
typename T,
typename N, N T::* MP,
typename U>
1165 template<
typename T,
typename N, N T::* MP,
typename U>
1171 template<
typename T,
typename N, N T::* MP,
typename U>
1181 template<
typename T,
typename N, N T::* MP,
typename U>
1187 template<
typename T,
typename N, N T::* MP,
typename U>
1191 if (uninitialized ())
1200 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1209#pragma GCC diagnostic push
1210#if defined(__clang__)
1211#elif defined(__GNUC__)
1212#pragma GCC diagnostic ignored "-Waggregate-return"
1218 template<
typename T,
typename N, N T::* MP,
typename U>
1222 if (uninitialized ())
1231 template<
typename T,
typename N, N T::* MP,
typename U>
1240#pragma GCC diagnostic pop
1242 template<
typename T,
typename N, N T::* MP,
typename U>
1251 reinterpret_cast<difference_type> (&(
static_cast<T*
> (
nullptr)->*MP));
1259 template<
typename T,
typename N, N T::* MP,
typename U>
1269 return get_pointer (
link);
1272 template<
typename T,
typename N, N T::* MP,
typename U>
1282 return get_pointer (
link);
1288#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)