Template Class IntrusiveList
Defined in File intrusive_list.h
Nested Relationships
Nested Types
Template Parameter Order
typename T
Class Documentation
-
template<typename T, Node<T> T::* Member>
class IntrusiveList Doubly linked intrusive list.
Can be used to link objects in together in a doubly linked list without having the list manage the object. The Node<T> object is used in the managed objects to store the relations
struct Data { Data() : node(this), ... { ... } ... Node<Data> node; } std::array<N, Data> arr; IntrusiveList<Data, &Data::node> list; // The list object can now be used to link objects in arr
- Template Parameters:
T – Type of the object that the list has to link
T::*Member – Member pointer to the node object in T
Public Types
-
using Iterator = BaseIterator<T, Node<T>>
-
using ConstIterator = BaseIterator<const T, const Node<T>>
Public Functions
-
inline IntrusiveList()
Construct a new Linked List object.
-
IntrusiveList(const IntrusiveList&) = delete
-
IntrusiveList &operator=(const IntrusiveList&) = delete
-
inline IntrusiveList(IntrusiveList &&o)
-
inline IntrusiveList &operator=(IntrusiveList &&o)
-
inline void push_back(T &owner)
Push element to the back of the timeout list.
- Parameters:
owner – Reference to the owner of the node object that has to be appended to the list
-
inline void delete_elem(T &owner)
Delete element from the list.
- Parameters:
owner – Reference to the owner of the node object that has to be deleted from the list
-
inline bool in_list(const T &owner) const
Check if element is present in list.
- Parameters:
owner – Reference to the owner of the node object to check
- Returns:
true Element is present
- Returns:
false Element is not present
-
inline size_t size() const
Get number of objects in list.
- Returns:
size_t number of objects in list
-
inline ConstIterator begin() const
-
inline ConstIterator end() const
Friends
-
inline friend void swap(IntrusiveList &a, IntrusiveList &b)
-
template<typename It, typename NodeType>
struct BaseIterator Iterator for IntrusiveList.
- Template Parameters:
T – Type of the object that the list has to link
T::*Member – Member pointer to the node object in T
It – Base return type for derefence operator and arrow operator (T or const T)
NodeType – Type for storing the Node<T> object (Node<T> or const Node<T>)
Public Functions
-
inline BaseIterator(NodeType *node_ptr)
Construct a new Iterator object.
- Parameters:
node_ptr – Pointer to the node in owner object
-
inline It &operator*() const
Dereference operator.
- Returns:
T& Reference to owner of the node in the iterator
-
inline It *operator->() const
Arrow operator.
- Returns:
T* Pointer to owner of the node in the iterator
-
inline BaseIterator &operator++()
Prefix increment.
- Returns:
Iterator& Reference to the current iterator
-
inline BaseIterator operator++(int)
Postfix increment.
- Returns:
Iterator New iterator with previous value
Friends
-
inline friend bool operator==(const BaseIterator &a, const BaseIterator &b)
-
inline friend bool operator!=(const BaseIterator &a, const BaseIterator &b)