40 LinkImpl()
INLINE = default;
41 LinkImpl(const LinkImpl&) = delete;
42 LinkImpl& operator=(const LinkImpl&) = delete;
45 LinkImpl* next_ =
nullptr;
46 friend class LinkedListImpl;
47 template<class T, class B> friend struct
types_traits::derives_from;
53 LinkedListImpl()
INLINE = default;
54 LinkedListImpl(const LinkedListImpl&) = delete;
55 LinkedListImpl& operator=(const LinkedListImpl&) = delete;
56 void insert(LinkImpl* item);
57 bool remove(LinkImpl* item);
58 template<typename
F>
void traverse(
F f);
61 LinkImpl* head_ =
nullptr;
80 template<typename T_> class
LinkedList : private LinkedListImpl
87 UNUSED DERIVES_FROM_LINK dummy = DERIVES_FROM_LINK();
105 LinkedListImpl::insert(&item);
120 return LinkedListImpl::remove(&item);
135 while (current !=
nullptr)
137 T* next = current->next();
138 if (func(*current)) remove(*current);
167 template<
typename T_>
class Link :
private LinkImpl
217 template<
typename T_,
typename TREF_ = T_&,
typename CTREF_ = const T_&>
259 return (TYPE*) next_;
264 friend class LinkedList<TYPE>;
A wrapper for items stored in a LinkedList.
T_ T
The type of item wrapped by this class.
A wrapper for items stored in a LinkedList.
CTREF item() const
Return a constant reference to the wrapped item.
CTREF_ CTREF
The constant reference type of item wrapped by this class.
T_ T
The type of item wrapped by this class.
LinkWrapper(CTREF item)
Create a wrapper, usable in a LinkedList, for item.
TREF_ TREF
The reference type of item wrapped by this class.
TREF item()
Return a reference to the wrapped item.
Linked list of type T_ items.
void traverse(F func)
Traverse all items of this list and execute f functor.
void insert(T &item) INLINE
Insert item at the beginning of this list.
bool remove(T &item) INLINE
Remove item from this list.
T_ T
The type of items in this list.
#define INLINE
Specific GCC attribute to force the compiler to always inline code of a given function.
#define UNUSED
Specific GCC attribute to declare an argument or variable unused, so that the compiler does not emit ...
#define F(ptr)
Force string constant to be stored as flash storage.
Contains all FastArduino generic containers:
Defines traits and utility methods for standard types, like uint16_t.
Utility class that checks, at compile-time, that type T is a subtype of type B.
Useful traits for common types.
General utilities API that have broad application in programs.