update

fnvoid update(K, V, C, U)(ref V[K] aa, K key, scope C create, scope U update) if (is(typeof(create()) : V) && (is(typeof(update(aa[K.init])) : V) || is(typeof(update(aa[K.init])) == void)))

Calls create if key doesn't exist in the associative array, otherwise calls update. create returns a corresponding value for key. update accepts a value parameter. If it returns a value, the value is set for key.

Parameters

aaThe associative array.
keyThe key.
createThe callable to create a value for key. Must return V.
updateThe callable to call if key exists. Takes a V argument, returns a V or void.