Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.
If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.
For example, if you have code like
QLinkedList::iterator i = list->find(from, value);
you can rewrite it as
QLinkedList::iterator i = from; while (i != list->end() && *i != value) ++i;
This is an overloaded member function, provided for convenience.
If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.
For example, if you have code like
QLinkedList::iterator i = list->find(value);
you can rewrite it as
QLinkedList::iterator i = list->begin(); while (i != list->end() && *i != value) ++i;
This is an overloaded member function, provided for convenience.
If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.
For example, if you have code like
QLinkedList::const_iterator i = list->find(from, value);
you can rewrite it as
QLinkedList::const_iterator i = from; while (i != list->end() && *i != value) ++i;
This is an overloaded member function, provided for convenience.
If you need random access to a data structure then QList, QVector, QMap, or QHash, are all better choices than QLinkedList.
For example, if you have code like
QLinkedList::const_iterator i = list->find(value);
you can rewrite it as
QLinkedList::const_iterator i = list->begin(); while (i != list->end() && *i != value) ++i;
If you need indexes then QList or QVector are better choices than QLinkedList.
For example, if you have code like
int index = list->findIndex(value);
you can rewrite it as
int index = 0; bool found = false; for (const_iterator i = list->begin(); i != list->end(); ++i; ++index) if (*i == value) { found = true; break; } if (!found) index = -1;
Use erase() instead.
Copyright © 2008 Trolltech | Trademarks | Qt 4.3.5 |