
On 7/22/13 7:47pm, Daniel James wrote:
You can use a custom hash function. Here's an example. I made the modulo dynamic, but if it's a compile time constant, then the container will be a tad bit smaller, and you won't need to pass the hash function and equality predicate as parameters.
Thanks Daniel. I have a question, though. Forgive me if I'm being too naive, but I'm trying to understand what's going on here! :) The code you posted seems to be bound at compile time to the integer p chosen as modulus (i.e., 53). How can I, for instance, find all values that are equal modulo 2 now, without instantiating another unordered_map? Finding elements modulo p, with p given at runtime, is the "something" I'm trying to do here :) The reason I was looking into MultiIndex is this: decoupling the hashing from the actual "equal" predicate. Thanks for any hints!