The OpenD Programming Language

YamlMap

YAML map representation.

The implementation preserves order and allows duplicated keys.

Constructors

this
this(YamlPair[] pairs)
this
this(K[] keys, V[] values)
this
this(K[V] associativeArray)

Members

Functions

_opIn
inout(YamlAlgebraic)* _opIn(char[] key)
inout(YamlAlgebraic)* _opIn(YamlAlgebraic key)
byKeyValue
auto byKeyValue()
opIndex
inout(YamlAlgebraic) opIndex(char[] key)
inout(YamlAlgebraic) opIndex(YamlAlgebraic key)
opIndex
auto opIndex()

Variables

pairs
YamlPair[] pairs;

Examples

YamlMap map = ["a" : 1];
assert(map["a"] == 1);
map[1.YamlAlgebraic] = "a";
map["a"] = 3;
map["a"].get!long++;
map["a"].get!"integer" += 3;
map["a"].integer += 3;
assert(map["a"] == 10);
assert(map[1.YamlAlgebraic] == "a");

// foreach iteration
long sum;
foreach (ref key, ref value; map)
    if (key == "a")
        sum += value.get!long;
assert(sum == 10);

Meta