Question on Hashmap
Hello!
First, I would like to express my appreciation
for the contents of chapter 23 (it's great!)
I would like to know what's the proper
way to instantiate a hashmap, where the
Compare parameter should maintain its
default value, but the Hash function is
other than DefaultHash<Key>
template<typename Key, typename T, typename Compare = std::equal_to<Key>, typename Hash = DefaultHash<Key> >
class hashmap { //... };
I only need the Hash parameter changed.
Must I do something like:
hashmap<int, string, std::equal_to<int>, MidSquare<int> > hash1?
Second question: Since "count" is only used to check whether an
element exists, would there be any consequence in using bool as
a return type instead of size_type for the count method?
Thank you,
A. Alothman
|