On Tue, 25 Feb 2014 15:12:41 -0500, Jacob Carlborg <d...@me.com> wrote:
The thing is that the compiler complains about a deceleration looking
uint tag, index;
If the compiler generates opEquals and opCmp, then it's guaranteed
opEquals(x, y) is equivalent to opCmp(x, y) == 0.
The compiler should NOT complain about this, which I should have more
clearly stated (I thought I had).
Neither opEquals or opCmp is overloaded. A simple test case will also
show that the compiler doesn't not complain about a missing opCmp. I
have not been able to create a reduced test case for this.
I realized, after trying to get opCmp to work, I was missing a piece --
toHash! I couldn't get the thing to only store one key!
So I have to update my requirements. Here are the two cases where a struct
T should be usable as an AA key:
1. Neither opCmp nor opEquals are defined (and defaults are generated).
2. Both opEquals and toHash are defined.
Any other key types should be disallowed.