ae.utils.aa

Associative Array utility functions

Members

Functions

aaGet
auto ref aaGet(AA aa, K key)

Get a value from an AA, and throw an exception (not an error) if not found

getOrAdd
V getOrAdd(V[K] aa, K key, V defaultValue)

If key is not in aa, add it with defaultValue. Returns a reference to the value corresponding to key.

merge
V[K] merge(V[K] target, V[K] source)

Merge source into target. Return target.

pairs
KeyValuePair!(K, V)[] pairs(V[K] aa)

Get key/value pairs from AA

sortedPairs
KeyValuePair!(K, V)[] sortedPairs(V[K] aa)

Get key/value pairs from AA, sorted by keys

sortedValues
V[] sortedValues(V[K] aa)

Get values from AA, sorted by keys

toAA
auto toAA(R r)

Slurp a range of two elements (or two-element struct/class) into an AA.

toSet
auto toSet(R r)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

HashSet
struct HashSet(T)

Helper/wrapper for void[0]T

KeyValuePair
struct KeyValuePair(K, V)
Undocumented in source.
MultiAA
struct MultiAA(K, V)

An object which acts mostly as an associative array, with the added property of being able to hold keys with multiple values. These are only exposed explicitly and through iteration

OrderedMap
struct OrderedMap(K, V)

An associative array which retains the order in which elements were added.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>