HashMap

This struct implements a hashmap type, much like the standard associative array type.

This map should be almost totally usable in @safe pure nothrow functions.

An empty map will be a valid object, and will not result in any allocations.

Members

Aliases

ThisType
alias ThisType = typeof(this)
Undocumented in source.

Functions

get
V get(K key, V2 def)

Get a value from the map, or return the given default value, which is lazy-evaluated.

get
V get(K key)

Get a value from the map, or return V.init if a value is not set for a given key.

opBinaryRight
V* opBinaryRight(K key)

Implement the 'in' operator for a map.

opEquals
bool opEquals(const(HashMap!(K, V)) otherMap)

Test if two maps are equal.

opEquals
bool opEquals(const(HashMap!(K, V)) otherMap)

Test if two maps are equal.

opIndex
V opIndex(K key)

Retrieve a value from the map.

opIndexAssign
void opIndexAssign(V value, K key)

Set a value in the map.

remove
bool remove(K key)

Remove a entry from the map if it is set, given a key.

setDefault
V setDefault(K key, V2 value)

Get or create a value from/in the map.

setDefault
V setDefault(K key)

Get or create a value from/in a hashmap.

Properties

length
size_t length [@property getter]

The length of the map.

Meta