BTreeMap.insert

Inserts the (key, value) in the tree. This is passing the copy of the value into the tree, so it's not necessary to manually create copy of it. Note that for the reference types, this will just copy the reference.

  1. bool insert(KeyType key, ValueType value)
  2. ValueType* insert(KeyType key, ValueType value, bool added)
    struct BTreeMap(TreeKeyType, TreeValueType, int tree_degree)
    insert
    out (ptr) { assert (ptr !is null); }

Parameters

key KeyType

key to insert

value ValueType

value associated to the key to insert.

added bool

indicator if the value has been added, or the value associated with the key was already in the map

Return Value

Type: ValueType*

pointer to the element associated with the given key (either existing or new value).

Complexity: CPU: O(degree * log_degree(n)) Memory:O(log_degree(n))

Meta