TinyMap

Efficient dictionary for cases when the number of possible keys is small and is known at compile-time. The data is held in a static array, no allocations occur.

Key type must: have static member ValueSetSize (integer) have static method fromInternalCode (returning an instance of Key type); have property internal_code that maps it to integers 0, 1, ..., ValueSetSize - 1

Members

Functions

keys
auto keys()

Range of keys

length
size_t length()

Current number of elements

opApply
int opApply(int delegate(K key, V value) dg)

Iteration with foreach

opApply
int opApply(int delegate(V value) dg)

Iteration with foreach

opIn_r
bool opIn_r(K key)

Check if the key is in the dictionary

opIndex
V opIndex(Key key)
const(V) opIndex(Key key)
opIndexAssign
V opIndexAssign(V value, K key)
opIndexOpAssign
void opIndexOpAssign(V value, K key)

Indexed access

remove
bool remove(K key)

Removal

values
auto values()

Range of values

Static functions

opCall
TinyMap!(K, V, TinyMapPolicy) opCall(Args args)

Constructor

Meta