associative array: unexpected results after static initialization
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Nov 30 23:53:14 UTC 2017
On Thu, Nov 30, 2017 at 11:50:13PM +0000, kdevel via Digitalmars-d-learn
wrote:
> This program
>
> ``` void aa_stat(T, U) (T[U] aa) { import std.stdio; writefln ("aa
> : %s", aa); writefln ("aa.length : %d", aa.length); writefln ("aa.keys
> : %s", aa.keys); writefln ("aa.values : %s", aa.values); foreach (k,
> v; aa) writeln (k, ": ", v); }
>
> void main () { string[int] aa = [ 0: "null", 0: "eins" ]; aa.aa_stat;
> } ```
>
> produces this output:
>
> aa : [0:"eins", ] aa.length : 2 aa.keys : [0, 32767]
> aa.values : ["eins", ""] 0: eins
[...]
This looks like a bug in the implementation of AA literals. Please file
a bug at http://issues.dlang.org/.
--T
More information about the Digitalmars-d-learn
mailing list