AA's with dstring key

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 15 11:26:38 PST 2012


Why does the following code throw a RangeError?

	void main() {
		int[dstring] map = ["abc"d: 123];
		writeln(map["abc"d]);
	}

Worse yet:

	void main() {
		int[dstring] map = ["abc"d: 123];
		foreach (key, val; map) {
			assert(map[key] == val); // throws RangeError ?!
		}
	}

Everything works fine if dstring is replaced with string.

I'm finding that AA's appear to be riddled with bugs. :(


T

-- 
Gone Chopin. Bach in a minuet.


More information about the Digitalmars-d-learn mailing list