Struct 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:

struct StackTreeAA(K, V) ;

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

NameDescription
this

Fields

NameTypeDescription
tree StackTree!(Node,"a.key")

Properties

NameTypeDescription
keys[get] TreeAaIter!(typeof(tree),"a.key")
length[get] size_t
values[get] TreeAaIter!(typeof(tree),getVal)

Methods

NameDescription
getVal
opApply Iterate over both the keys and values of this associative array.
opIndex 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
opIn_r
remove

Aliases

NameDescription
Node