Associative arrays - non-intuitive 'in' semantics

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 17 22:33:10 PST 2012


On Sat, Feb 18, 2012 at 04:04:36AM +0100, Andrej Mitrovic wrote:
> AA's seem to be full of bugs.
[...]

Yeah, no kidding. The following code throws an error.

	int[dstring] map;
	foreach (key, val; map) {
		assert(map[key] == val); // throws AssertionError
	}

Can you believe it?


T

-- 
War doesn't prove who's right, just who's left. -- BSD Games' Fortune


More information about the Digitalmars-d mailing list