The exact requirements on hash_map
vary with the implementation, and some of them (as you've seen) don't make a whole lot of sense. That's part of why they decided not to include a hash_map
(or hash_*
) in TR1 and/or C++0x. Instead, they have unordered_[multi](map|set)
, which requires only equal_key
, not operator<
.
Bottom line: unless you have a truly outstanding reason to do otherwise, use unordered_map
instead of hash_map
.