它是c++支持的hash set,衝突時採用典型的鏈表法c++
template < class Key, // unordered_set::key_type/value_type class Hash = hash<Key>, // unordered_set::hasher class Pred = equal_to<Key>, // unordered_set::key_equal class Alloc = allocator<Key> // unordered_set::allocator_type > class unordered_set;
find(key)的流程:拿到key後,經過Hash函數計算hash值,而後對初始化設置的hash桶數取模,獲得桶的索引,而後經過比較函數Pred比較桶索引中的元素值和查詢key,獲取比較結果,肯定是否查詢到。函數
instert(key):也經過Hash函數計算hash值,獲得桶索引,而後比較是否存在,若是不存在則插入。索引