ae.utils.aa

Associative Array utility functions

Members

Functions

aaGet
auto ref aaGet(auto ref AA aa, K key)

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

getOrAdd
V getOrAdd(ref V[K] aa, K key, V defaultValue = V.init)

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

merge
V[K] merge(auto ref V[K] target, in 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(in V[K] aa)

Get values from AA, sorted by keys

toAA
auto toAA(R r)
auto toAA(R r)

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

Structs

HashSet
struct HashSet(T)

Helper/wrapper for void[0]T

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

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>

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