BucketSet.remove_

Removes the mapping for the specified key and optionally invokes dg with the value that is about to be removed.

Note that, if references to GC-allocated objects (objects or dynamic arrays), it is a good idea to set the value of the element referenced by the element parameter of the callback delegate to null to avoid these objects from being prevented from garbage collection. In general pointers should be set to null for the same reason and to avoid dangling pointers.

If the default allocator is used (that is, no allocator instance was passed to the constructor), the value of the element referenced by the element parameter of the callback delegate dg is accessible and remains unchanged after dg returned until the next call to put() or clear().

class BucketSet(size_t V, K = hash_t)
protected final
bool
remove_
(
K key
,
scope void delegate dg = null
)

Parameters

key K

key to remove mapping for

dg void delegate
(
ref Bucket.Element element
)

optional delegate to call with the removed element value (not called if key was not found)

Return Value

Type: bool

true if key was found in the map or false if not. In case of false dg was not called.

Meta