- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions

# QSet< T > Class Template Reference

Search for all occurrences

## Detailed Description

### template<class T>
class QSet< T >

Definition at line 54 of file qset.h.

`#include <qset.h>`

List of all members.

## Classes
class | const_iterator
class | iterator
## Public Types
typedef iterator | Iterator
typedef const_iterator | ConstIterator
typedef T | key_type
typedef T | value_type
typedef value_type * | pointer
typedef const value_type * | const_pointer
typedef value_type & | reference
typedef const value_type & | const_reference
typedef qptrdiff | difference_type
typedef int | size_type
## Public Member Functions
| QSet ()
| QSet (const QSet< T > &other)
QSet< T > & | operator= (const QSet< T > &other)
bool | operator== (const QSet< T > &other) const
bool | operator!= (const QSet< T > &other) const
int | size () const
bool | isEmpty () const
int | capacity () const
void | reserve (int size)
void | squeeze ()
void | detach ()
bool | isDetached () const
void | setSharable (bool sharable)
void | clear ()
bool | remove (const T &value)
bool | contains (const T &value) const
bool | contains (const QSet< T > &set) const
iterator | begin ()
const_iterator | begin () const
const_iterator | constBegin () const
iterator | end ()
const_iterator | end () const
const_iterator | constEnd () const
iterator | erase (iterator i)
int | count () const
const_iterator | insert (const T &value)
iterator | find (const T &value)
const_iterator | find (const T &value) const
const_iterator | constFind (const T &value) const
QSet< T > & | unite (const QSet< T > &other)
QSet< T > & | intersect (const QSet< T > &other)
QSet< T > & | subtract (const QSet< T > &other)
bool | empty () const
QSet< T > & | operator<< (const T &value)
QSet< T > & | operator|= (const QSet< T > &other)
QSet< T > & | operator|= (const T &value)
QSet< T > & | operator&= (const QSet< T > &other)
QSet< T > & | operator&= (const T &value)
QSet< T > & | operator+= (const QSet< T > &other)
QSet< T > & | operator+= (const T &value)
QSet< T > & | operator-= (const QSet< T > &other)
QSet< T > & | operator-= (const T &value)
QSet< T > | operator| (const QSet< T > &other) const
QSet< T > | operator& (const QSet< T > &other) const
QSet< T > | operator+ (const QSet< T > &other) const
QSet< T > | operator- (const QSet< T > &other) const
QSet< T > | operator| (const QSet< T > &other)
QSet< T > | operator& (const QSet< T > &other)
QSet< T > | operator+ (const QSet< T > &other)
QSet< T > | operator- (const QSet< T > &other)
QList< T > | toList () const
QList< T > | values () const
## Static Public Member Functions
static QSet< T > | fromList (const QList< T > &list)

## Member Typedef Documentation

typedef iterator Iterator

Search for all occurrences

Definition at line 171 of file qset.h.

typedef const_iterator ConstIterator

Search for all occurrences

Definition at line 172 of file qset.h.

typedef T key_type

Search for all occurrences

Definition at line 185 of file qset.h.

typedef T value_type

Search for all occurrences

Definition at line 186 of file qset.h.

typedef value_type* pointer

Search for all occurrences

Definition at line 187 of file qset.h.

typedef const value_type* const_pointer

Search for all occurrences

Definition at line 188 of file qset.h.

typedef value_type& reference

Search for all occurrences

Definition at line 189 of file qset.h.

typedef const value_type& const_reference

Search for all occurrences

Definition at line 190 of file qset.h.

typedef qptrdiff difference_type

Search for all occurrences

Definition at line 191 of file qset.h.

typedef int size_type

Search for all occurrences

Definition at line 192 of file qset.h.

## Constructor & Destructor Documentation

QSet | ( |  | ) | `[inline]`

Definition at line 59 of file qset.h.

    {}

QSet | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 60 of file qset.h.

    : q_hash(other.q_hash) {}

## Member Function Documentation

QSet<T>& operator= | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 62 of file qset.h.

            { q_hash = other.q_hash; return *this; }

bool operator== | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 65 of file qset.h.

            { return q_hash == other.q_hash; }

bool operator!= | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 67 of file qset.h.

            { return q_hash != other.q_hash; }

int size | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 70 of file qset.h.

    { return q_hash.size(); }

bool isEmpty | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 72 of file qset.h.

    { return q_hash.isEmpty(); }

int capacity | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 74 of file qset.h.

    { return q_hash.capacity(); }

Q_INLINE_TEMPLATE void reserve | ( | int | size | ) | `[inline]`

Search for all occurrences

Definition at line 236 of file qset.h.

    { q_hash.reserve(asize); }

void squeeze | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 76 of file qset.h.

    { q_hash.squeeze(); }

void detach | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 78 of file qset.h.

    { q_hash.detach(); }

bool isDetached | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 79 of file qset.h.

    { return q_hash.isDetached(); }

void setSharable | ( | bool | sharable | ) | `[inline]`

Search for all occurrences

Definition at line 80 of file qset.h.

    { q_hash.setSharable(sharable); }

void clear | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 82 of file qset.h.

    { q_hash.clear(); }

bool remove | ( | const T & | value | ) | `[inline]`

Search for all occurrences

Definition at line 84 of file qset.h.

    { return q_hash.remove(value) != 0; }

bool contains | ( | const T & | value | ) | const `[inline]`

Search for all occurrences

Definition at line 86 of file qset.h.

    { return q_hash.contains(value); }

Q_INLINE_TEMPLATE bool contains | ( | const QSet< T > & | set | ) | const

Search for all occurrences

Definition at line 279 of file qset.h.

    {
        typename QSet<T>::const_iterator i = other.constBegin();
        while (i != other.constEnd()) {
            if (!contains(*i))
                return false;
            ++i;
        }
        return true;
    }

iterator begin | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 161 of file qset.h.

    { return q_hash.begin(); }

const_iterator begin | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 162 of file qset.h.

    { return q_hash.begin(); }

const_iterator constBegin | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 163 of file qset.h.

    { return q_hash.constBegin(); }

iterator end | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 164 of file qset.h.

    { return q_hash.end(); }

const_iterator end | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 165 of file qset.h.

    { return q_hash.end(); }

const_iterator constEnd | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 166 of file qset.h.

    { return q_hash.constEnd(); }

iterator erase | ( | iterator | i | ) | `[inline]`

Search for all occurrences

Definition at line 167 of file qset.h.

            { return q_hash.erase(reinterpret_cast<typename Hash::iterator &>(i)); }

int count | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 173 of file qset.h.

    { return q_hash.count(); }

const_iterator insert | ( | const T & | value | ) | `[inline]`

Search for all occurrences

Definition at line 174 of file qset.h.

            { return static_cast<typename Hash::const_iterator>(q_hash.insert(value,
                                                                              QHashDummyValue())); }

iterator find | ( | const T & | value | ) | `[inline]`

Search for all occurrences

Definition at line 177 of file qset.h.

    { return q_hash.find(value); }

const_iterator find | ( | const T & | value | ) | const `[inline]`

Search for all occurrences

Definition at line 178 of file qset.h.

    { return q_hash.find(value); }

const_iterator constFind | ( | const T & | value | ) | const `[inline]`

Search for all occurrences

Definition at line 179 of file qset.h.

    { return find(value); }

Q_INLINE_TEMPLATE QSet< T > & unite | ( | const QSet< T > & | other | ) |

Search for all occurrences

Definition at line 239 of file qset.h.

    {
        QSet<T> copy(other);
        typename QSet<T>::const_iterator i = copy.constEnd();
        while (i != copy.constBegin()) {
            --i;
            insert(*i);
        }
        return *this;
    }

Q_INLINE_TEMPLATE QSet< T > & intersect | ( | const QSet< T > & | other | ) |

Search for all occurrences

Definition at line 251 of file qset.h.

    {
        QSet<T> copy1(*this);
        QSet<T> copy2(other);
        typename QSet<T>::const_iterator i = copy1.constEnd();
        while (i != copy1.constBegin()) {
            --i;
            if (!copy2.contains(*i))
                remove(*i);
        }
        return *this;
    }

Q_INLINE_TEMPLATE QSet< T > & subtract | ( | const QSet< T > & | other | ) |

Search for all occurrences

Definition at line 265 of file qset.h.

    {
        QSet<T> copy1(*this);
        QSet<T> copy2(other);
        typename QSet<T>::const_iterator i = copy1.constEnd();
        while (i != copy1.constBegin()) {
            --i;
            if (copy2.contains(*i))
                remove(*i);
        }
        return *this;
    }

bool empty | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 194 of file qset.h.

    { return isEmpty(); }

QSet<T>& operator<< | ( | const T & | value | ) | `[inline]`

Definition at line 196 of file qset.h.

    { insert(value); return *this; }

QSet<T>& operator|= | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 197 of file qset.h.

    { unite(other); return *this; }

QSet<T>& operator|= | ( | const T & | value | ) | `[inline]`

Definition at line 198 of file qset.h.

    { insert(value); return *this; }

QSet<T>& operator&= | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 199 of file qset.h.

    { intersect(other); return *this; }

QSet<T>& operator&= | ( | const T & | value | ) | `[inline]`

Definition at line 200 of file qset.h.

            { QSet<T> result; if (contains(value)) result.insert(value); return (*this = result); }

QSet<T>& operator+= | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 202 of file qset.h.

    { unite(other); return *this; }

QSet<T>& operator+= | ( | const T & | value | ) | `[inline]`

Definition at line 203 of file qset.h.

    { insert(value); return *this; }

QSet<T>& operator-= | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 204 of file qset.h.

    { subtract(other); return *this; }

QSet<T>& operator-= | ( | const T & | value | ) | `[inline]`

Definition at line 205 of file qset.h.

    { remove(value); return *this; }

QSet<T> operator| | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 206 of file qset.h.

            { QSet<T> result = *this; result |= other; return result; }

QSet<T> operator& | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 208 of file qset.h.

            { QSet<T> result = *this; result &= other; return result; }

QSet<T> operator+ | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 210 of file qset.h.

            { QSet<T> result = *this; result += other; return result; }

QSet<T> operator- | ( | const QSet< T > & | other | ) | const `[inline]`

Definition at line 212 of file qset.h.

            { QSet<T> result = *this; result -= other; return result; }

QSet<T> operator| | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 216 of file qset.h.

            { QSet<T> result = *this; result |= other; return result; }

QSet<T> operator& | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 218 of file qset.h.

            { QSet<T> result = *this; result &= other; return result; }

QSet<T> operator+ | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 220 of file qset.h.

            { QSet<T> result = *this; result += other; return result; }

QSet<T> operator- | ( | const QSet< T > & | other | ) | `[inline]`

Definition at line 222 of file qset.h.

            { QSet<T> result = *this; result -= other; return result; }

Q_OUTOFLINE_TEMPLATE QList< T > toList | ( |  | ) | const

Search for all occurrences

Definition at line 291 of file qset.h.

    {
        QList<T> result;
        result.reserve(size());
        typename QSet<T>::const_iterator i = constBegin();
        while (i != constEnd()) {
            result.append(*i);
            ++i;
        }
        return result;
    }

QList<T> values | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 227 of file qset.h.

    { return toList(); }

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

Search for all occurrences

Definition at line 314 of file qset.h.

    {
        return list.toSet();
    }

The documentation for this class was generated from the following file:

- QtCore/qset.h