immutable data = ["foo": 1]; immutable base = new immutable(Hash!(string, int))(data); auto subject = base.insert("bar", 2); V[] values; K[] keys; foreach(K key, V value; subject) { values[values.length++] = value; keys[keys.length++] = key; } assert(values.length == 2); assert(keys.length == 2);
immutable data = ["foo": 1]; immutable base = new immutable(Hash!(string, int))(data); auto subject = base.insert("bar", 2).insert("foo", 3); V[] values; K[] keys; foreach(K key, V value; subject) { values[values.length++] = value; keys[keys.length++] = key; } assert(values.length == 2); assert(keys.length == 2);
Makes foreach work on this class.