I know similar questions have been asked on this topic before, but I could not find an answer that applied to my case particularly.
I’m using Visual 2015, and I noticed when I got a C206 compilation error in xhash (“term does not evaluate to a function take 2 args”) for passing two different hash functions to the unordered_map constructor that the stl unordered_map constructor does not have an override that takes two hash classes/functions. You can only apply the hash to either the key or the value but not both. Does that mean I will have to override the pair class and add another constructor that takes two Hash functions (How would I go about doing this efficiently)?
Is it bad practice in general to have an object as a key and value? For instance, in my case I was trying to map a pair to an Edge object and vice versa. From my understanding if both objects are hashable, there should be no reason that a size_t value can’t map to another size_t value. Why then, isn’t there a default implementation for that constructor.
I also recognize that I could make an intermediate map that takes the objects and maps them to their hash values or just hash both objects first and map the size_t values but that seems cumbersome. Is there a better way than the ones I’ve mentioned above?