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(CallContext* cc, size_t initSize)

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

Members

Aliases

K_
alias K_ = DeconstArrayType!(K).type
Undocumented in source.
V_
alias V_ = DeconstArrayType!(V).type
Undocumented in source.
key_range
alias key_range = KeyValRange!(K, V, storeHash, false)
Undocumented in source.
value_range
alias value_range = KeyValRange!(K, V, storeHash, true)
Undocumented in source.

Functions

clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
findExistingAlt
V* findExistingAlt(K key, hash_t hashFull)

Hackery

free
void free()

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

insertAlt
void insertAlt(K key, V val, hash_t hashFull)
Undocumented in source. Be warned that the author may not have intended to support it.
keyRange
key_range keyRange()

Does not allocate. Returns a simple forward range.

keys
K[] keys()
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length()
opApply
int opApply(int delegate(ref K, ref V) dg)

Iterate over keys, values in lockstep.

opApply
int opApply(int delegate(ref V_ value) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinaryRight
V* opBinaryRight(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.

remove
bool remove(K index, V value)
Undocumented in source. Be warned that the author may not have intended to support it.
valueRange
value_range valueRange()

Does not allocate. Returns a simple forward range.

values
V[] values()
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

getNextP2
size_t getNextP2(size_t n)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

KeyValRange
struct KeyValRange(K, V, bool storeHash, bool vals)
Undocumented in source.

Meta