File Information
Library: Foundation
Package: Hashing
Header: Poco/HashSet.h
Description
This class implements a set using a LinearHashTable.
A HashSet can be used just like a std::set.
Member Summary
Member Functions: begin, clear, count, empty, end, erase, find, insert, operator =, size, swap
Types
ConstIterator
typedef typename HashTable::ConstIterator ConstIterator;
ConstPointer
typedef const Value * ConstPointer;
ConstReference
typedef const Value & ConstReference;
Hash
typedef HashFunc Hash;
HashTable
typedef LinearHashTable < ValueType, Hash > HashTable;
Iterator
typedef typename HashTable::Iterator Iterator;
Pointer
typedef Value * Pointer;
Reference
typedef Value & Reference;
ValueType
typedef Value ValueType;
Constructors
HashSet
HashSet();
Creates an empty HashSet.
HashSet
HashSet(
std::size_t initialReserve
);
Creates the HashSet, using the given initialReserve.
HashSet
HashSet(
const HashSet & set
);
Creates the HashSet by copying another one.
Destructor
~HashSet
~HashSet();
Destroys the HashSet.
Member Functions
begin
ConstIterator begin() const;
Returns an iterator pointing to the first entry, if one exists.
begin
Iterator begin();
Returns an iterator pointing to the first entry, if one exists.
clear
void clear();
Erases all elements.
count
std::size_t count(
const ValueType & value
) const;
Returns the number of elements with the given value, with is either 1 or 0.
empty
bool empty() const;
Returns true iff the table is empty.
end
ConstIterator end() const;
Returns an iterator pointing to the end of the table.
end
Iterator end();
Returns an iterator pointing to the end of the table.
erase
void erase(
Iterator it
);
Erases the element pointed to by it.
erase
void erase(
const ValueType & value
);
Erases the element with the given value, if it exists.
find
ConstIterator find(
const ValueType & value
) const;
Finds an entry in the table.
find
Iterator find(
const ValueType & value
);
Finds an entry in the table.
insert
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.
operator =
HashSet & operator = (
const HashSet & table
);
Assigns another HashSet.
size
std::size_t size() const;
Returns the number of elements in the table.
swap
void swap(
HashSet & set
);
Swaps the HashSet with another one.