To make a struct a valid key type, do I need to implement both
opCmp and opEquals or just one or the other?  It says on the page
about associative arrays: "The implementation may use either
opEquals or opCmp or both."  Does that mean it uses whichever one
is user-defined (or both if they're both user-defined)?  Or does
it mean the user is responsible for defining both?

Immediately after that it says:
"Care should be taken so that the results of
opEquals and opCmp are consistent with each other when the
struct/union objects are the same or not.", certainly this means
that if a.opEquals(b), then a.opCmp(b) should be 0, but does the
converse have to be true?

Reply via email to