template class Poco::HashSet
Overview
This class implements a set using a LinearHashTable. Moreā¦
#include <HashSet.h> template < class Value, class HashFunc = Hash<Value> > class HashSet { public: // typedefs typedef Value ValueType; typedef Value& Reference; typedef const Value& ConstReference; typedef Value* Pointer; typedef const Value* ConstPointer; typedef HashFunc Hash; typedef LinearHashTable<ValueType, Hash> HashTable; typedef HashTable::Iterator Iterator; typedef HashTable::ConstIterator ConstIterator; // construction HashSet(); HashSet(std::size_t initialReserve); HashSet(const HashSet& set); // methods HashSet& operator=(const HashSet& table); void swap(HashSet& set); ConstIterator begin() const; ConstIterator end() const; Iterator begin(); Iterator end(); ConstIterator find(const ValueType& value) const; Iterator find(const ValueType& value); std::size_t count(const ValueType& value) const; std::pair<Iterator, bool> insert(const ValueType& value); void erase(Iterator it); void erase(const ValueType& value); void clear(); std::size_t size() const; bool empty() const; };
Detailed Documentation
This class implements a set using a LinearHashTable.
A HashSet can be used just like a std::set.
Methods
HashSet& operator=(const HashSet& table)
Assigns another HashSet.
void swap(HashSet& set)
Swaps the HashSet with another one.
ConstIterator begin() const
Returns an iterator pointing to the first entry, if one exists.
ConstIterator end() const
Returns an iterator pointing to the end of the table.
Iterator begin()
Returns an iterator pointing to the first entry, if one exists.
Iterator end()
Returns an iterator pointing to the end of the table.
ConstIterator find(const ValueType& value) const
Finds an entry in the table.
Iterator find(const ValueType& value)
Finds an entry in the table.
std::size_t count(const ValueType& value) const
Returns the number of elements with the given value, with is either 1 or 0.
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.
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.
void clear()
Erases all elements.
std::size_t size() const
Returns the number of elements in the table.
bool empty() const
Returns true iff the table is empty.