Hashtable

Constructors

this
this(A allocator)

Constructs a qualified hashtable that will use the provided allocator object. For immutable objects, a RCISharedAllocator must be supplied.

this
this(U assocArr)

Constructs a qualified hashtable out of an associative array. Because no allocator was provided, the hashtable will use the GCAllocator.std.experimental.allocator.gc_allocator..

this
this(A allocator, U assocArr)

Constructs a qualified hashtable out of an associative array that will use the provided allocator object. For immutable objects, a RCISharedAllocator must be supplied.

Members

Functions

clear
void clear()

Removes all the elements in the current hashtable.

empty
bool empty()

Check if the hashtable is empty.

front
auto ref front()

Provide access to the first value in the hashtable. The user must check that the hashtable isn't empty, prior to calling this function. There is no guarantee of the order of the values, as they are placed in the hashtable based on the result of the hash function.

get
V get(K key, V nullValue)

Get the value corresponding to the given key; if it doesn't exist return nullValue.

insert
size_t insert(U assocArr)

Insert the (key, value) pairs of an associative array into the hashtable.

keyValuePairs
Array!(Tuple!(K, "key", V, "value")) keyValuePairs()

Get an array with the existing key-value pairs in the hashtable.

keys
Array!K keys()

Get an array with the existing keys in the hashtable.

length
size_t length()

Returns number of key-value pairs.

opAssign
auto ref opAssign(typeof(this) rhs)

Assign rhs to this hashtable. The current hashtable will now become another reference to rhs, unless rhs is null, in which case the current hashtable will become empty. If rhs refers to the current hashtable nothing will happen.

opBinary
auto ref opBinary(U rhs)
Undocumented in source.
opIndex
Nullable!V opIndex(K key)

Get a Nullable!V corresponding to the given key index.

opIndexAssign
Nullable!V opIndexAssign(U val, K key)

Assign val to the element corresponding to key. If there isn't such a value, return a V.init wrapped inside a Nullable.

opIndexOpAssign
Nullable!V opIndexOpAssign(U val, K key)

Assign to the element corresponding to key the result of applying op to the current value. If there isn't such a value, return a V.init wrapped inside a Nullable.

opIndexUnary
Nullable!V opIndexUnary(K key)

Apply a unary operation to the value corresponding to key. If there isn't such a value, return a V.init wrapped inside a Nullable.

popFront
void popFront()
Undocumented in source. Be warned that the author may not have intended to support it.
rehash
void rehash()
Undocumented in source.
remove
void remove(K key)
Undocumented in source.
size
size_t size()

Returns number of buckets.

values
Array!V values()

Get an array with the existing values in the hashtable.

Meta