1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the core module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "qlinkedlist.h"
31
QLinkedListData QLinkedListData::shared_null = {
32
&QLinkedListData::shared_null, &QLinkedListData::shared_null, Q_ATOMIC_INIT(1), 0, true
35
/*! \class QLinkedList
36
\brief The QLinkedList class is a template class that provides linked lists.
43
QLinkedList\<T\> is one of Qt's generic \l{container classes}. It
44
stores a list of values and provides iterator-based access as
45
well as \l{constant time} insertions and removals.
47
QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar
48
functionality. Here's an overview:
51
\i For most purposes, QList is the right class to use. Its
52
index-based API is more convenient than QLinkedList's
53
iterator-based API, and it is usually faster than
54
QVector because of the way it stores its items in
55
memory. It also expands to less code in your executable.
56
\i If you need a real linked list, with guarantees of \l{constant
57
time} insertions in the middle of the list and iterators to
58
items rather than indexes, use QLinkedList.
59
\i If you want the items to occupy adjacent memory positions,
63
Here's an example of a QLinkedList that stores integers and a
64
QLinkedList that stores QTime values:
67
QLinkedList<int> integerList;
68
QLinkedList<QTime> timeList;
71
QLinkedList stores a list of items. The default constructor
72
creates an empty list. To insert items into the list, you can use
76
QLinkedList<QString> list;
77
list << "one" << "two" << "three";
78
// list: ["one", "two", "three"]
81
If you want to get the first or last item in a linked list, use
82
first() or last(). If you want to remove an item from either end
83
of the list, use removeFirst() or removeLast(). If you want to
84
remove all occurrences of a given value in the list, use
87
A common requirement is to remove the first or last item in the
88
list and do something with it. For this, QLinkedList provides
89
takeFirst() and takeLast(). Here's a loop that removes the items
90
from a list one at a time and calls \c delete on them:
92
QLinkedList<QWidget *> list;
94
while (!list.isEmpty())
95
delete list.takeFirst();
98
QLinkedList's value type must be an \l{assignable data type}.
99
This covers most data types that are commonly used, but the
100
compiler won't let you, for example, store a QWidget as a value;
101
instead, store a QWidget *. A few functions have additional
102
requirements; for example, contains() and removeAll() expect the
103
value type to support \c operator==(). These requirements are
104
documented on a per-function basis.
106
If you want to insert, modify, or remove items in the middle of
107
the list, you must use an iterator. QLinkedList provides both
108
\l{Java-style iterators} (QLinkedListIterator and
109
QMutableLinkedListIterator) and \l{STL-style iterators}
110
(QLinkedList::const_iterator and QLinkedList::iterator). See the
111
documentation for these classes for details.
113
\sa QListIterator, QMutableListIterator, QList, QVector
116
/*! \fn QLinkedList::QLinkedList()
118
Constructs an empty list.
121
/*! \fn QLinkedList::QLinkedList(const QLinkedList &other)
123
Constructs a copy of \a other.
125
This operation occurs in \l{constant time}, because QLinkedList
126
is \l{implicitly shared}. This makes returning a QLinkedList from
127
a function very fast. If a shared instance is modified, it will
128
be copied (copy-on-write), and this takes \l{linear time}.
133
/*! \fn QLinkedList::~QLinkedList()
135
Destroys the list. References to the values in the list, and all
136
iterators over this list, become invalid.
139
/*! \fn QLinkedList &QLinkedList::operator=(const QLinkedList &other)
141
Assigns \a other to this list and returns a reference to this
145
/*! \fn bool QLinkedList::operator==(const QLinkedList &other) const
147
Returns true if \a other is equal to this list; otherwise returns
150
Two lists are considered equal if they contain the same values in
153
This function requires the value type to implement \c
159
/*! \fn bool QLinkedList::operator!=(const QLinkedList &other) const
161
Returns true if \a other is not equal to this list; otherwise
164
Two lists are considered equal if they contain the same values in
167
This function requires the value type to implement \c
173
/*! \fn int QLinkedList::size() const
175
Returns the number of items in the list.
177
\sa isEmpty(), count()
180
/*! \fn void QLinkedList::detach()
185
/*! \fn bool QLinkedList::isDetached() const
190
/*! \fn void QLinkedList::setSharable(bool sharable)
195
/*! \fn bool QLinkedList::isEmpty() const
197
Returns true if the list contains no items; otherwise returns
203
/*! \fn void QLinkedList::clear()
205
Removes all the items in the list.
210
/*! \fn void QLinkedList::append(const T &value)
212
Inserts \a value at the end of the list.
216
QLinkedList<QString> list;
219
list.append("three");
220
// list: ["one", "two", "three"]
223
This is the same as list.insert(end(), \a value).
225
\sa operator<<(), prepend(), insert()
228
/*! \fn void QLinkedList::prepend(const T &value)
230
Inserts \a value at the beginning of the list.
234
QLinkedList<QString> list;
237
list.prepend("three");
238
// list: ["three", "two", "one"]
241
This is the same as list.insert(begin(), \a value).
243
\sa append(), insert()
246
/*! \fn int QLinkedList::removeAll(const T &value)
248
Removes all occurrences of \a value in the list.
253
list << "sun" << "cloud" << "sun" << "rain";
254
list.removeAll("sun");
255
// list: ["cloud", "rain"]
258
This function requires the value type to have an implementation of
264
/*! \fn bool QLinkedList::contains(const T &value) const
266
Returns true if the list contains an occurrence of \a value;
267
otherwise returns false.
269
This function requires the value type to have an implementation of
272
\sa QListIterator::findNext(), QListIterator::findPrevious()
275
/*! \fn int QLinkedList::count(const T &value) const
277
Returns the number of occurrences of \a value in the list.
279
This function requires the value type to have an implementation of
285
/*! \fn QLinkedList::iterator QLinkedList::begin()
287
Returns an \l{STL-style iterator} pointing to the first item in
290
\sa constBegin(), end()
293
/*! \fn QLinkedList::const_iterator QLinkedList::begin() const
298
/*! \fn QLinkedList::const_iterator QLinkedList::constBegin() const
300
Returns a const \l{STL-style iterator} pointing to the first item
303
\sa begin(), constEnd()
306
/*! \fn QLinkedList::iterator QLinkedList::end()
308
Returns an \l{STL-style iterator} pointing to the imaginary item
309
after the last item in the list.
311
\sa begin(), constEnd()
314
/*! \fn QLinkedList::const_iterator QLinkedList::end() const
319
/*! \fn QLinkedList::const_iterator QLinkedList::constEnd() const
321
Returns a const \l{STL-style iterator} pointing to the imaginary
322
item after the last item in the list.
324
\sa constBegin(), end()
327
/*! \fn QLinkedList::iterator QLinkedList::insert(iterator before, const T &value)
329
Inserts \a value in front of the item pointed to by the iterator
330
\a before. Returns an iterator pointing at the inserted item.
335
/*! \fn QLinkedList::iterator QLinkedList::erase(iterator pos)
337
Removes the item pointed to by the iterator \a pos from the list,
338
and returns an iterator to the next item in the list (which may be
344
/*! \fn QLinkedList::iterator QLinkedList::erase(iterator begin, iterator end)
348
Removes all the items from \a begin up to (but not including) \a
352
/*! \typedef QLinkedList::Iterator
354
Qt-style synonym for QList::iterator.
357
/*! \typedef QLinkedList::ConstIterator
359
Qt-style synonym for QList::const_iterator.
363
\typedef QLinkedList::size_type
365
Typedef for int. Provided for STL compatibility.
369
\typedef QLinkedList::value_type
371
Typedef for T. Provided for STL compatibility.
375
\typedef QLinkedList::pointer
377
Typedef for T *. Provided for STL compatibility.
381
\typedef QLinkedList::const_pointer
383
Typedef for const T *. Provided for STL compatibility.
387
\typedef QLinkedList::reference
389
Typedef for T &. Provided for STL compatibility.
393
\typedef QLinkedList::const_reference
395
Typedef for const T &. Provided for STL compatibility.
398
/*! \fn int QLinkedList::count() const
403
/*! \fn T& QLinkedList::first()
405
Returns a reference to the first item in the list. This function
406
assumes that the list isn't empty.
408
\sa last(), isEmpty()
411
/*! \fn const T& QLinkedList::first() const
416
/*! \fn T& QLinkedList::last()
418
Returns a reference to the last item in the list. This function
419
assumes that the list isn't empty.
421
\sa first(), isEmpty()
424
/*! \fn const T& QLinkedList::last() const
429
/*! \fn void QLinkedList::removeFirst()
431
Removes the first item in the list.
433
This is the same as erase(begin()).
435
\sa removeLast(), erase()
438
/*! \fn void QLinkedList::removeLast()
440
Removes the last item in the list.
442
\sa removeFirst(), erase()
445
/*! \fn T QLinkedList::takeFirst()
447
Removes the first item in the list and returns it.
449
If you don't use the return value, removeFirst() is more
452
\sa takeLast(), removeFirst()
455
/*! \fn T QLinkedList::takeLast()
457
Removes the last item in the list and returns it.
459
If you don't use the return value, removeLast() is more
462
\sa takeFirst(), removeLast()
465
/*! \fn void QLinkedList::push_back(const T &value)
467
This function is provided for STL compatibility. It is equivalent
471
/*! \fn void QLinkedList::push_front(const T &value)
473
This function is provided for STL compatibility. It is equivalent
474
to prepend(\a value).
477
/*! \fn T& QLinkedList::front()
479
This function is provided for STL compatibility. It is equivalent
483
/*! \fn const T& QLinkedList::front() const
488
/*! \fn T& QLinkedList::back()
490
This function is provided for STL compatibility. It is equivalent
494
/*! \fn const T& QLinkedList::back() const
499
/*! \fn void QLinkedList::pop_front()
501
This function is provided for STL compatibility. It is equivalent
505
/*! \fn void QLinkedList::pop_back()
507
This function is provided for STL compatibility. It is equivalent
511
/*! \fn bool QLinkedList::empty() const
513
This function is provided for STL compatibility. It is equivalent
517
/*! \fn QLinkedList &QLinkedList::operator+=(const QLinkedList &other)
519
Appends the items of the \a other list to this list and returns a
520
reference to this list.
522
\sa operator+(), append()
525
/*! \fn void QLinkedList::operator+=(const T &value)
529
Appends \a value to the list.
532
/*! \fn QLinkedList QLinkedList::operator+(const QLinkedList &other) const
534
Returns a list that contains all the items in this list followed
535
by all the items in the \a other list.
540
/*! \fn QLinkedList &QLinkedList::operator<<(const QLinkedList &other)
542
Appends the items of the \a other list to this list and returns a
543
reference to this list.
545
\sa operator+=(), append()
548
/*! \fn QLinkedList &QLinkedList::operator<<(const T &value)
552
Appends \a value to the list.
555
/*! \class QLinkedList::iterator
556
\brief The QLinkedList::iterator class provides an STL-style non-const iterator for QLinkedList.
558
QLinkedList features both \l{STL-style iterators} and
559
\l{Java-style iterators}. The STL-style iterators are more
560
low-level and more cumbersome to use; on the other hand, they are
561
slightly faster and, for developers who already know STL, have
562
the advantage of familiarity.
564
QLinkedList\<T\>::iterator allows you to iterate over a
565
QLinkedList\<T\> and to modify the list item associated with the
566
iterator. If you want to iterate over a const QLinkedList, use
567
QLinkedList::const_iterator instead. It is generally good
568
practice to use QLinkedList::const_iterator on a non-const
569
QLinkedList as well, unless you need to change the QLinkedList
570
through the iterator. Const iterators are slightly faster, and
571
can improve code readability.
573
The default QLinkedList::iterator constructor creates an
574
uninitialized iterator. You must initialize it using a
575
function like QLinkedList::begin(), QLinkedList::end(), or
576
QLinkedList::insert() before you can start iterating. Here's a
577
typical loop that prints all the items stored in a list:
580
QLinkedList<QString> list;
581
list.append("January");
582
list.append("February");
584
list.append("December");
586
QLinkedList<QString>::iterator i;
587
for (i = list.begin(); i != list.end(); ++i)
591
STL-style iterators can be used as arguments to \l{generic
592
algorithms}. For example, here's how to find an item in the list
593
using the qFind() algorithm:
596
QLinkedList<QString> list;
598
QLinkedList<QString>::iterator it = qFind(list.begin(),
600
if (it != list.end())
601
cout << "Found Joel" << endl;
604
Let's see a few examples of things we can do with a
605
QLinkedList::iterator that we cannot do with a QLinkedList::const_iterator.
606
Here's an example that increments every value stored in a
607
QLinkedList\<int\> by 2:
610
QLinkedList<int>::iterator i;
611
for (i = list.begin(); i != list.end(); ++i)
615
Here's an example that removes all the items that start with an
616
underscore character in a QLinkedList\<QString\>:
619
QLinkedList<QString> list;
621
QLinkedList<QString>::iterator i = list.begin();
622
while (i != list.end()) {
623
if ((*i).startsWith("_"))
630
The call to QLinkedList::erase() removes the item pointed to by
631
the iterator from the list, and returns an iterator to the next
632
item. Here's another way of removing an item while iterating:
635
QLinkedList<QString>::iterator i = list.begin();
636
while (i != list.end()) {
637
QLinkedList<QString>::iterator previous = i;
639
if ((*previous).startsWith("_"))
640
list.erase(previous);
644
It might be tempting to write code like this:
648
while (i != list.end()) {
649
if ((*i).startsWith("_"))
655
However, this will potentially crash in \c{++i}, because \c i is
656
a dangling iterator after the call to erase().
658
Multiple iterators can be used on the same list. If you add items
659
to the list, existing iterators will remain valid. If you remove
660
items from the list, iterators that point to the removed items
661
will become dangling iterators.
663
\sa QLinkedList::const_iterator, QMutableLinkedListIterator
666
/*! \fn QLinkedList::iterator::iterator()
668
Constructs an uninitialized iterator.
670
Functions like operator*() and operator++() should not be called
671
on an uninitialized iterartor. Use operator=() to assign a value
672
to it before using it.
674
\sa QLinkedList::begin() QLinkedList::end()
677
/*! \fn QLinkedList::iterator::iterator(Node *node)
682
/*! \typedef QLinkedList::iterator::iterator_category
687
/*! \typedef QLinkedList::iterator::difference_type
692
/*! \typedef QLinkedList::iterator::value_type
697
/*! \typedef QLinkedList::iterator::pointer
702
/*! \typedef QLinkedList::iterator::reference
707
/*! \fn QLinkedList::iterator::iterator(const iterator &other)
709
Constructs a copy of \a other.
712
/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator=(const iterator &other)
714
Assigns \a other to this iterator.
717
/*! \fn T &QLinkedList::iterator::operator*() const
719
Returns a modifiable reference to the current item.
721
You can change the value of an item by using operator*() on the
722
left side of an assignment, for example:
732
/*! \fn T *QLinkedList::iterator::operator->() const
734
Returns a pointer to the current item.
740
\fn bool QLinkedList::iterator::operator==(const iterator &other) const
741
\fn bool QLinkedList::iterator::operator==(const const_iterator &other) const
743
Returns true if \a other points to the same item as this
744
iterator; otherwise returns false.
750
\fn bool QLinkedList::iterator::operator!=(const iterator &other) const
751
\fn bool QLinkedList::iterator::operator!=(const const_iterator &other) const
753
Returns true if \a other points to a different item than this
754
iterator; otherwise returns false.
759
/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator++()
761
The prefix ++ operator (\c{++it}) advances the iterator to the
762
next item in the list and returns an iterator to the new current
765
Calling this function on QLinkedList::end() leads to undefined
771
/*! \fn QLinkedList::iterator QLinkedList::iterator::operator++(int)
775
The postfix ++ operator (\c{it++}) advances the iterator to the
776
next item in the list and returns an iterator to the previously
780
/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator--()
782
The prefix -- operator (\c{--it}) makes the preceding item
783
current and returns an iterator to the new current item.
785
Calling this function on QLinkedList::begin() leads to undefined
791
/*! \fn QLinkedList::iterator QLinkedList::iterator::operator--(int)
795
The postfix -- operator (\c{it--}) makes the preceding item
796
current and returns an iterator to the previously current item.
799
/*! \fn QLinkedList::iterator QLinkedList::iterator::operator+(int j) const
801
Returns an iterator to the item at \a j positions forward from
802
this iterator. (If \a j is negative, the iterator goes backward.)
804
This operation can be slow for large \a j values.
810
/*! \fn QLinkedList::iterator QLinkedList::iterator::operator-(int j) const
812
Returns an iterator to the item at \a j positions backward from
813
this iterator. (If \a j is negative, the iterator goes forward.)
815
This operation can be slow for large \a j values.
820
/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator+=(int j)
822
Advances the iterator by \a j items. (If \a j is negative, the
823
iterator goes backward.)
825
\sa operator-=(), operator+()
828
/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator-=(int j)
830
Makes the iterator go back by \a j items. (If \a j is negative,
831
the iterator goes forward.)
833
\sa operator+=(), operator-()
836
/*! \class QLinkedList::const_iterator
837
\brief The QLinkedList::const_iterator class provides an STL-style const iterator for QLinkedList.
839
QLinkedList features both \l{STL-style iterators} and
840
\l{Java-style iterators}. The STL-style iterators are more
841
low-level and more cumbersome to use; on the other hand, they are
842
slightly faster and, for developers who already know STL, have
843
the advantage of familiarity.
845
QLinkedList\<T\>::const_iterator allows you to iterate over a
846
QLinkedList\<T\>. If you want modify the QLinkedList as you iterate
847
over it, you must use QLinkedList::const_iterator instead. It is
848
generally good practice to use QLinkedList::const_iterator on a
849
non-const QLinkedList as well, unless you need to change the
850
QLinkedList through the iterator. Const iterators are slightly
851
faster, and can improve code readability.
853
The default QLinkedList::const_iterator constructor creates an
854
uninitialized iterator. You must initialize it using a function
855
like QLinkedList::constBegin(), QLinkedList::constEnd(), or
856
QLinkedList::insert() before you can start iterating. Here's a
857
typical loop that prints all the items stored in a list:
860
QLinkedList<QString> list;
861
list.append("January");
862
list.append("February");
864
list.append("December");
866
QLinkedList<QString>::const_iterator i;
867
for (i = list.constBegin(); i != list.constEnd(); ++i)
871
STL-style iterators can be used as arguments to \l{generic
872
algorithms}. For example, here's how to find an item in the list
873
using the qFind() algorithm:
876
QLinkedList<QString> list;
878
QLinkedList<QString>::iterator it = qFind(list.constBegin(),
879
list.constEnd(), "Joel");
880
if (it != list.constEnd())
881
cout << "Found Joel" << endl;
884
Multiple iterators can be used on the same list. If you add items
885
to the list, existing iterators will remain valid. If you remove
886
items from the list, iterators that point to the removed items
887
will become dangling iterators.
889
\sa QLinkedList::iterator, QLinkedListIterator
892
/*! \fn QLinkedList::const_iterator::const_iterator()
894
Constructs an uninitialized iterator.
896
Functions like operator*() and operator++() should not be called
897
on an uninitialized iterartor. Use operator=() to assign a value
898
to it before using it.
900
\sa QLinkedList::constBegin() QLinkedList::constEnd()
903
/*! \fn QLinkedList::const_iterator::const_iterator(Node *node)
908
/*! \typedef QLinkedList::const_iterator::iterator_category
913
/*! \typedef QLinkedList::const_iterator::difference_type
918
/*! \typedef QLinkedList::const_iterator::value_type
923
/*! \typedef QLinkedList::const_iterator::pointer
928
/*! \typedef QLinkedList::const_iterator::reference
933
/*! \fn QLinkedList::const_iterator::const_iterator(const const_iterator &other)
935
Constructs a copy of \a other.
938
/*! \fn QLinkedList::const_iterator::const_iterator(iterator other)
940
Constructs a copy of \a other.
943
/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator=( \
944
const const_iterator &other)
946
Assigns \a other to this iterator.
949
/*! \fn const T &QLinkedList::const_iterator::operator*() const
951
Returns a reference to the current item.
956
/*! \fn const T *QLinkedList::const_iterator::operator->() const
958
Returns a pointer to the current item.
963
/*! \fn bool QLinkedList::const_iterator::operator==(const const_iterator &other) const
965
Returns true if \a other points to the same item as this
966
iterator; otherwise returns false.
971
/*! \fn bool QLinkedList::const_iterator::operator!=(const const_iterator &other) const
973
Returns true if \a other points to a different item than this
974
iterator; otherwise returns false.
979
/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator++()
981
The prefix ++ operator (\c{++it}) advances the iterator to the
982
next item in the list and returns an iterator to the new current
985
Calling this function on QLinkedList::constEnd() leads to
991
/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator++(int)
995
The postfix ++ operator (\c{it++}) advances the iterator to the
996
next item in the list and returns an iterator to the previously
1000
/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator--()
1002
The prefix -- operator (\c{--it}) makes the preceding item
1003
current and returns an iterator to the new current item.
1005
Calling this function on QLinkedList::begin() leads to undefined
1011
/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator--(int)
1015
The postfix -- operator (\c{it--}) makes the preceding item
1016
current and returns an iterator to the previously current item.
1019
/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator+(int j) const
1021
Returns an iterator to the item at \a j positions forward from
1022
this iterator. (If \a j is negative, the iterator goes backward.)
1024
This operation can be slow for large \a j values.
1029
/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator-(int j) const
1031
Returns an iterator to the item at \a j positions backward from
1032
this iterator. (If \a j is negative, the iterator goes forward.)
1034
This operation can be slow for large \a j values.
1039
/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator+=(int j)
1041
Advances the iterator by \a j items. (If \a j is negative, the
1042
iterator goes backward.)
1044
This operation can be slow for large \a j values.
1046
\sa operator-=(), operator+()
1049
/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator-=(int j)
1051
Makes the iterator go back by \a j items. (If \a j is negative,
1052
the iterator goes forward.)
1054
This operation can be slow for large \a j values.
1056
\sa operator+=(), operator-()
1059
/*! \fn QDataStream &operator<<(QDataStream &out, const QLinkedList<T> &list)
1060
\relates QLinkedList
1062
Writes the linked list \a list to stream \a out.
1064
This function requires the value type to implement \c
1067
\sa \link datastreamformat.html Format of the QDataStream operators \endlink
1070
/*! \fn QDataStream &operator>>(QDataStream &in, QLinkedList<T> &list)
1071
\relates QLinkedList
1073
Reads a linked list from stream \a in into \a list.
1075
This function requires the value type to implement \c operator>>().
1077
\sa \link datastreamformat.html Format of the QDataStream operators \endlink
1081
\fn iterator QLinkedList::remove(iterator pos)
1083
Use erase() instead.
1087
\fn int QLinkedList::findIndex(const T& t) const
1089
If you need indexes then QList or QVector are better choices than
1093
int index = list->findIndex(value);
1097
for (const_iterator i = list->begin(); i != list->end(); ++i; ++index)
1108
\fn iterator QLinkedList::find(iterator from, const T& t)
1110
If you need random access to a data structure then QList, QVector,
1111
QMap, or QHash, are all better choices than QLinkedList.
1114
QLinkedList::iterator i = list->find(from, value);
1116
QLinkedList::iterator i = from;
1117
while (i != list->end() && *i != value)
1123
\fn iterator QLinkedList::find(const T& t)
1125
If you need random access to a data structure then QList, QVector,
1126
QMap, or QHash, are all better choices than QLinkedList.
1129
QLinkedList::iterator i = list->find(value);
1131
QLinkedList::iterator i = list->begin();
1132
while (i != list->end() && *i != value)
1138
\fn const_iterator QLinkedList::find(const_iterator from, const T& t) const
1140
If you need random access to a data structure then QList, QVector,
1141
QMap, or QHash, are all better choices than QLinkedList.
1144
QLinkedList::const_iterator i = list->find(from, value);
1146
QLinkedList::const_iterator i = from;
1147
while (i != list->end() && *i != value)
1153
\fn const_iterator QLinkedList::find(const T& t) const
1155
If you need random access to a data structure then QList, QVector,
1156
QMap, or QHash, are all better choices than QLinkedList.
1159
QLinkedList::const_iterator i = list->find(value);
1161
QLinkedList::const_iterator i = list->begin();
1162
while (i != list->end() && *i != value)