![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QIntrusiveList class is a template class that provides a list of objects using static storage. More...
#include <qintrusivelist_p.h>
Classes | |
class | iterator |
Public Types | |
using | const_iterator = iterator_impl<const N *> |
using | Iterator = iterator |
using | ConstIterator = const_iterator |
Public Member Functions | |
~QIntrusiveList () | |
Destroy the list. | |
bool | isEmpty () const |
void | insert (N *n) |
Insert object into the list. | |
void | remove (N *n) |
Remove object from the list. | |
bool | contains (const N *n) const |
Returns true if the list contains object; otherwise returns false. | |
const N * | first () const |
Returns the first entry in this list, or null if the list is empty. | |
N * | first () |
iterator | begin () |
Returns an STL-style interator pointing to the first item in the list. | |
iterator | end () |
Returns an STL-style iterator pointing to the imaginary item after the last item in the list. | |
const_iterator | begin () const |
const_iterator | end () const |
Static Public Member Functions | |
template<typename O> | |
static O | next (O current) |
Returns the next object after current, or null if current is the last object. | |
The QIntrusiveList class is a template class that provides a list of objects using static storage.
QIntrusiveList creates a linked list of objects. Adding and removing objects from the QIntrusiveList is a constant time operation and is very quick. The list performs no memory allocations, but does require the objects being added to the list to contain a QIntrusiveListNode instance for the list's use. Even so, for small lists QIntrusiveList uses less memory than Qt's other list classes.
As QIntrusiveList uses storage inside the objects in the list, each object can only be in one list at a time. Objects are inserted by the insert() method. If the object is already in a list (including the one it is being inserted into) it is first removed, and then inserted at the head of the list. QIntrusiveList is a last-in-first-out list. That is, following an insert() the inserted object becomes the list's first() object.
Definition at line 46 of file qintrusivelist_p.h.
using QIntrusiveList< N, member >::const_iterator = iterator_impl<const N *> |
Definition at line 85 of file qintrusivelist_p.h.
using QIntrusiveList< N, member >::ConstIterator = const_iterator |
Definition at line 88 of file qintrusivelist_p.h.
using QIntrusiveList< N, member >::Iterator = iterator |
Definition at line 87 of file qintrusivelist_p.h.
|
inline |
|
inline |
Returns an STL-style interator pointing to the first item in the list.
Definition at line 132 of file qintrusivelist_p.h.
|
inline |
Definition at line 135 of file qintrusivelist_p.h.
|
inline |
Returns true if the list contains object; otherwise returns false.
Definition at line 111 of file qintrusivelist_p.h.
|
inline |
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
Definition at line 133 of file qintrusivelist_p.h.
|
inline |
Definition at line 140 of file qintrusivelist_p.h.
|
inline |
Definition at line 123 of file qintrusivelist_p.h.
|
inline |
Returns the first entry in this list, or null if the list is empty.
Definition at line 122 of file qintrusivelist_p.h.
|
inline |
Insert object into the list.
If object is a member of this, or another list, it will be removed and inserted at the head of this list.
Definition at line 94 of file qintrusivelist_p.h.
|
inline |
Definition at line 92 of file qintrusivelist_p.h.
|
inlinestatic |
Returns the next object after current, or null if current is the last object.
current cannot be null.
Definition at line 126 of file qintrusivelist_p.h.
|
inline |
Remove object from the list.
object must not be null.
Definition at line 105 of file qintrusivelist_p.h.