Warning: That file was not part of the compilation database. It may have many parsing errors.

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

Warning: That file was not part of the compilation database. It may have many parsing errors.