template class Core::TreeSet

Overview

Set container class based on red-black tree. More…

#include <coretreeset.h>

template <class T>
class TreeSet
{
public:
    // typedefs

    typedef int (*CompareFunction)(
        const T &,
        const T &
        );

    // classes

    class ExtendedNode;
    class Node;

    // construction

    TreeSet(CompareFunction compareFunction = defaultCompare);
    TreeSet(const TreeSet<T>& other);

    // methods

    TreeSet<T>& operator = (const TreeSet<T>& other);
    bool add(const T& data);
    bool remove(const T& data);
    void removeAll();
    bool isEmpty() const;
    int count() const;
    const T& lookup(const T& data) const;
    bool contains(const T& data) const;
    RangeIterator<TreeSet<T>, TreeSetIterator<T>, const T> begin() const;
    RangeIterator<TreeSet<T>, TreeSetIterator<T>, const T> end() const;
};

Detailed Documentation

Set container class based on red-black tree.

Typedefs

typedef int (*CompareFunction)(
    const T &,
    const T &
    )

Compare function type.

Methods

bool add(const T& data)

Add element to container.

bool remove(const T& data)

Remove element from container.

void removeAll()

Remove all elements.

bool isEmpty() const

Check if container is empty.

int count() const

Get number of elements in container.

const T& lookup(const T& data) const

Find element in container.

bool contains(const T& data) const

Check if container holds given element.