Template Class OpenHashTable
Defined in File OpenHashTable.h
Nested Relationships
Nested Types
Class Documentation
-
template<class K, class V, class H = std::hash<K>>
class OpenHashTable a hash table with open addressing
Public Types
-
using size_type = std::size_t
-
using difference_type = std::ptrdiff_t
-
using const_iterator = SlotIterator<OpenHashTable, Places>
-
using iterator = const_iterator
Public Functions
-
OpenHashTable(std::size_t m, Probing probe, bool restructure = false, H h = H())
the empty table of size m with the given inspection, which restructures itself or not
- Pre:
m > 0 and probe.works( m )
-
void insert(const K &k, const V &v)
associates the value v to the key k; throws std::overflow_error if the inspection finds no place
- Post:
k is in the table
-
void remove(const K &k)
removes the key k, if it is there, leaving a deleted place
- Post:
k is not in the table
-
std::size_t size(void) const
-
bool empty(void) const
-
std::size_t capacity(void) const
the size m of the vector
-
double load(void) const
the load factor n / m
-
template<class F>
void forEach(F &&f) const the foreach of the book: f( k , v ) on the pairs, place after place, O( m ) time
-
Slot slot(std::size_t i) const
the state of the place i
- Pre:
i < capacity()
-
const K &keyAt(std::size_t i) const
the key in the place i
- Pre:
i < capacity() and the place is full
-
std::size_t probes(void) const
the places examined by the last operation
-
std::size_t restructures(void) const
the number of restructurings so far
-
std::size_t moved(void) const
the number of pairs moved by the restructurings so far
-
inline const_iterator begin(void) const
-
inline const_iterator end(void) const
-
inline const_iterator cbegin(void) const
-
inline const_iterator cend(void) const
-
struct Places
the places of the table, for SlotIterator
-
using size_type = std::size_t