Template Class BucketCuckooTable

Nested Relationships

Nested Types

Class Documentation

template<class K, class V, class H = DefaultHash<K>, class Eq = std::equal_to<K>>
class BucketCuckooTable

a DICTIONARY on the cuckoo hashing with buckets of 4 places

Public Types

using Key = K

the type of the keys

using Value = V

the type of the values

using value_type = std::pair<const K&, const V&>
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = std::pair<const K&, const V&>
using const_reference = std::pair<const K&, const V&>
using const_iterator = SlotIterator<BucketCuckooTable, Places>
using iterator = const_iterator

Public Functions

explicit BucketCuckooTable(std::size_t n = 0, H h = H(), Eq eq = Eq())

the empty table, with room for n pairs before it grows

std::optional<V> lookup(const K &k) const

the value of the key k, or nothing

const V *find(const K &k) const

the value of the key k, nil if it is not there

V *find(const K &k)

the value of the key k, to change in place, nil if it is not there

bool insert(const K &k, const V &v)

associates the value v to the key k; true if k was not there

Post:

k is in the table

bool remove(const K &k)

removes the key k, if it is there; true if it was

Post:

k is not in the table

bool contains(const K &k) const
std::size_t size(void) const
bool empty(void) const
std::size_t capacity(void) const

the places, 4 per bucket

double load(void) const

the load, size() / capacity()

std::size_t rehashes(void) const

the doublings of the table

std::size_t moves(void) const

the keys moved by the insertions

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, for SlotIterator

Public Static Functions

static inline std::size_t size(const auto &o)
static inline bool occupied(const auto &o, std::size_t i)
static inline auto read(const auto &o, std::size_t i)