⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hashmap.cpp

📁 Data Abstraction & Problem Solving with C++源码
💻 CPP
字号:
// ****************************************************// Implementation file HashMap.cpp // ****************************************************template <class Key, class T, class Hash>HashMap<Key, T, Hash>::HashMap(int maxBuckets){   hash = Hash();   resize(maxBuckets+1);} // end constructortemplate <class Key, class T, class Hash>T& HashMap<Key, T, Hash>::operator[](Key& key){   return at(hash(key))[key];} // end operator[]template <class Key, class T, class Hash>map<Key, T>::const_iterator HashMap<Key, T, Hash>::findItem                                             (const Key& key){   map<Key, T>::const_iterator it;   int index = hash(key);   it = at(index).find(key);	   return it;} // end findItemtemplate <class Key, class T, class Hash>void HashMap<Key, T, Hash>::insert (const Key& key,                                    const T& item){    int index = hash(key);    at(index).insert(make_pair(key, item));} // end inserttemplate <class Key, class T, class Hash>int HashMap<Key, T, Hash>::erase(const Key& key){    int index = hash(key);    return at(index).erase(key); } // end erase// End of implementation file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -