Library: Foundation
Package: Hashing
Header: Poco/HashSet.h
This class implements a set using a LinearHashTable.
A HashSet can be used just like a std::set.
Member Functions: begin, clear, count, empty, end, erase, find, insert, operator =, size, swap
typedef typename HashTable::ConstIterator ConstIterator;
typedef const Value * ConstPointer;
typedef const Value & ConstReference;
typedef HashFunc Hash;
typedef LinearHashTable < ValueType, Hash > HashTable;
typedef typename HashTable::Iterator Iterator;
typedef Value * Pointer;
typedef Value & Reference;
typedef Value ValueType;
HashSet();
Creates an empty HashSet.
HashSet(
std::size_t initialReserve
);
Creates the HashSet, using the given initialReserve.
HashSet(
const HashSet & set
);
Creates the HashSet by copying another one.
~HashSet();
Destroys the HashSet.
ConstIterator begin() const;
Returns an iterator pointing to the first entry, if one exists.
Iterator begin();
Returns an iterator pointing to the first entry, if one exists.
void clear();
Erases all elements.
std::size_t count(
const ValueType & value
) const;
Returns the number of elements with the given value, with is either 1 or 0.
bool empty() const;
Returns true if and only if the table is empty.
ConstIterator end() const;
Returns an iterator pointing to the end of the table.
Iterator end();
Returns an iterator pointing to the end of the table.
void erase(
Iterator it
);
Erases the element pointed to by it.
void erase(
const ValueType & value
);
Erases the element with the given value, if it exists.
ConstIterator find(
const ValueType & value
) const;
Finds an entry in the table.
Iterator find(
const ValueType & value
);
Finds an entry in the table.
std::pair < Iterator, bool > insert(
const ValueType & value
);
Inserts an element into the set.
If the element already exists in the set, a pair(iterator, false) with iterator pointing to the existing element is returned. Otherwise, the element is inserted an a pair(iterator, true) with iterator pointing to the new element is returned.
HashSet & operator = (
const HashSet & table
);
Assigns another HashSet.
std::size_t size() const;
Returns the number of elements in the table.
void swap(
HashSet & set
);
Swaps the HashSet with another one.