BIMHome v1.0.0
BIMHome接口文档说明
Public 类型 | Public 成员函数 | Private 类型 | Private 属性 | 所有成员列表
LinkedHashMap< KeyType, MappedType, Hash, Pred > 模板类 参考

链式哈希映射表 更多...

#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 的双向链表
 

详细描述

template<class KeyType, class MappedType, class Hash = std::hash<KeyType>, class Pred = std::equal_to<KeyType>>
class Base::LinkedHashMap< KeyType, MappedType, Hash, Pred >

链式哈希映射表

一个结合了链表和哈希表特性的映射表,支持快速插入、删除和查找操作。

模板参数
KeyType键类型
MappedType映射值类型
Hash哈希函数,默认为 std::hash<KeyType>
Pred键比较函数,默认为 std::equal_to<KeyType>

该类的文档由以下文件生成: