OpenHashMap.insertAndReturnElement

Insert element, being either a key-value (map-case) or a just a key (set-case).

If element is a nullable type and it is null an AssertError is thrown.

struct OpenHashMap(K, V = void, alias hasher = hashOf, string keyEqualPred = defaultKeyEqualPredOf!(K), alias Allocator = Mallocator.instance, bool borrowChecked = false, bool useSmallLinearSearch = true, bool usePrimeCapacity = false)
ref return
insertAndReturnElement
(
SomeElement
)
(
scope SomeElement element
)

Return Value

Type: T

reference to existing element if present, otherwise new element.

Can be used for implementing, for instance, caching of typically strings.

Meta