12 #ifdef LINKED_LIST_VDESTRUCTOR 13 BLinkedListElement::~BLinkedListElement() { }
17 : _first(0), _last(0),
18 _size(0), _circular(circular) {}
21 : _first(that._first),
24 _circular(that._circular)
134 Q_ASSERT(
_size >= 0);
159 Q_ASSERT(that.
empty());
188 while(res && (i-- > 0)) res = res->
next();
192 while(res && (++i < 0)) res = res->
prev();
199 this->
_first = that._first;
200 this->
_last = that._last;
201 this->
_size = that._size;
abstract base class for LinkedList
BLinkedListElement *& prev()
BLinkedList(bool circular=false)
default constructor; creates an empty list
void swap(gpuword **A, gpuword **B)
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....
BLinkedListElement()
empty constructor
global definitions for all algorithms.
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 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
base class for elements of a BLinkedList
BLinkedListElement * _last
the last element in the list (or nullptr)
void clear()
release all elements
int _size
current number of elements
BLinkedListElement * _first
the first element in the list (or nullptr)
void releaseAll()
release all elements
~BLinkedList()
destructor; releases all element objects
BLinkedList & operator=(BLinkedList &&that)
move assigment operator