RehashingAA.require

Returns the value for the key key, inserting value lazily if it is not present.

struct RehashingAA(AA : V[K], V, K)
ref
require
(
K key
,
lazy V value
)

Parameters

key K

Key.

value V

Value to insert if the key is not present.

Return Value

Type: auto ref

The value for the key key, or value if it was not present.

Examples

RehashingAA!(string[int]) aa;
string hello = aa.require(42, "hello");
assert(hello == "hello");
assert(aa[42] == "hello");