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