NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > 模板类 参考

哈希表容器 更多...

#include <hashtable.hpp>

类 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 = hashtable_iterator<false, hashtable>
 迭代器类型
using const_iterator = hashtable_iterator<true, hashtable>
 常量迭代器类型
using allocator_type = Alloc
 分配器类型

Public 成员函数

 hashtable (const size_type n, float max_lf=1.0f)
 构造函数
 hashtable (const size_type n, const HashFcn &hf, float max_lf=1.0f)
 构造函数,指定哈希函数
 hashtable (const size_type n, const HashFcn &hf, const EqualKey &eql, float max_lf=1.0f)
 构造函数,指定哈希函数和相等比较函数
 hashtable (const size_type n, const HashFcn &hf, const EqualKey &eql, const ExtractKey &ext, float max_lf=1.0f)
 构造函数,指定所有函数对象
 hashtable (const hashtable &other)
 拷贝构造函数
hashtableoperator= (const hashtable &other)
 拷贝赋值运算符
 hashtable (hashtable &&other) noexcept(noexcept(hashtable::swap(other)))
 移动构造函数
hashtableoperator= (hashtable &&other) noexcept(noexcept(hashtable::swap(other)))
 移动赋值运算符
 ~hashtable ()
 析构函数
NEFORCE_NODISCARD iterator begin () noexcept
 获取起始迭代器
NEFORCE_NODISCARD iterator end () noexcept
 获取结束迭代器
NEFORCE_NODISCARD const_iterator begin () const noexcept
 获取常量起始迭代器
NEFORCE_NODISCARD const_iterator end () const noexcept
 获取常量结束迭代器
NEFORCE_NODISCARD const_iterator cbegin () const noexcept
 获取常量起始迭代器
NEFORCE_NODISCARD const_iterator cend () const noexcept
 获取常量结束迭代器
NEFORCE_NODISCARD size_type size () const noexcept
 获取元素数量
NEFORCE_NODISCARD size_type max_size () const noexcept
 获取最大可能大小
NEFORCE_NODISCARD bool empty () const noexcept
 检查是否为空
NEFORCE_NODISCARD size_type buckets_size () const noexcept
 获取桶数量
NEFORCE_NODISCARD size_type bucket_index (const key_type &key) const noexcept(is_nothrow_hashable_v< key_type >)
 获取键的桶索引
NEFORCE_NODISCARD size_type bucket_size (size_type index) const noexcept
 获取指定桶的大小
NEFORCE_NODISCARD hasher hash_func () const noexcept(is_nothrow_copy_constructible_v< hasher >)
 获取哈希函数对象
NEFORCE_NODISCARD key_equal key_eql () const noexcept(is_nothrow_copy_constructible_v< key_equal >)
 获取键相等比较函数对象
NEFORCE_NODISCARD float load_factor () const noexcept
 获取当前负载因子
NEFORCE_NODISCARD 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_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_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(is_nothrow_hashable_v< key_type >)
 删除所有具有指定键的元素
iterator erase (const iterator &position) noexcept(is_nothrow_hashable_v< key_type >)
 删除指定位置的元素
iterator erase (iterator first, iterator last) noexcept(is_nothrow_hashable_v< key_type >)
 删除指定范围内的元素
const_iterator erase (const const_iterator &position) noexcept(is_nothrow_hashable_v< key_type >)
 删除指定位置的元素(常量迭代器版本)
const_iterator erase (const_iterator first, const_iterator last) noexcept(is_nothrow_hashable_v< key_type >)
 删除指定范围内的元素(常量迭代器版本)
void clear () noexcept
 清空哈希表
NEFORCE_NODISCARD iterator find (const key_type &key) noexcept(is_nothrow_hashable_v< key_type >)
 查找具有指定键的元素
NEFORCE_NODISCARD const_iterator find (const key_type &key) const noexcept(is_nothrow_hashable_v< key_type >)
 查找具有指定键的元素(常量版本)
NEFORCE_NODISCARD size_type count (const key_type &key) const noexcept(is_nothrow_hashable_v< key_type >)
 统计具有指定键的元素数量
NEFORCE_NODISCARD bool contains (const key_type &key) const noexcept(is_nothrow_hashable_v< key_type >)
 检查是否包含指定键
NEFORCE_NODISCARD pair< iterator, iteratorequal_range (const key_type &key)
 获取等于指定键的元素范围
NEFORCE_NODISCARD pair< const_iterator, const_iteratorequal_range (const key_type &key) const
 获取等于指定键的元素范围(常量版本)
void swap (hashtable &other) noexcept(is_nothrow_swappable_v< HashFcn > &&is_nothrow_swappable_v< EqualKey > &&is_nothrow_swappable_v< allocator_type >)
 交换两个哈希表的内容
NEFORCE_NODISCARD bool operator== (const hashtable &rhs) const
 相等比较操作符
NEFORCE_NODISCARD bool operator< (const hashtable &rhs) const noexcept(noexcept(_NEFORCE lexicographical_compare(hashtable::cbegin(), hashtable::cend(), rhs.cbegin(), rhs.cend())))
 小于比较操作符
Public 成员函数 继承自 icollector< hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > >
NEFORCE_NODISCARD constexpr decltype(auto) size () const noexcept(noexcept(derived().size()))
 获取集合大小
NEFORCE_NODISCARD constexpr bool empty () const noexcept(noexcept(derived().empty()))
 检查集合是否为空
Public 成员函数 继承自 icomparable< hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > >
NEFORCE_NODISCARD constexpr bool operator== (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(derived()==rhs))
 相等比较运算符
NEFORCE_NODISCARD constexpr bool operator!= (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(*this==rhs)))
 不等比较运算符
NEFORCE_NODISCARD constexpr bool operator< (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(derived()< rhs))
 小于比较运算符
NEFORCE_NODISCARD constexpr bool operator> (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(rhs< derived()))
 大于比较运算符
NEFORCE_NODISCARD constexpr bool operator<= (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(derived() > rhs)))
 小于等于比较运算符
NEFORCE_NODISCARD constexpr bool operator>= (const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > &rhs) const noexcept(noexcept(!(derived()< rhs)))
 大于等于比较运算符

静态 Public 成员函数

static NEFORCE_NODISCARD size_type buckets_max_size () noexcept
 获取最大桶数量

详细描述

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
class hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >

哈希表容器

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

哈希表使用链地址法处理冲突,采用素数表确定桶数量,提供平均常数时间复杂度的 插入、删除和查找操作。支持唯一键和允许重复键两种模式。

在文件 hashtable.hpp289 行定义.

构造及析构函数说明

◆ hashtable() [1/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hashtable ( const size_type n,
float max_lf = 1.0f )
inlineexplicit

构造函数

参数
n初始桶数量提示
max_lf最大负载因子

在文件 hashtable.hpp667 行定义.

◆ hashtable() [2/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hashtable ( const size_type n,
const HashFcn & hf,
float max_lf = 1.0f )
inline

构造函数,指定哈希函数

参数
n初始桶数量提示
hf哈希函数
max_lf最大负载因子

在文件 hashtable.hpp677 行定义.

◆ hashtable() [3/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hashtable ( const size_type n,
const HashFcn & hf,
const EqualKey & eql,
float max_lf = 1.0f )
inline

构造函数,指定哈希函数和相等比较函数

参数
n初始桶数量提示
hf哈希函数
eql相等比较函数
max_lf最大负载因子

在文件 hashtable.hpp689 行定义.

◆ hashtable() [4/6]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hashtable ( const size_type n,
const HashFcn & hf,
const EqualKey & eql,
const ExtractKey & ext,
float max_lf = 1.0f )
inline

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

参数
n初始桶数量提示
hf哈希函数
eql相等比较函数
ext值提取函数
max_lf最大负载因子

在文件 hashtable.hpp703 行定义.

◆ hashtable() [5/6]

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

拷贝构造函数

参数
other源哈希表

在文件 hashtable.hpp714 行定义.

◆ hashtable() [6/6]

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

移动构造函数

参数
other源哈希表

在文件 hashtable.hpp743 行定义.

成员函数说明

◆ begin() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD const_iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::begin ( ) const
inlinenoexcept

获取常量起始迭代器

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

在文件 hashtable.hpp795 行定义.

◆ begin() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::begin ( )
inlinenoexcept

获取起始迭代器

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

在文件 hashtable.hpp776 行定义.

◆ bucket_index()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::bucket_index ( const key_type & key) const
inlinenoexcept

获取键的桶索引

参数
key
返回
桶索引

在文件 hashtable.hpp859 行定义.

◆ bucket_size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::bucket_size ( size_type index) const
inlinenoexcept

获取指定桶的大小

参数
index桶索引
返回
桶中的元素数量

在文件 hashtable.hpp868 行定义.

◆ buckets_max_size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::buckets_max_size ( )
inlinestaticnoexcept

获取最大桶数量

返回
最大桶数量

在文件 hashtable.hpp850 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::reserve().

◆ buckets_size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::buckets_size ( ) const
inlinenoexcept

◆ cbegin()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD const_iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::cbegin ( ) const
inlinenoexcept

◆ cend()

◆ contains()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD bool hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::contains ( const key_type & key) const
inlinenoexcept

检查是否包含指定键

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

在文件 hashtable.hpp1277 行定义.

◆ count()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::count ( const key_type & key) const
inlinenoexcept

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

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

在文件 hashtable.hpp1258 行定义.

◆ emplace_equal()

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

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

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

在文件 hashtable.hpp990 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::insert_equal() , 以及 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::insert_equal().

◆ emplace_unique()

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

构造元素(唯一键版本)

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

在文件 hashtable.hpp975 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::insert_unique() , 以及 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::insert_unique().

◆ empty()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD bool hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::empty ( ) const
inlinenoexcept

检查是否为空

返回
是否为空

在文件 hashtable.hpp838 行定义.

◆ end() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD const_iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::end ( ) const
inlinenoexcept

获取常量结束迭代器

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

在文件 hashtable.hpp801 行定义.

◆ end() [2/2]

◆ equal_range() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD pair< iterator, iterator > hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::equal_range ( const key_type & key)
inline

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

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

在文件 hashtable.hpp1286 行定义.

◆ equal_range() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD pair< const_iterator, const_iterator > hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::equal_range ( const key_type & key) const
inline

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

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

在文件 hashtable.hpp1319 行定义.

◆ erase() [1/5]

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

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

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

在文件 hashtable.hpp1185 行定义.

◆ erase() [2/5]

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

删除指定位置的元素

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

在文件 hashtable.hpp1107 行定义.

◆ erase() [3/5]

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

◆ erase() [4/5]

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

删除指定范围内的元素(常量迭代器版本)

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

在文件 hashtable.hpp1195 行定义.

◆ erase() [5/5]

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

删除指定范围内的元素

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

在文件 hashtable.hpp1154 行定义.

◆ find() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD const_iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::find ( const key_type & key) const
inlinenoexcept

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

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

在文件 hashtable.hpp1239 行定义.

◆ find() [2/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD iterator hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::find ( const key_type & key)
inlinenoexcept

查找具有指定键的元素

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

在文件 hashtable.hpp1220 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::contains().

◆ hash_func()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD hasher hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::hash_func ( ) const
inlinenoexcept

获取哈希函数对象

返回
哈希函数对象的副本

在文件 hashtable.hpp880 行定义.

◆ insert_equal() [1/4]

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

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

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

在文件 hashtable.hpp1017 行定义.

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

◆ insert_equal() [2/4]

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

范围插入元素(允许重复键版本)

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

在文件 hashtable.hpp1053 行定义.

◆ insert_equal() [3/4]

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

初始化列表插入元素(允许重复键版本)

参数
ilist初始化列表

在文件 hashtable.hpp1062 行定义.

◆ insert_equal() [4/4]

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

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

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

在文件 hashtable.hpp1024 行定义.

◆ insert_unique() [1/4]

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

插入元素(唯一键版本)

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

在文件 hashtable.hpp1003 行定义.

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

◆ insert_unique() [2/4]

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

范围插入元素(唯一键版本)

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

在文件 hashtable.hpp1033 行定义.

◆ insert_unique() [3/4]

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

初始化列表插入元素(唯一键版本)

参数
ilist初始化列表

在文件 hashtable.hpp1042 行定义.

◆ insert_unique() [4/4]

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

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

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

在文件 hashtable.hpp1010 行定义.

◆ key_eql()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD key_equal hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::key_eql ( ) const
inlinenoexcept

获取键相等比较函数对象

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

在文件 hashtable.hpp886 行定义.

◆ load_factor()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD float hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::load_factor ( ) const
inlinenoexcept

获取当前负载因子

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

在文件 hashtable.hpp892 行定义.

◆ max_load_factor() [1/2]

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD float hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::max_load_factor ( ) const
inlinenoexcept

◆ max_load_factor() [2/2]

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

设置最大负载因子

参数
lf新的最大负载因子

在文件 hashtable.hpp906 行定义.

◆ max_size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::max_size ( ) const
inlinenoexcept

获取最大可能大小

返回
最大元素数量

在文件 hashtable.hpp832 行定义.

◆ operator<()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD bool hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::operator< ( const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & rhs) const
inlinenoexcept

小于比较操作符

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

在文件 hashtable.hpp1391 行定义.

◆ operator=() [1/2]

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

拷贝赋值运算符

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

在文件 hashtable.hpp727 行定义.

◆ operator=() [2/2]

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

移动赋值运算符

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

在文件 hashtable.hpp758 行定义.

◆ operator==()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD bool hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::operator== ( const hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > & rhs) const
inline

相等比较操作符

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

在文件 hashtable.hpp1369 行定义.

◆ rehash()

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

◆ reserve()

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

预留空间

参数
n期望的元素数量

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

在文件 hashtable.hpp955 行定义.

◆ size()

template<typename Value, typename Key, typename HashFcn, typename ExtractKey, typename EqualKey, typename Alloc>
NEFORCE_NODISCARD size_type hashtable< Value, Key, HashFcn, ExtractKey, EqualKey, Alloc >::size ( ) const
inlinenoexcept

获取元素数量

返回
元素数量

在文件 hashtable.hpp826 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::load_factor().

◆ swap()

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

交换两个哈希表的内容

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

在文件 hashtable.hpp1351 行定义.

被这些函数引用 hashtable< pair< const Key, T >, Key, HashFcn, select1st< pair< const Key, T > >, EqualKey, Alloc >::operator=().


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