|
| | flat_unordered_map ()=default |
| | 默认构造函数
|
| | flat_unordered_map (const size_type n) |
| | 构造函数,指定初始容量
|
| | flat_unordered_map (const size_type n, const hasher &hf) |
| | 构造函数,指定初始容量和哈希函数
|
| | flat_unordered_map (const size_type n, const hasher &hf, const key_equal &eql) |
| | 构造函数,指定初始容量、哈希函数和键相等比较函数
|
| | flat_unordered_map (const flat_unordered_map &other) |
| | 拷贝构造函数
|
| flat_unordered_map & | operator= (const flat_unordered_map &other) |
| | 拷贝赋值运算符
|
| | flat_unordered_map (flat_unordered_map &&other) noexcept(is_nothrow_move_constructible_v< base_type >) |
| | 移动构造函数
|
| flat_unordered_map & | operator= (flat_unordered_map &&other) noexcept(is_nothrow_move_assignable_v< base_type >) |
| | 移动赋值运算符
|
| template<typename Iterator> |
| | flat_unordered_map (Iterator first, Iterator last) |
| | 范围构造函数
|
| template<typename Iterator> |
| | flat_unordered_map (Iterator first, Iterator last, const size_type n) |
| | 范围构造函数,指定初始容量
|
| template<typename Iterator> |
| | flat_unordered_map (Iterator first, Iterator last, const size_type n, const hasher &hf) |
| | 范围构造函数,指定初始容量和哈希函数
|
| template<typename Iterator> |
| | flat_unordered_map (Iterator first, Iterator last, const size_type n, const hasher &hf, const key_equal &eql) |
| | 范围构造函数,指定初始容量、哈希函数和键相等比较函数
|
| | flat_unordered_map (std::initializer_list< value_type > ilist) |
| | 初始化列表构造函数
|
| | flat_unordered_map (std::initializer_list< value_type > ilist, const size_type n) |
| | 初始化列表构造函数,指定初始容量
|
| | flat_unordered_map (std::initializer_list< value_type > ilist, const size_type n, const hasher &hf) |
| | 初始化列表构造函数,指定初始容量和哈希函数
|
| | flat_unordered_map (std::initializer_list< value_type > ilist, const size_type n, const hasher &hf, const key_equal &eql) |
| | 初始化列表构造函数,指定初始容量、哈希函数和键相等比较函数
|
| iterator | begin () noexcept |
| | 获取起始迭代器
|
| iterator | end () noexcept |
| | 获取结束迭代器
|
| const_iterator | begin () const noexcept |
| | 获取常量起始迭代器
|
| const_iterator | end () const noexcept |
| | 获取常量结束迭代器
|
| const_iterator | cbegin () const noexcept |
| | 获取常量起始迭代器
|
| const_iterator | cend () const noexcept |
| | 获取常量结束迭代器
|
| size_type | size () const noexcept |
| | 获取元素数量
|
| size_type | max_size () const noexcept |
| | 获取最大可能大小
|
| bool | empty () const noexcept |
| | 检查是否为空
|
| size_type | capacity () const noexcept |
| | 获取容量
|
| size_type | count (const key_type &key) const noexcept(noexcept(ht_.count(key))) |
| | 统计具有指定键的元素数量
|
| bool | contains (const key_type &key) const noexcept(noexcept(ht_.contains(key))) |
| | 检查是否包含指定键
|
| hasher | hash_function () const noexcept(noexcept(ht_.hash_function())) |
| | 获取哈希函数对象
|
| key_equal | key_eql () const noexcept(noexcept(ht_.key_eql())) |
| | 获取键相等比较函数对象
|
| float | load_factor () const noexcept |
| | 获取当前负载因子
|
| float | max_load_factor () const noexcept |
| | 获取最大负载因子
|
| void | max_load_factor (const float lf) noexcept |
| | 设置最大负载因子
|
| void | rehash (const size_type n) |
| | 重新哈希,调整容量
|
| void | reserve (const size_type n) |
| | 预留空间
|
| template<typename... Args> |
| pair< iterator, bool > | emplace (Args &&... args) |
| | 在容器中就地构造元素
|
| pair< iterator, bool > | insert (const value_type &value) |
| | 插入元素(拷贝版本)
|
| pair< iterator, bool > | insert (value_type &&value) |
| | 移动插入元素
|
| template<typename Iterator> |
| void | insert (Iterator first, Iterator last) |
| | 范围插入元素
|
| void | insert (std::initializer_list< value_type > ilist) |
| | 初始化列表插入元素
|
| size_type | erase (const key_type &key) noexcept |
| | 删除所有具有指定键的元素
|
| iterator | erase (const iterator position) noexcept |
| | 删除指定位置的元素
|
| iterator | erase (const iterator first, const iterator last) noexcept |
| | 删除指定范围内的元素
|
| const_iterator | erase (const const_iterator position) noexcept |
| | 删除指定位置的常量元素
|
| const_iterator | erase (const const_iterator first, const const_iterator last) noexcept |
| | 删除指定范围内的常量元素
|
|
void | clear () noexcept |
| | 清空容器
|
| iterator | find (const key_type &key) |
| | 查找具有指定键的元素
|
| const_iterator | find (const key_type &key) const |
| | 查找具有指定键的常量元素
|
| pair< iterator, iterator > | equal_range (const key_type &key) |
| | 获取等于指定键的元素范围
|
| pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
| | 获取等于指定键的常量元素范围
|
| T & | operator[] (const key_type &key) |
| | 下标访问操作符
|
| const T & | at (const key_type &key) const |
| | 带边界检查的常量访问
|
| T & | at (const key_type &key) |
| | 带边界检查的访问
|
| void | swap (flat_unordered_map &other) noexcept(is_nothrow_swappable_v< base_type >) |
| | 交换两个容器
|
| bool | equal_to (const flat_unordered_map &rhs) const noexcept(noexcept(ht_==rhs.ht_)) |
| | 相等比较操作符
|
| bool | less_than (const flat_unordered_map &rhs) const noexcept(noexcept(ht_< rhs.ht_)) |
| | 小于比较操作符
|
template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
class neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >
平坦无序映射容器
- 模板参数
-
flat_unordered_map 是一种关联容器,存储键值对(key-value pairs),每个键在容器中唯一。 元素无序存储,由哈希函数将键映射到槽位。 底层使用开放寻址平坦哈希表,提供优于链地址法的缓存局部性。
- 注解
- 与 unordered_map 不同,本容器使用 pair<Key, T>(非 const Key)作为值类型, 以适应平坦存储的元素搬移需求。
在文件 flat_unordered_map.hpp 第 41 行定义.
template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>