Không giống như m ap h, p như h_ ma không dựa trên một bài kiểm tra bình đẳng tổng hợp từ một hoạt động ít hơn ma p, ha sh _m ap (§ ). Điều này là bởi vì các cuộc gọi của eq () trong vòng lặp thông qua các yếu tố với giá trị băm như eq. | Section Lookup 501 not found if b .size max _load V .size if toofull re s ize b. size grow grow return operator k rehash V .push_back Entry k default_value b i add Entry b i V . back point to new element return b i - val Unlike map hash_map doesn t rely on an equality test synthesized from a less-than operation . This is because of the call of eq in the loop that looks through elements with the same hash value. This loop is crucial to the performance of the lookup and for common and obvious key types such as string and C-style strings the overhead of an extra comparison could be significant. I could have used a set Entry to represent the set of values that have the same hash value. However if we have a good hash function h ash and an appropriately-sized hash table b most such sets will have exactly one element. Consequently I linked the elements of that set together using the next field of Entry 27 . Note that b keeps pointers to elements of V and that elements are added to V. In general push_back can cause reallocation and thus invalidate pointers to elements . However in this case constructors and resize carefully reserVe enough space so that no unexpected reallocation happens. Erase and Rehash Hashed lookup becomes inefficient when the table gets too full. To lower the chance of that happening the table is automatically resize d by the subscript operator. The set _load provides a way of controlling when and how resizing happens. Other functions are provided to allow a programmer to observe the state of a h ash_m ap template class Key class T class H Hash Key class EQ equal_to Key class A allocator T class hash_map . Void resize size _type n make the size of the hash table n Void erase iterator position erase the element pointed to size _type size const re turn V. size -no_of_erased number of elements size _type bu cke t_coun t const re tu rn b. size size of hash table Hashe r hash_fun const .