- Qt 5.15
- Qt Core
- C++ Classes
- QSet
- Qt 5.15.19 Reference Documentation

# Obsolete Members for QSet

The following members of class QSet are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Types

`(obsolete)` typedef | const_reverse_iterator
`(obsolete)` typedef | reverse_iterator

## Public Functions

`(obsolete)` const_reverse_iterator | crbegin() const
`(obsolete)` const_reverse_iterator | crend() const
`(obsolete)` reverse_iterator | rbegin()
`(obsolete)` const_reverse_iterator | rbegin() const
`(obsolete)` reverse_iterator | rend()
`(obsolete)` const_reverse_iterator | rend() const
`(obsolete)` QList<T> | toList() const

## Static Public Members

`(obsolete)` QSet<T> | fromList(const QList<T> &list)

## Member Type Documentation

### typedef QSet::const_reverse_iterator

This typedef is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

The QSet::const_reverse_iterator typedef provides an STL-style const reverse iterator for QSet.

It is simply a typedef for `std::reverse_iterator<QSet::const_iterator>`.

Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.

This typedef was introduced in Qt 5.6.

See also QSet::rbegin(), QSet::rend(), QSet::reverse_iterator, and QSet::const_iterator.

### typedef QSet::reverse_iterator

This typedef is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

The QSet::reverse_iterator typedef provides an STL-style non-const reverse iterator for QSet.

It is simply a typedef for `std::reverse_iterator<QSet::iterator>`.

Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.

This typedef was introduced in Qt 5.6.

See also QSet::rbegin(), QSet::rend(), QSet::const_reverse_iterator, and QSet::iterator.

## Member Function Documentation

### const_reverse_iterator QSet::crbegin() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

Returns a const STL-style reverse iterator pointing to the first item in the set, in reverse order.

This function was introduced in Qt 5.6.

See also begin(), rbegin(), and rend().

### const_reverse_iterator QSet::crend() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

Returns a const STL-style reverse iterator pointing to one past the last item in the set, in reverse order.

This function was introduced in Qt 5.6.

See also end(), rend(), and rbegin().

### `[static]` QSet<T> QSet::fromList(const QList<T> &list)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns a new QSet object containing the data contained in list. Since QSet doesn't allow duplicates, the resulting QSet might be smaller than the list, because QList can contain duplicates.

Note: Since Qt 5.14, range constructors are available for Qt's generic container classes and should be used in place of this method.

For example, if you have code like

     QStringList list;
     // ...
     QSet<QString> set = QSet<QString>::fromList(list);

you can rewrite it as

     QStringList list;
     // ...
     QSet<QString> set(list.begin(), list.end());

See also QSet(InputIterator, InputIterator), values(), and QList::toSet().

### reverse_iterator QSet::rbegin()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

Returns a STL-style reverse iterator pointing to the first item in the set, in reverse order.

This function was introduced in Qt 5.6.

See also begin(), crbegin(), and rend().

### const_reverse_iterator QSet::rbegin() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

This is an overloaded function.

This function was introduced in Qt 5.6.

### reverse_iterator QSet::rend()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

Returns a STL-style reverse iterator pointing to one past the last item in the set, in reverse order.

This function was introduced in Qt 5.6.

See also end(), crend(), and rbegin().

### const_reverse_iterator QSet::rend() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Deprecated in order to align with std::unordered_set functionality.

This is an overloaded function.

This function was introduced in Qt 5.6.

### QList<T> QSet::toList() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns a new QList containing the elements in the set. The order of the elements in the QList is undefined.

Note: Since Qt 5.14, range constructors are available for Qt's generic container classes and should be used in place of this method.

For example, if you have code like

     QSet<QString> set;
     // ...
     QList<QString> list = set.toList();

you can rewrite it as

     QSet<QString> set;
     // ...
     QList<QString> list(set.begin(), set.end());

or

     QSet<QString> set;
     // ...
     QList<QString> list = set.values();

See also QList::QList(InputIterator, InputIterator), values(), fromList(), and QList::fromSet().