HybridHashMap.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 HybridHashMap(K, V = void, alias hasher = hashOf, string keyEqualPred = defaultKeyEqualPredOf!(K), Allocator = Mallocator, Options options = Options.init)
ref return
insertAndReturnElement
(
SomeElement
)
(
scope SomeElement element
)
if (
isAllocator!Allocator
)

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