Pike v8.1 release 6

Class ADT.OrderedMapping

Description

This class works pretty much as a mapping except the order of the indices is kept in the order they are added.

Example
OrderedMapping m1 = OrderedMapping("foo", 1, "bar", 2);
m1->gazonk = 3;

foreach (m1; string key; int val) {
  write("# %s: %d\n", key, val);
}

/*
  output:
    # foo: 1
    # bar: 2
    # gazonk: 3
*/

m_delete(m1, "gazonk");

m1 += OrderedMapping("afoo", 3);

foreach (m1; string key; int val) {
  write("# %s: %d\n", key, val);
}

/*
  output:
    # foo: 1
    # bar: 2
    # afoo: 3
*/
FIXME

Implement subtraction operator


Method create

ADT.OrderedMapping ADT.OrderedMapping(mixed ... args)

Example
ADT.OrderedMapping m1 = ADT.OrderedMapping("key1", "val1",
                                           "key2", "val2");
Throws

An error is thrown if the number of arguments isn't even.

Parameter args

Odd arguments are the indices, even arguments the values. "index", "value", "index", "value", ...