The OpenD Programming Language

TTree.insert

Inserts the given value(s) into the tree.

This is not a stable insert. You will get strange results if you insert into a tree while iterating over it.

  1. size_t insert(T value, bool overwrite)
  2. size_t insert(R r, bool overwrite)
    struct TTree(T, Allocator = Mallocator, bool allowDuplicates = false, alias less = "a < b", bool supportGC = shouldAddGCRange!T, size_t cacheLineSize = 64)
    size_t
    insert
    (
    R
    )
    (
    R r
    ,
    bool overwrite = false
    )
    if ()
  3. size_t insert(T[] values, bool overwrite)

Parameters

overwrite bool

if true the given value will replace the first item in the tree that is equivalent (That is greater-than and less-than are both false) to value. This is useful in cases where opCmp and opEquals for T type have different meanings. For example, if the element type is a circle that has a position and a color, the circle could implement opCmp to sort by color, and calling insert with overwrite set to true would allow you to update the position of the circle with a certain color in the tree.

Return Value

Type: size_t

the number of values added.

Meta