AssociativeArray!(string,double) vs. double[string]
Jens Mueller
jens.k.mueller at gmx.de
Thu Jul 28 14:55:45 PDT 2011
Hi,
I'm trying to compare the type of associative arrays:
unittest {
import std.stdio;
double[string] aa;
writeln(typeof(aa).stringof);
writeln(typeof(aa.init).stringof);
writeln(typeid(aa));
writeln(typeid(aa.init));
assert(is(typeof(aa) == typeof(aa.init)));
}
The assert fails which puzzles me. Why is the type of the expression aa
not the same as the type of the expression aa.init? There is a struct
AssociativeArray!(key, value) involved (part of druntime). The typeid
(i.e. the TypeInfo of the respective types of the expressions) are not
the same (double[immutable(char)[]] vs.
object.AssociativeArray!(string,double).AssociativeArray).
Jens
More information about the Digitalmars-d
mailing list