Compatibility Members for QLinkedList
The following members of class QLinkedListare part of the Qt compatibility layer. We advise against using them in new code.
Public Functions
iterator | find(iterator from, const T & t) |
iterator | find(const T & t) |
const_iterator | find(const_iterator from, const T & t) const |
const_iterator | find(const T & t) const |
int | findIndex(const T & t) const |
iterator | remove(iterator pos) |
Member Function Documentation
iterator QLinkedList::find(iterator from, const T & t)
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;
iterator QLinkedList::find(const T & t)
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;
const_iterator QLinkedList::find(const_iterator from, const T & t) const
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;
const_iterator QLinkedList::find(const T & t) const
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;
int QLinkedList::findIndex(const T & t) const
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;
iterator QLinkedList::remove(iterator pos)
Use erase() instead.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.