Template Class DirectTable

Nested Relationships

Nested Types

Class Documentation

template<class V>
class DirectTable

the table with direct access of the keys in [ a , b ], H( k ) = k - a: every operation in O( 1 ) time, b - a + 1 places of memory

Public Types

using Key = long

the type of the keys

using Value = V

the type of the values

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

Public Functions

DirectTable(long a, long b)

the empty table of the keys in [ a , b ]

Pre:

a <= b, and b - a + 1 places fit in a std::size_t (not the whole range of long)

std::optional<V> lookup(long k) const

the value of k, or nothing

Pre:

k in [ a , b ]

void insert(long k, const V &v)

associates v to k

Pre:

k in [ a , b ]

Post:

lookup( k ) is v

void remove(long k)

removes k, if it is there

Pre:

k in [ a , b ]

Post:

lookup( k ) is nothing

std::size_t size(void) const
std::size_t capacity(void) const

the size m = b - a + 1 of the vector

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

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)