|
BIMHome v1.0.0
BIMHome接口文档说明
|
链式哈希映射表 更多...
#include <LinkedHashMap.h>
Public 类型 | |
| typedef std::list< EntryType >::const_iterator | const_iterator |
| list 中的 const 迭代器类型 | |
| typedef std::pair< const KeyType, MappedType > | EntryType |
| 保存的 entry 的类型 | |
| typedef std::list< EntryType >::iterator | iterator |
| list 中的非 const 迭代器类型 | |
Public 成员函数 | |
| iterator | begin () |
| 获取首元素的迭代器 | |
| const_iterator | begin () const |
| 获取首元素的 const 迭代器 | |
| void | clear () |
| 清空所有 entry | |
| bool | empty () const |
| 获取该 map 是否为空 | |
| iterator | end () |
| 获取尾元素的迭代器 | |
| const_iterator | end () const |
| 获取尾元素的 const 迭代器 | |
| void | erase (const KeyType &key) |
| 移除指定键值的 entry | |
| void | erase (iterator pos) |
| 移除位于 pos 处的 entry | |
| iterator | find (const KeyType &key) |
| 在 map 中查找元素,如存在则返回其迭代器,否则返回 end() | |
| const_iterator | find (const KeyType &key) const |
| find() 的 const 版本 | |
| std::pair< iterator, bool > | insert (const EntryType &new_entry) |
| 在 map 中插入一个新 entry | |
| iterator | insert (const_iterator it, const EntryType &new_entry) |
| 在 map 中指定位置插入一个新 entry | |
| bool | operator== (const LinkedHashMap &linkedHashMap) |
| == 运算符重载 | |
| MappedType & | operator[] (const KeyType &key) |
| [] 运算符重载 | |
| size_t | size () const |
| 返回 entries 的数量 | |
Private 类型 | |
| typedef HashMap::const_iterator | _map_citr |
| 哈希表const迭代器类型 | |
| typedef HashMap::iterator | _map_itr |
| 哈希表迭代器类型 | |
| typedef std::unordered_map< KeyType, iterator, Hash, Pred > | HashMap |
| 用于存储键到迭代器映射的哈希表 | |
Private 属性 | |
| HashMap | _map_key2entry |
| 保存 key 到 entry 的 hashmap | |
| size_t | _size |
| entry 的数量/O | |
| std::list< EntryType > | _values |
| 实际存放 entry 的双向链表 | |
链式哈希映射表
一个结合了链表和哈希表特性的映射表,支持快速插入、删除和查找操作。
| KeyType | 键类型 |
| MappedType | 映射值类型 |
| Hash | 哈希函数,默认为 std::hash<KeyType> |
| Pred | 键比较函数,默认为 std::equal_to<KeyType> |