4 #include <boost/static_assert.hpp> 5 #include <boost/type_traits.hpp> 8 namespace frechet {
namespace data {
32 #ifdef LINKED_LIST_VDESTRUCTOR 68 T*
next(
bool forward) {
return (T*)
link[(int)forward]; }
267 template<
typename Cloner>
270 for(T* p = that.
first(); p; p = p->next())
336 #endif // LINKEDLIST_H abstract base class for LinkedList
BLinkedListElement *& prev()
BLinkedList(bool circular=false)
default constructor; creates an empty list
An intrusive double-linked list, similar to boost::intrusive.
void insert_after(BLinkedListElement *el, BLinkedListElement *after)
insert a new element after a certain element of the list; the list takes ownership of the element....
BLinkedListElement *& next()
void insert_last(BLinkedListElement *el)
insert a new element at the end of the list; the list takes ownership of the element....
LinkedList & operator=(LinkedList &&that)
move assigment operator
BLinkedListElement()
empty constructor
LinkedList(LinkedList &&that)
move constructor; takes ownership of another list
global definitions for all algorithms.
LinkedList(const LinkedList &that, Cloner cloner)
deep copy constructor
BLinkedListElement * operator[](int i) const
positional lookup (note: O(n), use with care)
int concat(BLinkedList &that)
append all elements of another list, taking ownership of the new elements
void insert_first(BLinkedListElement *el)
insert a new element at the beginning of the list; the list takes ownership of the element....
BLinkedListElement * remove(BLinkedListElement *el)
remove an element from the list and release its memory
bool _circular
if true, this is a circular list, i.e. the last element is connected to the first element
void setCircular(bool)
update the circularity property of this list
void swap(LinkedList< T > &that)
exchange all elements with another list, taking ownership of the new elements
void insert_before(BLinkedListElement *el, BLinkedListElement *before)
insert a new element before a certain element of the list; the list takes ownership of the element....
void dispose()
release all elements and update anchors
int swap(BLinkedList &that)
exchange all elements with another list, taking ownership of the new elements
T * operator[](int i) const
positional lookup (note: O(n), use with care)
base class for elements of a BLinkedList
BLinkedListElement * _last
the last element in the list (or nullptr)
void clear()
release all elements
BLinkedListElement * link[2]
double links (previous, next)
LinkedList()
empty constructor; creates an empty list
BLinkedList(const BLinkedList &)
copy constructor. do not use.
int _size
current number of elements
BLinkedListElement * _first
the first element in the list (or nullptr)
base template for elements of a LinkedList
LinkedListElement()
empty constructor
void releaseAll()
release all elements
~BLinkedList()
destructor; releases all element objects
BLinkedList & operator=(BLinkedList &&that)
move assigment operator
BOOST_STATIC_ASSERT((boost::is_base_of< BLinkedListElement, T >::value))