Wrong lowering for a[b][c]++
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Mar 22 11:55:09 PDT 2012
> On 3/22/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> snip
Hmm, what about (temporary) compatibility with hash literals? You
could add the following to the newAA module:
static import std.traits;
template KeyType(V : V[K], K)
{
alias K KeyType;
}
template ValueType(V : V[K], K)
{
alias V ValueType;
}
and in the AssociativeArray struct:
void opAssign(AA)(AA aa)
if (std.traits.isAssociativeArray!AA
&& is(KeyType!AA == keytype)
&& is(ValueType!AA == valuetype))
{
foreach (key, val; aa)
this[key] = val;
}
Then this will work:
AA!(int, string) intToStr;
intToStr = [1:"foo"];
assert(intToStr[1] == "foo");
Otherwise it will be pretty hard to test the new hashes without
changing a significant amount of code.
More information about the Digitalmars-d
mailing list