12#ifndef CMSIS_PLUS_UTILS_LISTS_H_
13#define CMSIS_PLUS_UTILS_LISTS_H_
28#pragma GCC diagnostic push
30#pragma clang diagnostic ignored "-Wc++98-compat"
207 template <
typename T,
typename N, T* N::* MP,
typename U = T>
542 template <
typename T,
typename N, N T::* MP,
typename U = T>
688 template <
typename T,
typename N, N T::* MP,
typename U = T>
831 return (
next_ ==
nullptr);
871 template <
typename T,
typename N, T* N::* MP,
typename U>
877 template <
typename T,
typename N, T* N::* MP,
typename U>
884 template <
typename T,
typename N, T* N::* MP,
typename U>
887 : node_{ &(element.*MP) }
889 static_assert (std::is_convertible<U, T>::value ==
true,
890 "U must be implicitly convertible to T!");
893 template <
typename T,
typename N, T* N::* MP,
typename U>
897 return get_pointer ();
900 template <
typename T,
typename N, T* N::* MP,
typename U>
904 return *get_pointer ();
907 template <
typename T,
typename N, T* N::* MP,
typename U>
911 node_ =
static_cast<N*
> (node_->next ());
915 template <
typename T,
typename N, T* N::* MP,
typename U>
919 const auto tmp = *
this;
924 template <
typename T,
typename N, T* N::* MP,
typename U>
932 template <
typename T,
typename N, T* N::* MP,
typename U>
936 const auto tmp = *
this;
941 template <
typename T,
typename N, T* N::* MP,
typename U>
946 return node_ == other.
node_;
949 template <
typename T,
typename N, T* N::* MP,
typename U>
954 return node_ != other.
node_;
958 template <
typename T,
typename N, T* N::* MP,
typename U>
965 template <
typename T,
typename N, T* N::* MP,
typename U>
1021 template <
typename T,
typename N, N T::* MP,
typename U>
1027 template <
typename T,
typename N, N T::* MP,
typename U>
1034 template <
typename T,
typename N, N T::* MP,
typename U>
1037 : node_{ &(element.*MP) }
1039 static_assert (std::is_convertible<U, T>::value ==
true,
1040 "U must be implicitly convertible to T!");
1043 template <
typename T,
typename N, N T::* MP,
typename U>
1047 return get_pointer ();
1050 template <
typename T,
typename N, N T::* MP,
typename U>
1054 return *get_pointer ();
1057 template <
typename T,
typename N, N T::* MP,
typename U>
1065 template <
typename T,
typename N, N T::* MP,
typename U>
1069 const auto tmp = *
this;
1074 template <
typename T,
typename N, N T::* MP,
typename U>
1082 template <
typename T,
typename N, N T::* MP,
typename U>
1086 const auto tmp = *
this;
1091 template <
typename T,
typename N, N T::* MP,
typename U>
1096 return node_ == other.
node_;
1099 template <
typename T,
typename N, N T::* MP,
typename U>
1104 return node_ != other.
node_;
1107 template <
typename T,
typename N, N T::* MP,
typename U>
1117 &(
static_cast<T*
> (
nullptr)->*MP));
1121 return reinterpret_cast<pointer> (
1125 template <
typename T,
typename N, N T::* MP,
typename U>
1134 template <
typename T,
typename N, N T::* MP,
typename U>
1139 template <
typename T,
typename N, N T::* MP,
typename U>
1148 template <
typename T,
typename N, N T::* MP,
typename U>
1153 template <
typename T,
typename N, N T::* MP,
typename U>
1157 if (uninitialized ())
1166 &(
static_cast<T*
> (
nullptr)->*MP));
1174#pragma GCC diagnostic push
1175#if defined(__clang__)
1176#elif defined(__GNUC__)
1177#pragma GCC diagnostic ignored "-Waggregate-return"
1183 template <
typename T,
typename N, N T::* MP,
typename U>
1187 if (uninitialized ())
1195 template <
typename T,
typename N, N T::* MP,
typename U>
1203#pragma GCC diagnostic pop
1205 template <
typename T,
typename N, N T::* MP,
typename U>
1215 &(
static_cast<T*
> (
nullptr)->*MP));
1219 return reinterpret_cast<pointer> (
1223 template <
typename T,
typename N, N T::* MP,
typename U>
1233 return get_pointer (
link);
1236 template <
typename T,
typename N, N T::* MP,
typename U>
1246 return get_pointer (
link);
1252#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)