Map

Map class template to store values of a certain type. Manages a mapping from K to V, leaving the hash function implementation to the subclass (abstract BucketSet.toHash()).

Constructors

this
this(size_t n, float load_factor)

Constructor.

this
this(IAllocator allocator, size_t n, float load_factor)

Constructor.

Members

Aliases

MapIterator
alias MapIterator = .MapIterator!(V, K)

MapIterator template instance.

VReturn
alias VReturn = Base[]

If V is a static array, opIndex() und opIndexAssign() need to return a dynamic array slicing the value.

VReturn
alias VReturn = V
Undocumented in source.
remove
alias remove = BucketSet!(V.sizeof, K).remove
Undocumented in source.

Functions

clearErase
typeof(this) clearErase(V val_init)

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

get
V* 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 as above, but includes a counter

opBinaryRight
V* opBinaryRight(K key)

In operator. Looks up the value mapped by key.

opIndex
VReturn opIndex(K key)

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

opIndexAssign
VReturn opIndexAssign(V val, K key)

Adds or updates a mapping from the specified key.

put
V* put(K key, bool added)

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

put
V* put(K key)

Adds or updates a mapping from the specified key.

remove
bool remove(K key, void delegate(ref V val) dg)

Removes the mapping for the specified key and optionally invokes dg with the value that is about to be removed.

Mixins

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

Mixin of the specialized iterator classes which inherit from BucketSet.Iterator. This makes available three iterator classes that can be newed to allow certain iteration behaviors:

Static variables

V_is_static_array
auto V_is_static_array;
Undocumented in source.
V_is_static_array
auto V_is_static_array;
Undocumented in source.
v_init
Base[V.length] v_init;

If V is a static array, opIndex() und opIndexAssign() need to return a dynamic array slicing the value.

v_init
auto v_init;
Undocumented in source.

Parameters

V

type to store in values of map

K

type to store in keys of map

Meta