The OpenD Programming Language

StackTreeAA

An associative array implementation based on StackTree. Lookups and insertions are O(log N). This is significantly slower in both theory and practice than StackHash, but you may want to use it if:

1. You don't know the approximate size of the table you will be creating in advance. Unlike StackHash, this AA implementation does not need to pre-allocate anything.

2. You care more about worst-case performance than average-case performance.

3. You have a good comparison function for your type, but not a good hash function.

Constructors

this
this(RegionAllocator alloc)

Members

Functions

keys
TreeAaIter!(typeof(tree), "a.key") keys()
opApply
int opApply(int delegate(ref Unqual!(K), ref Unqual!(V)) dg)

Iterate over both the keys and values of this associative array.

opBinaryRight
V* opBinaryRight(K key)
opIndex
V opIndex(K key)

Looks up key in the table, returns it by reference. If it does not exist, it will be created and initialized to V.init. This is handy, for example, when counting things with integer types.

opIndexAssign
V opIndexAssign(V val, K key)
remove
void remove(K key)
values
TreeAaIter!(typeof(tree), getVal) values()

Properties

length
size_t length [@property getter]

Meta