RandAA

An associative array class that uses randomized probing and open addressing. K is the key type, V is the value type, storeHash determines whether the hash of each key is stored in the array. This increases space requirements, but allows for faster rehashing. By default, the hash is stored unless the array is an array of floating point or integer types.

Constructors

this
this(size_t initSize = 10)

Construct an instance of RandAA with initial size initSize. * initSize determines the amount of slots pre-allocated.

Members

Functions

findExistingAlt
V* findExistingAlt(ref K key, hash_t hashFull)

Hackery

free
void free()

Allows for deleting the contents of the array manually, if supported * by the GC.

keyRange
key_range keyRange()

Does not allocate. Returns a simple forward range.

length
size_t length()
opApply
int opApply(int delegate(ref K, ref V) dg)

Iterate over keys, values in lockstep.

opIn_r
V* opIn_r(K index)

Returns null if index is not found.

opIndex
V opIndex(K index)

Throws a KeyError on unsuccessful key search.

opIndexAssign
void opIndexAssign(V val, K index)
rehash
void rehash()
remove
V remove(K index)

Removes an element from this. Elements *may* be removed while iterating * via .keys.

valueRange
value_range valueRange()

Does not allocate. Returns a simple forward range.

Structs

KeyValRange
struct KeyValRange(K, V, bool storeHash, bool vals)

Meta