Map

HashMap class template to store the raw data of values of a certain size. Manages a mapping from K to ubyteV, leaving the hash function implementation to the subclass (abstract BucketSet.toHash()). Since static arrays cannot be returned, the access methods return a void[] slice to the value.

Constructors

this
this(size_t n, float load_factor)

Constructor.

Members

Aliases

MapIterator
alias MapIterator = .MapIterator!(Bucket.Element.Val, K)

MapIterator template instance.

opIndex
alias opIndex = get

Obtains a the value mapped by key. A value for key is expected to exist in the map.

Functions

clear
typeof(this) clear(void[] val_init)

Removes all elements from all buckets and sets the element values to val_init.

get
void[] get(K key)

Obtains a reference to the value mapped by key. A value for key is expected to exist in the map.

opApply
int opApply(MapIterator.Dg dg)

'foreach' iteration over key/value pairs currently in the map.

opApply
int opApply(MapIterator.Dgi dgi)

Same method as above, but includes a counter

opBinaryRight
void[] opBinaryRight(K key)

In operator. Looks up the value mapped by key.

opIndexAssign
void[] opIndexAssign(void[] val, K key)

Adds or updates a mapping from key to val, copying the content of val into the map.

put
void[] put(K key, bool added)

Looks up the mapping for key or adds one if not found.

put
void[] put(K key)

Adds or updates a mapping from the specified key. Note that, if a new mapping was added (added outputs true), the returned slice may reference a previously removed value. If this is not desired, copy the desired initial value into the sliced buffer returned by remove().

remove
void[] remove(K key)

Removes the mapping for the specified key.

Mixins

__anonymous
mixin IteratorClass!(BucketSet!(V, K).Iterator, MapIterator)

Mixin of the specialized iterator classes which inherit from BucketSet.Iterator.

Parameters

V

byte length of the values to store in the map, must be at least 1

K

type to store in keys of map

Meta