digitalmars.D - AssociativeArray!(string,double) vs. double[string]
- Jens Mueller (18/18) Jul 28 2011 Hi,
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
Jul 28 2011