digitalmars.D.bugs - [Issue 2684] New: Associative arrays have wrong opIndex signatures
- d-bugmail puremagic.com (26/26) Feb 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2684
- d-bugmail puremagic.com (9/9) Mar 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2684
http://d.puremagic.com/issues/show_bug.cgi?id=2684 Summary: Associative arrays have wrong opIndex signatures Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: andrei metalanguage.com void main() { int[string] x; char[] y; if (y in x){} int z = x[y]; } The last two lines do not compile. However it makes of course sense to look up for a char[] or const(char)[] in a hash keyed by immutable(char)[]. Only the operator that inserts stuff into the hash should force the type immutable(char)[]. Bottom line: if the type of the key is K, any type K1 that allows comparison for equality and less-than with K should be accepted for lookup. --
Feb 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2684 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 2.026 --
Mar 11 2009