首页 > 试题广场 >

完成hash_map。这涉及到实现find()和equal_

[问答题]
完成hash_map。这涉及到实现find()和equal_range(),再设计一种方式测试这个整个模板。至少用一种默认散列函数不适应的类型测试hash_map。
template<class Key, class T, class H = Hash<Key>, class EQ = equal_to<Key>,  class A = allocator< pair<const Key,T>>>
class hash_map {
  // 与map类似,除了:
  typedef H Hasher;
  typedef EQ key_equal;
  hash_map(const T& dv=T(), size_type n =101, const H& hf=H(), const EQ& =EQ());
  template<class In> hash_map(In first, In last, const T& dv=T(), size_type n = 101, const H& hf =H(), const EQ& =EQ());
};

这道题你会答吗?花几分钟告诉大家答案吧!