Map.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 referenced to by the returned pointer 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 referenced by the val parameter of dg is accessible and remains unchanged after dg returned until the next call to put() or clear().

  1. alias remove = BucketSet!(V.sizeof, K).remove
  2. bool remove(K key, void delegate(ref V val) dg)
    class Map(V, K)
    bool
    remove
    (
    K key
    ,
    scope void delegate
    (
    ref V val
    )
    dg = null
    )

Parameters

key K

key to remove mapping for

dg void delegate
(
ref V val
)

optional delegate to call with the removed 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