source: trunk/doc/src/qset.qdoc@ 109

Last change on this file since 109 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 25.0 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the documentation of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*!
43 \class QSet
44 \brief The QSet class is a template class that provides a hash-table-based set.
45
46 \ingroup tools
47 \ingroup shared
48 \reentrant
49 \mainclass
50
51 QSet<T> is one of Qt's generic \l{container classes}. It stores
52 values in an unspecified order and provides very fast lookup of
53 the values. Internally, QSet<T> is implemented as a QHash.
54
55 Here's an example QSet with QString values:
56
57 \snippet doc/src/snippets/code/doc_src_qset.qdoc 0
58
59 To insert a value into the set, use insert():
60
61 \snippet doc/src/snippets/code/doc_src_qset.qdoc 1
62
63 Another way to insert items into the set is to use operator<<():
64
65 \snippet doc/src/snippets/code/doc_src_qset.qdoc 2
66
67 To test whether an item belongs to the set or not, use contains():
68
69 \snippet doc/src/snippets/code/doc_src_qset.qdoc 3
70
71 If you want to navigate through all the values stored in a QSet,
72 you can use an iterator. QSet supports both \l{Java-style
73 iterators} (QSetIterator and QMutableSetIterator) and \l{STL-style
74 iterators} (QSet::iterator and QSet::const_iterator). Here's how
75 to iterate over a QSet<QWidget *> using a Java-style iterator:
76
77 \snippet doc/src/snippets/code/doc_src_qset.qdoc 4
78
79 Here's the same code, but using an STL-style iterator:
80
81 \snippet doc/src/snippets/code/doc_src_qset.qdoc 5
82
83 QSet is unordered, so an iterator's sequence cannot be assumed to
84 be predictable. If ordering by key is required, use a QMap.
85
86 To navigate through a QSet, you can also use \l{foreach}:
87
88 \snippet doc/src/snippets/code/doc_src_qset.qdoc 6
89
90 Items can be removed from the set using remove(). There is also a
91 clear() function that removes all items.
92
93 QSet's value data type must be an \l{assignable data type}. You
94 cannot, for example, store a QWidget as a value; instead, store a
95 QWidget *. In addition, the type must provide \c operator==(), and
96 there must also be a global qHash() function that returns a hash
97 value for an argument of the key's type. See the QHash
98 documentation for a list of types supported by qHash().
99
100 Internally, QSet uses a hash table to perform lookups. The hash
101 table automatically grows and shrinks to provide fast lookups
102 without wasting memory. You can still control the size of the hash
103 table by calling reserve(), if you already know approximately how
104 many elements the QSet will contain, but this isn't necessary to
105 obtain good performance. You can also call capacity() to retrieve
106 the hash table's size.
107
108 \sa QSetIterator, QMutableSetIterator, QHash, QMap
109*/
110
111/*!
112 \fn QSet::QSet()
113
114 Constructs an empty set.
115
116 \sa clear()
117*/
118
119/*!
120 \fn QSet::QSet(const QSet<T> &other)
121
122 Constructs a copy of \a other.
123
124 This operation occurs in \l{constant time}, because QSet is
125 \l{implicitly shared}. This makes returning a QSet from a
126 function very fast. If a shared instance is modified, it will be
127 copied (copy-on-write), and this takes \l{linear time}.
128
129 \sa operator=()
130*/
131
132/*!
133 \fn QSet<T> &QSet::operator=(const QSet<T> &other)
134
135 Assigns the \a other set to this set and returns a reference to
136 this set.
137*/
138
139/*!
140 \fn bool QSet::operator==(const QSet<T> &other) const
141
142 Returns true if the \a other set is equal to this set; otherwise
143 returns false.
144
145 Two sets are considered equal if they contain the same elements.
146
147 This function requires the value type to implement \c operator==().
148
149 \sa operator!=()
150*/
151
152/*!
153 \fn bool QSet::operator!=(const QSet<T> &other) const
154
155 Returns true if the \a other set is not equal to this set; otherwise
156 returns false.
157
158 Two sets are considered equal if they contain the same elements.
159
160 This function requires the value type to implement \c operator==().
161
162 \sa operator==()
163*/
164
165/*!
166 \fn int QSet::size() const
167
168 Returns the number of items in the set.
169
170 \sa isEmpty(), count()
171*/
172
173/*!
174 \fn bool QSet::isEmpty() const
175
176 Returns true if the set contains no elements; otherwise returns
177 false.
178
179 \sa size()
180*/
181
182/*!
183 \fn int QSet::capacity() const
184
185 Returns the number of buckets in the set's internal hash
186 table.
187
188 The sole purpose of this function is to provide a means of fine
189 tuning QSet's memory usage. In general, you will rarely ever need
190 to call this function. If you want to know how many items are in
191 the set, call size().
192
193 \sa reserve(), squeeze()
194*/
195
196/*! \fn void QSet::reserve(int size)
197
198 Ensures that the set's internal hash table consists of at
199 least \a size buckets.
200
201 This function is useful for code that needs to build a huge set
202 and wants to avoid repeated reallocation. For example:
203
204 \snippet doc/src/snippets/code/doc_src_qset.qdoc 7
205
206 Ideally, \a size should be slightly more than the maximum number
207 of elements expected in the set. \a size doesn't have to be prime,
208 because QSet will use a prime number internally anyway. If \a size
209 is an underestimate, the worst that will happen is that the QSet
210 will be a bit slower.
211
212 In general, you will rarely ever need to call this function.
213 QSet's internal hash table automatically shrinks or grows to
214 provide good performance without wasting too much memory.
215
216 \sa squeeze(), capacity()
217*/
218
219/*!
220 \fn void QSet::squeeze()
221
222 Reduces the size of the set's internal hash table to save
223 memory.
224
225 The sole purpose of this function is to provide a means of fine
226 tuning QSet's memory usage. In general, you will rarely ever
227 need to call this function.
228
229 \sa reserve(), capacity()
230*/
231
232/*!
233 \fn void QSet::detach()
234
235 \internal
236
237 Detaches this set from any other sets with which it may share
238 data.
239
240 \sa isDetached()
241*/
242
243/*! \fn bool QSet::isDetached() const
244
245 \internal
246
247 Returns true if the set's internal data isn't shared with any
248 other set object; otherwise returns false.
249
250 \sa detach()
251*/
252
253/*!
254 \fn void QSet::setSharable(bool sharable)
255 \internal
256*/
257
258/*!
259 \fn void QSet::clear()
260
261 Removes all elements from the set.
262
263 \sa remove()
264*/
265
266/*!
267 \fn bool QSet::remove(const T &value)
268
269 Removes any occurrence of item \a value from the set. Returns
270 true if an item was actually removed; otherwise returns false.
271
272 \sa contains(), insert()
273*/
274
275/*!
276 \fn QSet::iterator QSet::erase(iterator pos)
277 \since 4.2
278
279 Removes the item at the iterator position \a pos from the set, and
280 returns an iterator positioned at the next item in the set.
281
282 Unlike remove(), this function never causes QSet to rehash its
283 internal data structure. This means that it can safely be called
284 while iterating, and won't affect the order of items in the set.
285
286 \sa remove(), find()
287*/
288
289/*! \fn QSet::const_iterator QSet::find(const T &value) const
290 \since 4.2
291
292 Returns a const iterator positioned at the item \a value in the
293 set. If the set contains no item \a value, the function returns
294 constEnd().
295
296 \sa constFind(), contains()
297*/
298
299/*! \fn QSet::iterator QSet::find(const T &value)
300 \since 4.2
301 \overload
302
303 Returns a non-const iterator positioned at the item \a value in
304 the set. If the set contains no item \a value, the function
305 returns end().
306*/
307
308/*! \fn QSet::const_iterator QSet::constFind(const T &value) const
309 \since 4.2
310
311 Returns a const iterator positioned at the item \a value in the
312 set. If the set contains no item \a value, the function returns
313 constEnd().
314
315 \sa find(), contains()
316*/
317
318/*!
319 \fn bool QSet::contains(const T &value) const
320
321 Returns true if the set contains item \a value; otherwise returns
322 false.
323
324 \sa insert(), remove(), find()
325*/
326
327/*! \fn QSet::const_iterator QSet::begin() const
328
329 Returns a const \l{STL-style iterator} positioned at the first
330 item in the set.
331
332 \sa constBegin(), end()
333*/
334
335/*! \fn QSet::iterator QSet::begin()
336 \since 4.2
337 \overload
338
339 Returns a non-const \l{STL-style iterator} positioned at the first
340 item in the set.
341*/
342
343/*! \fn QSet::const_iterator QSet::constBegin() const
344
345 Returns a const \l{STL-style iterator} positioned at the first
346 item in the set.
347
348 \sa begin(), constEnd()
349*/
350
351/*! \fn QSet::const_iterator QSet::end() const
352
353 Returns a const \l{STL-style iterator} positioned at the imaginary
354 item after the last item in the set.
355
356 \sa constEnd(), begin()
357*/
358
359/*! \fn QSet::iterator QSet::end()
360 \since 4.2
361 \overload
362
363 Returns a non-const \l{STL-style iterator} pointing to the
364 imaginary item after the last item in the set.
365*/
366
367/*! \fn QSet::const_iterator QSet::constEnd() const
368
369 Returns a const \l{STL-style iterator} pointing to the imaginary
370 item after the last item in the set.
371
372 \sa constBegin(), end()
373*/
374
375/*!
376 \typedef QSet::Iterator
377 \since 4.2
378
379 Qt-style synonym for QSet::iterator.
380*/
381
382/*!
383 \typedef QSet::ConstIterator
384
385 Qt-style synonym for QSet::const_iterator.
386*/
387
388/*!
389 \typedef QSet::const_pointer
390
391 Typedef for const T *. Provided for STL compatibility.
392*/
393
394/*!
395 \typedef QSet::const_reference
396
397 Typedef for const T &. Provided for STL compatibility.
398*/
399
400/*!
401 \typedef QSet::difference_type
402
403 Typedef for const ptrdiff_t. Provided for STL compatibility.
404*/
405
406/*!
407 \typedef QSet::key_type
408
409 Typedef for T. Provided for STL compatibility.
410*/
411
412/*!
413 \typedef QSet::pointer
414
415 Typedef for T *. Provided for STL compatibility.
416*/
417
418/*!
419 \typedef QSet::reference
420
421 Typedef for T &. Provided for STL compatibility.
422*/
423
424/*!
425 \typedef QSet::size_type
426
427 Typedef for int. Provided for STL compatibility.
428*/
429
430/*!
431 \typedef QSet::value_type
432
433 Typedef for T. Provided for STL compatibility.
434*/
435
436/*!
437 \fn QSet::const_iterator QSet::insert(const T &value)
438
439 Inserts item \a value into the set, if \a value isn't already
440 in the set, and returns an iterator positioned at the inserted
441 item.
442
443 \sa operator<<(), remove(), contains()
444*/
445
446/*!
447 \fn QSet<T> &QSet::unite(const QSet<T> &other)
448
449 Each item in the \a other set that isn't already in this set is
450 inserted into this set. A reference to this set is returned.
451
452 \sa operator|=(), intersect(), subtract()
453*/
454
455/*!
456 \fn QSet<T> &QSet::intersect(const QSet<T> &other)
457
458 Removes all items from this set that are not contained in the
459 \a other set. A reference to this set is returned.
460
461 \sa operator&=(), unite(), subtract()
462*/
463
464/*!
465 \fn QSet<T> &QSet::subtract(const QSet<T> &other)
466
467 Removes all items from this set that are contained in the
468 \a other set. Returns a reference to this set.
469
470 \sa operator-=(), unite(), intersect()
471*/
472
473/*!
474 \fn bool QSet::empty() const
475
476 Returns true if the set is empty. This function is provided
477 for STL compatibility. It is equivalent to isEmpty().
478*/
479
480/*!
481 \fn bool QSet::count() const
482
483 Same as size().
484*/
485
486/*!
487 \fn QSet<T> &QSet::operator<<(const T &value)
488 \fn QSet<T> &QSet::operator+=(const T &value)
489 \fn QSet<T> &QSet::operator|=(const T &value)
490
491 Inserts a new item \a value and returns a reference to the set.
492 If \a value already exists in the set, the set is left unchanged.
493
494 \sa insert()
495*/
496
497/*!
498 \fn QSet<T> &QSet::operator-=(const T &value)
499
500 Removes the occurrence of item \a value from the set, if
501 it is found, and returns a reference to the set. If the
502 \a value is not contained the set, nothing is removed.
503
504 \sa remove()
505*/
506
507/*!
508 \fn QSet<T> &QSet::operator|=(const QSet<T> &other)
509 \fn QSet<T> &QSet::operator+=(const QSet<T> &other)
510
511 Same as unite(\a other).
512
513 \sa operator|(), operator&=(), operator-=()
514*/
515
516/*!
517 \fn QSet<T> &QSet::operator&=(const QSet<T> &other)
518
519 Same as intersect(\a other).
520
521 \sa operator&(), operator|=(), operator-=()
522*/
523
524/*!
525 \fn QSet<T> &QSet::operator&=(const T &value)
526
527 \overload
528
529 Same as intersect(\e{other}), if we consider \e{other} to be a set
530 that contains the singleton \a value.
531*/
532
533
534/*!
535 \fn QSet<T> &QSet::operator-=(const QSet<T> &other)
536
537 Same as subtract(\a{other}).
538
539 \sa operator-(), operator|=(), operator&=()
540*/
541
542/*!
543 \fn QSet<T> QSet::operator|(const QSet<T> &other) const
544 \fn QSet<T> QSet::operator+(const QSet<T> &other) const
545
546 Returns a new QSet that is the union of this set and the
547 \a other set.
548
549 \sa unite(), operator|=(), operator&(), operator-()
550*/
551
552/*!
553 \fn QSet<T> QSet::operator&(const QSet<T> &other) const
554
555 Returns a new QSet that is the intersection of this set and the
556 \a other set.
557
558 \sa intersect(), operator&=(), operator|(), operator-()
559*/
560
561/*!
562 \fn QSet<T> QSet::operator-(const QSet<T> &other) const
563
564 Returns a new QSet that is the set difference of this set and
565 the \a other set, i.e., this set - \a other set.
566
567 \sa subtract(), operator-=(), operator|(), operator&()
568*/
569
570/*!
571 \fn QSet<T> QSet::operator-(const QSet<T> &other)
572 \fn QSet<T> QSet::operator|(const QSet<T> &other)
573 \fn QSet<T> QSet::operator+(const QSet<T> &other)
574 \fn QSet<T> QSet::operator&(const QSet<T> &other)
575 \internal
576
577 These will go away in Qt 5.
578*/
579
580/*!
581 \class QSet::iterator
582 \since 4.2
583 \brief The QSet::iterator class provides an STL-style non-const iterator for QSet.
584
585 QSet features both \l{STL-style iterators} and
586 \l{Java-style iterators}. The STL-style iterators are more
587 low-level and more cumbersome to use; on the other hand, they are
588 slightly faster and, for developers who already know STL, have
589 the advantage of familiarity.
590
591 QSet<T>::iterator allows you to iterate over a QSet and to remove
592 items (using QSet::erase()) while you iterate. (QSet doesn't let
593 you \e modify a value through an iterator, because that
594 would potentially require moving the value in the internal hash
595 table used by QSet.) If you want to iterate over a const QSet,
596 you should use QSet::const_iterator. It is generally good
597 practice to use QSet::const_iterator on a non-const QSet as well,
598 unless you need to change the QSet through the iterator. Const
599 iterators are slightly faster, and can improve code readability.
600
601 QSet\<T\>::iterator allows you to iterate over a QSet\<T\> and
602 modify it as you go (using QSet::erase()). However,
603
604 The default QSet::iterator constructor creates an uninitialized
605 iterator. You must initialize it using a function like
606 QSet::begin(), QSet::end(), or QSet::insert() before you can
607 start iterating. Here's a typical loop that prints all the items
608 stored in a set:
609
610 \snippet doc/src/snippets/code/doc_src_qset.qdoc 8
611
612 Here's a loop that removes certain items (all those that start
613 with 'J') from a set while iterating:
614
615 \snippet doc/src/snippets/code/doc_src_qset.qdoc 9
616
617 STL-style iterators can be used as arguments to \l{generic
618 algorithms}. For example, here's how to find an item in the set
619 using the qFind() algorithm:
620
621 \snippet doc/src/snippets/code/doc_src_qset.qdoc 10
622
623 Multiple iterators can be used on the same set. However, you may
624 not attempt to modify the container while iterating on it.
625
626 \sa QSet::const_iterator, QMutableSetIterator
627*/
628
629/*!
630 \class QSet::const_iterator
631 \brief The QSet::const_iterator class provides an STL-style const iterator for QSet.
632 \since 4.2
633
634 QSet features both \l{STL-style iterators} and
635 \l{Java-style iterators}. The STL-style iterators are more
636 low-level and more cumbersome to use; on the other hand, they are
637 slightly faster and, for developers who already know STL, have
638 the advantage of familiarity.
639
640 QSet\<Key, T\>::const_iterator allows you to iterate over a QSet.
641 If you want to modify the QSet as you iterate over it, you must
642 use QSet::iterator instead. It is generally good practice to use
643 QSet::const_iterator on a non-const QSet as well, unless you need
644 to change the QSet through the iterator. Const iterators are
645 slightly faster, and can improve code readability.
646
647 The default QSet::const_iterator constructor creates an
648 uninitialized iterator. You must initialize it using a function
649 like QSet::begin(), QSet::end(), or QSet::insert() before you can
650 start iterating. Here's a typical loop that prints all the items
651 stored in a set:
652
653 \snippet doc/src/snippets/code/doc_src_qset.qdoc 11
654
655 STL-style iterators can be used as arguments to \l{generic
656 algorithms}. For example, here's how to find an item in the set
657 using the qFind() algorithm:
658
659 \snippet doc/src/snippets/code/doc_src_qset.qdoc 12
660
661 Multiple iterators can be used on the same set. However, you may
662 not attempt to modify the container while iterating on it.
663
664 \sa QSet::iterator, QSetIterator
665*/
666
667/*!
668 \fn QSet::iterator::iterator()
669 \fn QSet::const_iterator::const_iterator()
670
671 Constructs an uninitialized iterator.
672
673 Functions like operator*() and operator++() should not be called
674 on an uninitialized iterator. Use operator=() to assign a value
675 to it before using it.
676
677 \sa QSet::begin(), QSet::end()
678*/
679
680/*!
681 \fn QSet::iterator::iterator(typename Hash::iterator i)
682 \fn QSet::const_iterator::const_iterator(typename Hash::const_iterator i)
683
684 \internal
685*/
686
687/*!
688 \typedef QSet::iterator::iterator_category
689 \typedef QSet::const_iterator::iterator_category
690
691 \internal
692*/
693
694/*!
695 \typedef QSet::iterator::difference_type
696 \typedef QSet::const_iterator::difference_type
697
698 \internal
699*/
700
701/*!
702 \typedef QSet::iterator::value_type
703 \typedef QSet::const_iterator::value_type
704
705 \internal
706*/
707
708/*!
709 \typedef QSet::iterator::pointer
710 \typedef QSet::const_iterator::pointer
711
712 \internal
713*/
714
715/*!
716 \typedef QSet::iterator::reference
717 \typedef QSet::const_iterator::reference
718
719 \internal
720*/
721
722/*!
723 \fn QSet::iterator::iterator(const iterator &other)
724 \fn QSet::const_iterator::const_iterator(const const_iterator &other)
725
726 Constructs a copy of \a other.
727*/
728
729/*!
730 \fn QSet::const_iterator::const_iterator(const iterator &other)
731 \since 4.2
732 \overload
733
734 Constructs a copy of \a other.
735*/
736
737/*!
738 \fn QSet::iterator &QSet::iterator::operator=(const iterator &other)
739 \fn QSet::const_iterator &QSet::const_iterator::operator=(const const_iterator &other)
740
741 Assigns \a other to this iterator.
742*/
743
744/*!
745 \fn const T &QSet::iterator::operator*() const
746 \fn const T &QSet::const_iterator::operator*() const
747
748 Returns a reference to the current item.
749
750 \sa operator->()
751*/
752
753/*!
754 \fn const T *QSet::iterator::operator->() const
755 \fn const T *QSet::const_iterator::operator->() const
756
757 Returns a pointer to the current item.
758
759 \sa operator*()
760*/
761
762/*!
763 \fn bool QSet::iterator::operator==(const iterator &other) const
764 \fn bool QSet::const_iterator::operator==(const const_iterator &other) const
765
766 Returns true if \a other points to the same item as this
767 iterator; otherwise returns false.
768
769 \sa operator!=()
770*/
771
772/*!
773 \fn bool QSet::iterator::operator==(const const_iterator &other) const
774 \fn bool QSet::iterator::operator!=(const const_iterator &other) const
775
776 \overload
777*/
778
779/*!
780 \fn bool QSet::iterator::operator!=(const iterator &other) const
781 \fn bool QSet::const_iterator::operator!=(const const_iterator &other) const
782
783 Returns true if \a other points to a different item than this
784 iterator; otherwise returns false.
785
786 \sa operator==()
787*/
788
789/*!
790 \fn QSet::iterator &QSet::iterator::operator++()
791 \fn QSet::const_iterator &QSet::const_iterator::operator++()
792
793 The prefix ++ operator (\c{++it}) advances the iterator to the
794 next item in the set and returns an iterator to the new current
795 item.
796
797 Calling this function on QSet::constEnd() leads to
798 undefined results.
799
800 \sa operator--()
801*/
802
803/*!
804 \fn QSet::iterator QSet::iterator::operator++(int)
805 \fn QSet::const_iterator QSet::const_iterator::operator++(int)
806
807 \overload
808
809 The postfix ++ operator (\c{it++}) advances the iterator to the
810 next item in the set and returns an iterator to the previously
811 current item.
812*/
813
814/*!
815 \fn QSet::iterator &QSet::iterator::operator--()
816 \fn QSet::const_iterator &QSet::const_iterator::operator--()
817
818 The prefix -- operator (\c{--it}) makes the preceding item
819 current and returns an iterator to the new current item.
820
821 Calling this function on QSet::begin() leads to undefined
822 results.
823
824 \sa operator++()
825*/
826
827/*!
828 \fn QSet::iterator QSet::iterator::operator--(int)
829 \fn QSet::const_iterator QSet::const_iterator::operator--(int)
830
831 \overload
832
833 The postfix -- operator (\c{it--}) makes the preceding item
834 current and returns an iterator to the previously current item.
835*/
836
837/*!
838 \fn QSet::iterator QSet::iterator::operator+(int j) const
839 \fn QSet::const_iterator QSet::const_iterator::operator+(int j) const
840
841 Returns an iterator to the item at \a j positions forward from
842 this iterator. (If \a j is negative, the iterator goes backward.)
843
844 This operation can be slow for large \a j values.
845
846 \sa operator-()
847*/
848
849/*!
850 \fn QSet::iterator QSet::iterator::operator-(int j) const
851 \fn QSet::const_iterator QSet::const_iterator::operator-(int j) const
852
853 Returns an iterator to the item at \a j positions backward from
854 this iterator. (If \a j is negative, the iterator goes forward.)
855
856 This operation can be slow for large \a j values.
857
858 \sa operator+()
859*/
860
861/*!
862 \fn QSet::iterator &QSet::iterator::operator+=(int j)
863 \fn QSet::const_iterator &QSet::const_iterator::operator+=(int j)
864
865 Advances the iterator by \a j items. (If \a j is negative, the
866 iterator goes backward.)
867
868 This operation can be slow for large \a j values.
869
870 \sa operator-=(), operator+()
871*/
872
873/*!
874 \fn QSet::iterator &QSet::iterator::operator-=(int j)
875 \fn QSet::const_iterator &QSet::const_iterator::operator-=(int j)
876
877 Makes the iterator go back by \a j items. (If \a j is negative,
878 the iterator goes forward.)
879
880 This operation can be slow for large \a j values.
881
882 \sa operator+=(), operator-()
883*/
884
885/*! \fn QList<T> QSet<T>::toList() const
886
887 Returns a new QList containing the elements in the set. The
888 order of the elements in the QList is undefined.
889
890 Example:
891
892 \snippet doc/src/snippets/code/doc_src_qset.qdoc 13
893
894 \sa fromList(), QList::fromSet(), qSort()
895*/
896
897/*! \fn QList<T> QSet<T>::values() const
898
899 Returns a new QList containing the elements in the set. The
900 order of the elements in the QList is undefined.
901
902 This is the same as toList().
903
904 \sa fromList(), QList::fromSet(), qSort()
905*/
906
907
908/*! \fn QSet<T> QSet<T>::fromList(const QList<T> &list)
909
910 Returns a new QSet object containing the data contained in \a
911 list. Since QSet doesn't allow duplicates, the resulting QSet
912 might be smaller than the \a list, because QList can contain
913 duplicates.
914
915 Example:
916
917 \snippet doc/src/snippets/code/doc_src_qset.qdoc 14
918
919 \sa toList(), QList::toSet()
920*/
921
922/*!
923 \fn QDataStream &operator<<(QDataStream &out, const QSet<T> &set)
924 \relates QSet
925
926 Writes the \a set to stream \a out.
927
928 This function requires the value type to implement \c operator<<().
929
930 \sa \link datastreamformat.html Format of the QDataStream operators \endlink
931*/
932
933/*!
934 \fn QDataStream &operator>>(QDataStream &in, QSet<T> &set)
935 \relates QSet
936
937 Reads a set from stream \a in into \a set.
938
939 This function requires the value type to implement \c operator>>().
940
941 \sa \link datastreamformat.html Format of the QDataStream operators \endlink
942*/
Note: See TracBrowser for help on using the repository browser.