class TDenseMap

template<class Key, class Value, class KeyInfo = DenseMapInfo<Key>, u32 Size = 64>

Hash-map with densely stored values, using quadratic probing for lookup.

Template parameters

Key

Type that represents the key in the map. Must have a specialization for DenseMapInfo

<Type

, that provides a value representing an empty key value and a tombstone key value (

Value

Type of values to store in the hash-map.

KeyInfo

Type that provides information about empty and tombstone key values for the provided type. The default value will handle pointers and unsigned integers, using -1 for empty key and -2 for tombstone key value.

Size

Initial capacity of the map.

Public

Constructors

TDenseMap<Key, Value, KeyInfo, Size>

TDenseMap<Key, Value, KeyInfo, Size>()

TDenseMap<Key, Value, KeyInfo, Size>

TDenseMap<Key, Value, KeyInfo, Size>(const TDenseMap<Key, Value> &other)

TDenseMap<Key, Value, KeyInfo, Size>

TDenseMap<Key, Value, KeyInfo, Size>(TDenseMap<Key, Value> &&other)

TDenseMap<Key, Value, KeyInfo, Size>

TDenseMap<Key, Value, KeyInfo, Size>(u32 n)

Methods

~TDenseMap<Key, Value, KeyInfo, Size>

~TDenseMap<Key, Value, KeyInfo, Size>()

begin

Iterator begin()

end

Iterator end()

begin

ConstIterator begin() const

end

ConstIterator end() const

empty

bool empty() const

size

u32 size() const

resize

void resize(u32 n)

Grow so that it has at least n mBuckets.

clear

void clear()

contains

bool contains(const Key &key) const

find

Iterator find(const Key &key)

find

ConstIterator find(const Key &key) const

insert

std::pair<Iterator, bool> insert(const std::pair<Key, Value> &pair)

erase

bool erase(const Key &key)

erase

bool erase(Iterator iter)

construct

DensePair &construct(const Key &key)

Operators

operator[]

Value &operator[](const Key &key)

operator=

TDenseMap<Key, Value, KeyInfo, Size> &operator=(const TDenseMap<Key, Value> &other)

operator==

bool operator==(const TDenseMap<Key, Value> &other) const

operator!=

bool operator!=(const TDenseMap<Key, Value> &other) const

Private

Methods

init

void init()

update

void update(DensePair *t)

copy

void copy(const TDenseMap<Key, Value> &other)

insertBucket

DensePair *insertBucket(const Key &key, const Value &value, DensePair *temp)

lookup

bool lookup(const Key &key, DensePair *&f) const

Lookup the appropriate bucket for key, returning it in .

If the bucket contains the key and a value, this returns true, otherwise it returns a bucket with an empty marker or tombstone and returns false.

append

void append(u32 n)

grow

void grow(u32 n)

shrink

void shrink()

getCount

u32 getCount() const

getBuckets

DensePair *getBuckets() const

getTombstones

u32 getTombstones() const

staticgetHashValue

static u32 getHashValue(const Key &key)

staticgetEmptyKey

static const Key getEmptyKey()

staticgetTombstoneKey

static const Key getTombstoneKey()

Fields

mBuckets

DensePair * mBuckets

mCount

u32 mCount

mEntries

u32 mEntries

mTombstones

u32 mTombstones