On 3/14/12 2:01 PM, H. S. Teoh wrote:
However, this change broke this code:

        AssociativeArray!(wstring,int) aa;
        aa["abc"] = 123;      // error: compiler deduces K as string,
                                // so isCompatWithKey!K fails: string
                                // can't implicitly convert to wstring

Whereas before, when opIndexAssign looked like this:

                void opIndexAssign(in Value v, in Key key)
                {
                        ...
                }

everything worked, because the compiler deduces the type of "abc" as
wstring since Key==wstring.

Aha! This is one of those cases in which built-in magic smells of putrid beef soup.

I think it's possible to still make this work by beefing up the template constraints such that the working signature is selected for strings.


Andrei

Reply via email to