SortedMap

RedBlack trees of (key, value) pairs

Iterator iterator (bool forward)
Iterator iterator (K key, bool forward)
int opApply (int delegate (ref V value) dg)
int opApply (int delegate (ref K key, ref V value) dg)

bool contains (V value)
bool containsKey (K key)
bool containsPair (K key, V value)
bool keyOf (V value, ref K key)
bool get (K key, ref V value)

bool take (ref V v)
bool take (K key, ref V v)
bool removeKey (K key)
size_t remove (V value, bool all)
size_t remove (IContainer!(V) e, bool all)

bool add (K key, V value)
size_t replace (V oldElement, V newElement, bool all)
bool replacePair (K key, V oldElement, V newElement)
bool opIndexAssign (V element, K key)
K    nearbyKey (K key, bool greater)
V    opIndex (K key)
V*   opBinaryRight!"in" (K key)

size_t size ()
bool isEmpty ()
V[] toArray (V[] dst)
SortedMap dup ()
SortedMap clear ()
SortedMap reset ()
SortedMap comparator (Comparator c)

Constructors

this
this(Comparator c)

Make an empty tree, using given Comparator for ordering

Destructor

~this
~this()

Clean up when deleted

Members

Aliases

Type
alias Type = RedBlack!(K, V)
Undocumented in source.

Functions

add
bool add(K key, V value)

Time complexity: O(log n)

cache
SortedMap cache(size_t chunk, size_t count)

Configure the assigned allocator with the size of each allocation block (number of nodes allocated at one time) and the number of nodes to pre-populate the cache with.

check
SortedMap check()
clear
SortedMap clear()

Time complexity: O(n)

comparator
SortedMap comparator(Comparator c)

Use a new Comparator. Causes a reorganization

contains
bool contains(V value)

Time complexity: O(log n)

containsKey
bool containsKey(K key)

Time complexity: O(log n)

containsPair
bool containsPair(K key, V value)

Time complexity: O(n)

dup
SortedMap dup()

Create an independent copy. Does not clone elements

firstKey
K firstKey()

Return the first key of the map

get
bool get(K key, V value)

Return the value associated with Key key.

isEmpty
bool isEmpty()

Is this container empty?

iterator
Iterator iterator(bool forward)

Return a generic iterator for contained elements

iterator
Iterator iterator(K key, bool forward)

Return an iterator which return all elements matching or greater/lesser than the key in argument. The second argument dictates traversal direction.

keyOf
bool keyOf(V value, K key)

Time complexity: O(n)

lastKey
K lastKey()

Return the last key of the map

nearbyKey
K nearbyKey(K key, bool after)

Return the value of the key exactly matching the provided key or, if none, the key just after/before it based on the setting of the second argument

opApply
int opApply(int delegate(ref V value) dg)
opApply
int opApply(int delegate(ref K key, ref V value) dg)
opBinaryRight
V* opBinaryRight(K key)

Return the value associated with Key key.

opIndex
V opIndex(K key)

Operator retreival function

opIndexAssign
bool opIndexAssign(V element, K key)

Time complexity: O(log n)

remove
size_t remove(IContainer!(V) e, bool all)
remove
size_t remove(V value, bool all)

Time complexity: O(n)

removeKey
bool removeKey(K key)

Time complexity: O(log n)

replace
size_t replace(V oldElement, V newElement, bool all)

Time complexity: O(n)

replacePair
bool replacePair(K key, V oldElement, V newElement)

Time complexity: O(log n)

reset
SortedMap reset()

Reset the SortedMap contents. This releases more memory than clear() does

size
size_t size()

Return the number of elements contained

take
bool take(V v)

Time complexity: O(log n)

take
bool take(K key, V value)

Time complexity: O(log n)

toArray
V[] toArray(V[] dst)

Copy and return the contained set of values in an array, using the optional dst as a recipient (which is resized as necessary).

Variables

tree
Ref tree;
Undocumented in source.

Meta