#include <qsortedlist.h>
Inheritance diagram for FX::QSortedList< type, allocator >:
This is one of probably the first five classes I wrote for Tornado and it's basically an always sorted FX::QPtrList. The list is always sorted according to the < and == operators you provide for your list item and find() performs a binary instead of a linear search. Binary searches are extremely efficient on sorted data with O(lg n) most compares as compared against O(n) for linear searches. On a 1024 item list, this means a maximum of ten compares as against 1024 compares!
Definition at line 52 of file qsortedlist.h.
Public Member Functions | |
QSortedList (bool wantAutoDel=false) | |
QSortedList (const QSortedList< type, allocator > &o) | |
~QSortedList () | |
QSortedList< type, allocator > & | operator= (const QSortedList< type, allocator > &l) |
bool | operator== (const QSortedList< type, allocator > &list) const |
virtual int | compareItems (type *a, type *b) const |
bool | remove (const type *d) |
bool | removeRef (const type *d) |
bool | take (const type *d) |
bool | takeRef (const type *d) |
int | find (const type *d) const |
QSortedListIterator< type, allocator > | findIter (const type *d) const |
type * | findP (const type *d) const |
int | findClosest (const type *d) const |
QSortedListIterator< type, allocator > | findClosestIter (const type *d) const |
type * | findClosestP (const type *d) const |
bool | insert (const type *d) |
void | merge (QSortedList< type, allocator > &list, bool exclusive=false) |
template<> | |
int | compareItems (void *a, void *b) const |