NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > 模板类 参考

平坦哈希表容器 更多...

#include <flat_hashtable.hpp>

类 neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > 继承关系图:
[图例]

Public 类型

using key_type = Key
 键类型
using hasher = HashFcn
 哈希函数类型
using key_equal = EqualKey
 键相等比较函数类型
using value_type = Value
 值类型
using pointer = Value*
 指针类型
using reference = Value&
 引用类型
using const_pointer = const Value*
 常量指针类型
using const_reference = const Value&
 常量引用类型
using size_type = size_t
 大小类型
using difference_type = ptrdiff_t
 差值类型
using iterator = flat_hashtable_iterator<false, flat_hashtable>
 迭代器类型
using const_iterator = flat_hashtable_iterator<true, flat_hashtable>
 常量迭代器类型
using allocator_type = Alloc
 分配器类型

Public 成员函数

 flat_hashtable (const size_type n=0)
 构造函数,指定初始容量
 flat_hashtable (const size_type n, const HashFcn &hf)
 构造函数,指定初始容量和哈希函数
 flat_hashtable (const size_type n, const HashFcn &hf, const EqualKey &eql)
 构造函数,指定初始容量、哈希函数和相等比较函数
 flat_hashtable (const size_type n, const HashFcn &hf, const EqualKey &eql, const ExtractKey &ext)
 构造函数,指定所有函数对象
 flat_hashtable (const flat_hashtable &other)
 拷贝构造函数
flat_hashtableoperator= (const flat_hashtable &other)
 拷贝赋值运算符
 flat_hashtable (flat_hashtable &&other) noexcept
 移动构造函数
flat_hashtableoperator= (flat_hashtable &&other) noexcept
 移动赋值运算符
 ~flat_hashtable ()
 析构函数
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
 获取容量(slot 总数)
hasher hash_function () const noexcept(is_nothrow_copy_constructible_v< hasher >)
 获取哈希函数对象
key_equal key_eql () const noexcept(is_nothrow_copy_constructible_v< key_equal >)
 获取键相等比较函数对象
float load_factor () const noexcept
 获取当前负载因子
float max_load_factor () const noexcept
 获取最大负载因子
void max_load_factor (const float lf) noexcept
 设置最大负载因子
void rehash (const size_type new_size)
 重新哈希,调整容量
void reserve (const size_type n)
 预留空间
template<typename... Args>
pair< iterator, bool > emplace_unique (Args &&... args)
 构造元素(唯一键版本)
template<typename... Args>
iterator emplace_equal (Args &&... args)
 构造元素(允许重复键版本)
pair< iterator, bool > insert_unique (const value_type &value)
 插入元素(唯一键,拷贝版本)
pair< iterator, bool > insert_unique (value_type &&value)
 插入元素(唯一键,移动版本)
iterator insert_equal (const value_type &value)
 插入元素(允许重复键,拷贝版本)
iterator insert_equal (value_type &&value)
 插入元素(允许重复键,移动版本)
template<typename Iterator>
enable_if_t< is_ranges_fwd_iter_v< Iterator > > insert_unique (Iterator first, Iterator last)
 范围插入元素(唯一键,前向迭代器版本)
template<typename Iterator>
enable_if_t<!is_ranges_fwd_iter_v< Iterator > > insert_unique (Iterator first, Iterator last)
 范围插入元素(唯一键,非前向迭代器版本)
void insert_unique (std::initializer_list< value_type > ilist)
 初始化列表插入(唯一键)
template<typename Iterator>
enable_if_t< is_ranges_fwd_iter_v< Iterator > > insert_equal (Iterator first, Iterator last)
 范围插入元素(允许重复键,前向迭代器版本)
template<typename Iterator>
enable_if_t<!is_ranges_fwd_iter_v< Iterator > > insert_equal (Iterator first, Iterator last)
 范围插入元素(允许重复键,非前向迭代器版本)
void insert_equal (std::initializer_list< value_type > ilist)
 初始化列表插入(允许重复键)
size_type erase (const key_type &key) noexcept
 删除所有具有指定键的元素
iterator erase (const iterator &position) noexcept
 删除指定位置的元素
iterator erase (iterator first, iterator last) noexcept
 删除指定范围内的元素
const_iterator erase (const const_iterator &position) noexcept
 删除指定位置的元素(常量迭代器版本)
const_iterator erase (const_iterator first, const_iterator last) noexcept
 删除指定范围内的常量元素
void clear () noexcept
 清空哈希表
iterator find (const key_type &key) noexcept
 查找具有指定键的元素
const_iterator find (const key_type &key) const noexcept
 查找具有指定键的元素(常量版本)
size_type count (const key_type &key) const noexcept
 统计具有指定键的元素数量
bool contains (const key_type &key) const noexcept
 检查是否包含指定键
pair< iterator, iteratorequal_range (const key_type &key)
 获取等于指定键的元素范围
pair< const_iterator, const_iteratorequal_range (const key_type &key) const
 获取等于指定键的元素范围(常量版本)
void swap (flat_hashtable &other) noexcept
 交换两个哈希表的内容
bool equal_to (const flat_hashtable &rhs) const
 相等比较操作符
bool less_than (const flat_hashtable &rhs) const noexcept(noexcept(_NEFORCE lexicographical_compare(cbegin(), cend(), rhs.cbegin(), rhs.cend())))
 小于比较操作符
Public 成员函数 继承自 neforce::icollector< flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > >
constexpr decltype(auto) size () const noexcept(noexcept(derived().size()))
 获取集合大小
constexpr bool empty () const noexcept(noexcept(derived().empty()))
 检查集合是否为空
Public 成员函数 继承自 neforce::icomparable< flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > >
constexpr bool operator== (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(derived().equal_to(rhs)))
 相等比较运算符
constexpr bool operator!= (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(derived().equal_to(rhs))))
 不等比较运算符
constexpr bool operator< (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(derived().less_than(rhs)))
 小于比较运算符
constexpr bool operator> (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(rhs.less_than(derived())))
 大于比较运算符
constexpr bool operator<= (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(rhs.less_than(derived()))))
 小于等于比较运算符
constexpr bool operator>= (const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(derived().less_than(rhs))))
 大于等于比较运算符

静态 Public 属性

static constexpr byte_t FLAT_HT_EMPTY = 0x80
 EMPTY 元数据标记
static constexpr byte_t FLAT_HT_DELETED = 0xFE
 DELETED 元数据标记
static constexpr byte_t FLAT_HT_H2_MASK = 0x7F
 H2 标签位掩码

详细描述

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
class neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >

平坦哈希表容器

模板参数
Value值类型
Key键类型
HashFcn哈希函数类型
ExtractKey从值中提取键的函数对象类型
EqualKey键相等比较函数对象类型
Alloc分配器类型(用于 Value 分配)

平坦哈希表使用开放寻址法处理冲突,采用元数据控制块实现 H2 预过滤, 提供平均常数时间复杂度的插入、删除和查找操作。

在文件 flat_hashtable.hpp179 行定义.

构造及析构函数说明

◆ flat_hashtable() [1/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( const size_type n = 0)
inlineexplicit

构造函数,指定初始容量

参数
n初始容量提示

在文件 flat_hashtable.hpp667 行定义.

◆ flat_hashtable() [2/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( const size_type n,
const HashFcn & hf )
inline

构造函数,指定初始容量和哈希函数

参数
n初始容量提示
hf哈希函数

在文件 flat_hashtable.hpp681 行定义.

◆ flat_hashtable() [3/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( const size_type n,
const HashFcn & hf,
const EqualKey & eql )
inline

构造函数,指定初始容量、哈希函数和相等比较函数

参数
n初始容量提示
hf哈希函数
eql相等比较函数

在文件 flat_hashtable.hpp697 行定义.

◆ flat_hashtable() [4/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( const size_type n,
const HashFcn & hf,
const EqualKey & eql,
const ExtractKey & ext )
inline

构造函数,指定所有函数对象

参数
n初始容量提示
hf哈希函数
eql相等比较函数
ext值提取函数

在文件 flat_hashtable.hpp715 行定义.

◆ flat_hashtable() [5/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & other)
inline

拷贝构造函数

参数
other源哈希表

在文件 flat_hashtable.hpp731 行定义.

◆ flat_hashtable() [6/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::flat_hashtable ( flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > && other)
inlinenoexcept

移动构造函数

参数
other源哈希表

在文件 flat_hashtable.hpp761 行定义.

成员函数说明

◆ begin() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::begin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

返回
指向第一个元素的常量迭代器

在文件 flat_hashtable.hpp821 行定义.

◆ begin() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::begin ( )
inlinenodiscardnoexcept

获取起始迭代器

返回
指向第一个元素的迭代器

在文件 flat_hashtable.hpp801 行定义.

◆ capacity()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
size_type neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::capacity ( ) const
inlinenodiscardnoexcept

获取容量(slot 总数)

返回
容量

在文件 flat_hashtable.hpp871 行定义.

◆ cbegin()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::cbegin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

返回
指向第一个元素的常量迭代器

在文件 flat_hashtable.hpp833 行定义.

◆ cend()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::cend ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

返回
指向末尾的常量迭代器

在文件 flat_hashtable.hpp847 行定义.

◆ contains()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
bool neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::contains ( const key_type & key) const
inlinenodiscardnoexcept

检查是否包含指定键

参数
key要检查的键
返回
是否包含

在文件 flat_hashtable.hpp1330 行定义.

◆ count()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
size_type neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::count ( const key_type & key) const
inlinenodiscardnoexcept

统计具有指定键的元素数量

参数
key要统计的键
返回
匹配的元素数量

在文件 flat_hashtable.hpp1303 行定义.

◆ emplace_equal()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename... Args>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::emplace_equal ( Args &&... args)
inline

构造元素(允许重复键版本)

模板参数
Args构造参数类型
参数
args构造参数
返回
指向插入元素的迭代器

在文件 flat_hashtable.hpp971 行定义.

◆ emplace_unique()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename... Args>
pair< iterator, bool > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::emplace_unique ( Args &&... args)
inline

构造元素(唯一键版本)

模板参数
Args构造参数类型
参数
args构造参数
返回
插入结果(迭代器和是否成功)

在文件 flat_hashtable.hpp935 行定义.

◆ empty()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
bool neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::empty ( ) const
inlinenodiscardnoexcept

检查是否为空

返回
是否为空

在文件 flat_hashtable.hpp865 行定义.

◆ end() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::end ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

返回
指向末尾的常量迭代器

在文件 flat_hashtable.hpp827 行定义.

◆ end() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::end ( )
inlinenodiscardnoexcept

获取结束迭代器

返回
指向末尾的迭代器

在文件 flat_hashtable.hpp815 行定义.

◆ equal_range() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
pair< iterator, iterator > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::equal_range ( const key_type & key)
inlinenodiscard

获取等于指定键的元素范围

参数
key键值
返回
包含范围起始和结束的 pair

在文件 flat_hashtable.hpp1337 行定义.

◆ equal_range() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
pair< const_iterator, const_iterator > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::equal_range ( const key_type & key) const
inlinenodiscard

获取等于指定键的元素范围(常量版本)

参数
key键值
返回
包含范围起始和结束的 pair

在文件 flat_hashtable.hpp1387 行定义.

◆ equal_to()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
bool neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::equal_to ( const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & rhs) const
inlinenodiscard

相等比较操作符

参数
rhs右侧哈希表
返回
如果两个哈希表大小相等且对应元素相等返回 true

在文件 flat_hashtable.hpp1454 行定义.

◆ erase() [1/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::erase ( const const_iterator & position)
inlinenoexcept

删除指定位置的元素(常量迭代器版本)

参数
position要删除的位置
返回
指向被删除元素之后位置的常量迭代器

在文件 flat_hashtable.hpp1218 行定义.

◆ erase() [2/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::erase ( const iterator & position)
inlinenoexcept

删除指定位置的元素

参数
position要删除的位置
返回
指向被删除元素之后位置的迭代器

在文件 flat_hashtable.hpp1164 行定义.

◆ erase() [3/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
size_type neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::erase ( const key_type & key)
inlinenoexcept

删除所有具有指定键的元素

参数
key要删除的键
返回
删除的元素数量

在文件 flat_hashtable.hpp1133 行定义.

◆ erase() [4/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::erase ( const_iterator first,
const_iterator last )
inlinenoexcept

删除指定范围内的常量元素

参数
first起始迭代器
last结束迭代器
返回
指向最后一个被删除元素之后位置的常量迭代器

在文件 flat_hashtable.hpp1228 行定义.

◆ erase() [5/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::erase ( iterator first,
iterator last )
inlinenoexcept

删除指定范围内的元素

参数
first起始迭代器
last结束迭代器
返回
指向最后一个被删除元素之后位置的迭代器

在文件 flat_hashtable.hpp1194 行定义.

◆ find() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
const_iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::find ( const key_type & key) const
inlinenodiscardnoexcept

查找具有指定键的元素(常量版本)

参数
key要查找的键
返回
指向第一个匹配元素的常量迭代器,未找到则返回 cend()

在文件 flat_hashtable.hpp1277 行定义.

◆ find() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::find ( const key_type & key)
inlinenodiscardnoexcept

查找具有指定键的元素

参数
key要查找的键
返回
指向第一个匹配元素的迭代器,未找到则返回 end()

在文件 flat_hashtable.hpp1251 行定义.

◆ hash_function()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
hasher neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hash_function ( ) const
inlinenodiscardnoexcept

获取哈希函数对象

返回
哈希函数对象的副本

在文件 flat_hashtable.hpp877 行定义.

◆ insert_equal() [1/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_equal ( const value_type & value)
inline

插入元素(允许重复键,拷贝版本)

参数
value要插入的值
返回
指向插入元素的迭代器

在文件 flat_hashtable.hpp1047 行定义.

◆ insert_equal() [2/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename Iterator>
enable_if_t<!is_ranges_fwd_iter_v< Iterator > > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_equal ( Iterator first,
Iterator last )
inline

范围插入元素(允许重复键,非前向迭代器版本)

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 flat_hashtable.hpp1116 行定义.

◆ insert_equal() [3/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename Iterator>
enable_if_t< is_ranges_fwd_iter_v< Iterator > > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_equal ( Iterator first,
Iterator last )
inline

范围插入元素(允许重复键,前向迭代器版本)

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 flat_hashtable.hpp1099 行定义.

◆ insert_equal() [4/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_equal ( std::initializer_list< value_type > ilist)
inline

初始化列表插入(允许重复键)

参数
ilist初始化列表

在文件 flat_hashtable.hpp1126 行定义.

被这些函数引用 neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::insert_equal().

◆ insert_equal() [5/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
iterator neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_equal ( value_type && value)
inline

插入元素(允许重复键,移动版本)

参数
value要插入的值
返回
指向插入元素的迭代器

在文件 flat_hashtable.hpp1054 行定义.

◆ insert_unique() [1/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
pair< iterator, bool > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_unique ( const value_type & value)
inline

插入元素(唯一键,拷贝版本)

参数
value要插入的值
返回
插入结果(迭代器和是否成功)

在文件 flat_hashtable.hpp1033 行定义.

◆ insert_unique() [2/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename Iterator>
enable_if_t<!is_ranges_fwd_iter_v< Iterator > > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_unique ( Iterator first,
Iterator last )
inline

范围插入元素(唯一键,非前向迭代器版本)

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 flat_hashtable.hpp1080 行定义.

◆ insert_unique() [3/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
template<typename Iterator>
enable_if_t< is_ranges_fwd_iter_v< Iterator > > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_unique ( Iterator first,
Iterator last )
inline

范围插入元素(唯一键,前向迭代器版本)

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 flat_hashtable.hpp1063 行定义.

◆ insert_unique() [4/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_unique ( std::initializer_list< value_type > ilist)
inline

初始化列表插入(唯一键)

参数
ilist初始化列表

在文件 flat_hashtable.hpp1090 行定义.

被这些函数引用 neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::insert_unique().

◆ insert_unique() [5/5]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
pair< iterator, bool > neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::insert_unique ( value_type && value)
inline

插入元素(唯一键,移动版本)

参数
value要插入的值
返回
插入结果(迭代器和是否成功)

在文件 flat_hashtable.hpp1040 行定义.

◆ key_eql()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
key_equal neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::key_eql ( ) const
inlinenodiscardnoexcept

获取键相等比较函数对象

返回
键相等比较函数对象的副本

在文件 flat_hashtable.hpp883 行定义.

◆ less_than()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
bool neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::less_than ( const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & rhs) const
inlinenodiscardnoexcept

小于比较操作符

参数
rhs右侧哈希表
返回
按字典序比较结果

在文件 flat_hashtable.hpp1475 行定义.

◆ load_factor()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
float neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::load_factor ( ) const
inlinenodiscardnoexcept

获取当前负载因子

返回
负载因子(元素数量/容量)

在文件 flat_hashtable.hpp889 行定义.

◆ max_load_factor() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
float neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::max_load_factor ( ) const
inlinenodiscardnoexcept

获取最大负载因子

返回
最大负载因子

在文件 flat_hashtable.hpp897 行定义.

◆ max_load_factor() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::max_load_factor ( const float lf)
inlinenoexcept

设置最大负载因子

参数
lf新的最大负载因子

在文件 flat_hashtable.hpp903 行定义.

◆ max_size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
size_type neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::max_size ( ) const
inlinenodiscardnoexcept

获取最大可能大小

返回
最大元素数量

在文件 flat_hashtable.hpp859 行定义.

◆ operator=() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
flat_hashtable & neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::operator= ( const flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & other)
inline

拷贝赋值运算符

参数
other源哈希表
返回
自身引用

在文件 flat_hashtable.hpp744 行定义.

◆ operator=() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
flat_hashtable & neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::operator= ( flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > && other)
inlinenoexcept

移动赋值运算符

参数
other源哈希表
返回
自身引用

在文件 flat_hashtable.hpp783 行定义.

◆ rehash()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::rehash ( const size_type new_size)
inline

重新哈希,调整容量

参数
new_size目标容量

在文件 flat_hashtable.hpp913 行定义.

◆ reserve()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::reserve ( const size_type n)
inline

预留空间

参数
n期望的元素数量

确保哈希表至少能容纳 n 个元素而不触发 rehash。

在文件 flat_hashtable.hpp921 行定义.

◆ size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
size_type neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::size ( ) const
inlinenodiscardnoexcept

获取元素数量

返回
元素数量

在文件 flat_hashtable.hpp853 行定义.

◆ swap()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
void neforce::flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::swap ( flat_hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & other)
inlinenoexcept

交换两个哈希表的内容

参数
other要交换的另一个哈希表

在文件 flat_hashtable.hpp1434 行定义.


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