MutexedAA.get

Retrieves the value for the key key, or returns the default value if there was none.

struct MutexedAA(AA : V[K], V, K)
get
(
K key
,
lazy V value
)

Parameters

key K

Key.

value V

Lazy default value.

Return Value

Type: auto

The value for the key key, or value if there was no value there.

Examples

MutexedAA!(int[int]) aa;
aa.setup();  // important!
aa[1] = 42;
aa[2] = 99;

assert(aa.get(1, 0) == 42);
assert(aa.get(2, 0) == 99);
assert(aa.get(0, 0) == 0);
assert(aa.get(3, 999) == 999);

assert(!aa.has(0));
assert(!aa.has(3));