ae.utils.aa

Associative Array utility functions

Members

Functions

aaGet
V aaGet(V[K] 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

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.
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>