btrees

Source   Edit  

BTree implementation with few features, but good enough for the Nim compiler's needs.

Types

BTree[Key; Val] = object
  ## number of key-value pairs
Source   Edit  

Procs

proc add[Key, Val](b: var BTree[Key, Val]; key: Key; val: Val)
Source   Edit  
proc contains[Key, Val](b: BTree[Key, Val]; key: Key): bool
Source   Edit  
proc getOrDefault[Key, Val](b: BTree[Key, Val]; key: Key): Val
Source   Edit  
proc hasNext[Key, Val](b: BTree[Key, Val]; index: int): bool
Source   Edit  
proc initBTree[Key, Val](): BTree[Key, Val]
Source   Edit  
proc len[Key, Val](b: BTree[Key, Val]): int {.inline.}
Source   Edit  
proc next[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int)
Source   Edit  

Iterators

iterator pairs[Key, Val](b: BTree[Key, Val]): (Key, Val)
Source   Edit