Rather than comparing two strings, my operator() method will compare an array of bytes. The problem is, the length of this array can only be determined at run time, and thus I cannot hard-code the number of elements to compare into the function.
Using a specially designated terminating byte (null terminator in the case of strings) embedded into the hash key is undesirable because I want to keep my hash keys as small as possible (they will be < 10 bytes long, and I want to pack as many as possible into memory).
So my question is: Is there any way to have the operator() method compare the correct number of elements without embedding this information into the key?
If sparse_hash_map gives you a constructor that allows you specify a comparator
function, then you can give eqstr a constructor which specifies the length. Store
the length in the object.