Re: Associative array literal: length wrong when duplicate keys found

2017-02-02 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 31 January 2017 at 19:45:33 UTC, Ivan Kazmenko wrote: On Tuesday, 31 January 2017 at 17:20:00 UTC, John Colvin wrote: It's a bug, please report it. The initializer should be statically disallowed. Anyway, I'll file a bug report. Hmm, found it:

Re: Associative array literal: length wrong when duplicate keys found

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 31 January 2017 at 17:20:00 UTC, John Colvin wrote: It's a bug, please report it. The initializer should be statically disallowed. Adding a .dup works around the problem. OK. Hmm, but the real use case was a bit more complicated, more like: - int n = 10; foreach (i; 0..n)

Re: Associative array literal: length wrong when duplicate keys found

2017-01-31 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 31 January 2017 at 14:15:58 UTC, Ivan Kazmenko wrote: Hi. I wanted to check whether a few variables of the same type are all distinct, in a quick and dirty way. I tried to do it similar to Python's "len(set(value_list)) == len(value_list)" idiom by using an associative array

Associative array literal: length wrong when duplicate keys found

2017-01-31 Thread Ivan Kazmenko via Digitalmars-d-learn
Hi. I wanted to check whether a few variables of the same type are all distinct, in a quick and dirty way. I tried to do it similar to Python's "len(set(value_list)) == len(value_list)" idiom by using an associative array (AA). At this point, I found out that when initializing the AA with