C++11's unordered_map
's default constructor looks like this:
explicit unordered_map( size_type bucket_count = /*implementation-defined*/,
const hasher& hash = hasher(),
const key_equal& equal = key_equal(),
const allocator_type& alloc = allocator_type() );
I want to create an unordered_map
with a custom hasher function, but it's the second argument to the constructor.
What bucket count should I use? Is there a magic value I can use to tell the container to decide for itself? Otherwise, is there a heuristic I can use to guesstimate a good bucket number based on something like the number of keys I expect my map to contain? Should I even care?