148 return static_cast<T*
>(this->
the_last);
154 return (elem ==
last()) ? nullptr : elem->next();
160 return (elem ==
first()) ? nullptr : elem->prev();
173 last()->next() = elem;
174 elem->prev() =
last();
187 elem->next() =
first();
188 first()->prev() = elem;
205 elem->next() = after->next();
206 elem->prev() = after;
207 after->next() = elem->next()->prev() = elem;
238 list.
last()->next() = after->next();
239 list.
first()->prev() = after;
240 after->next() = list.
first();
245 list.
last()->next()->prev() = list.
last();
266 if(
first() ==
nullptr)
269 else if(elem ==
last())
273 elem->next()->prev() = elem->prev();
274 elem->prev()->next() = elem->next();
281 if(
first() !=
nullptr && list.
first() !=
nullptr)
299 for(; after->next() != list.
first(); after = after->next())
305 after->next() = list.
last()->next();
326 for(elem =
last(); elem; elem =
prev(elem))
328 elem->prev() =
reinterpret_cast<T*
>(
329 reinterpret_cast<char*
>(elem->prev()) + delta);
336#ifdef ENABLE_CONSISTENCY_CHECKS
337 const T* my_first =
first();
338 const T* my_last =
last();
340 for(
const T* it = my_first; it; it =
next(it))
342 if(it != my_first && it->prev()->next() != it)
345 if(it != my_last && it->next()->prev() != it)
365 IdList(T* pfirst =
nullptr, T* plast =
nullptr,
bool pDestroyElements =
false)
366 :
IsList<T>(pfirst, plast, pDestroyElements)
IdElement(const T &old)
copy constructor.
IdElement< T > *const & next() const
returns the next element in the IdList.
IdElement()
default constructor.
IdElement< T > *const & prev() const
returns the previous element in the IdList.
IdElement< T > *& prev()
returns the previous element in the IdList (writeable).
IdElement< T > *& next()
returns the next element in the IdList (writeable).
IdElement< T > * theprev
pointer to previous element in the IdList
IdElement< T > * thenext
pointer to next element in the IdList
Generic Real linked list.
void remove(T *elem)
removes elem from list.
T * last() const
returns last element in list.
T * first() const
returns first element in list.
void prepend(IdList< T > &list)
prepends list at beginnig of list.
void append(IdList< T > &list)
appends list to end of list.
bool isConsistent() const
consistency check.
void insert(T *elem, T *after)
inserts elem after after.
void append(T *elem)
appends elem to end of list.
T * prev(const T *elem) const
returns predecessor of elem or nullptr, if elem is the first element.
void remove_next(T *after)
removes element following after.
void prepend(T *elem)
prepends elem at beginnig of list.
void insert(IdList< T > &list, T *after)
inserts list after after.
T * next(const T *elem) const
returns successor of elem or nullptr, if elem is the last element.
void remove(IdList< T > &list)
removes sublist list.
void move(ptrdiff_t delta)
adjusts list pointers to a new memory address.
IdList(T *pfirst=nullptr, T *plast=nullptr, bool pDestroyElements=false)
default constructor.
Generic single linked list.
bool isConsistent() const
consistency check.
T * the_last
the last element in the IsList.
T * the_first
the first element in the IsList.
int find(const T *elem) const
returns the position of element elem within IsList.
void move(ptrdiff_t delta)
adjusts list pointers to a new memory address.
Generic single linked list.
Everything should be within this namespace.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)