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

无序集合容器 更多...

#include <unordered_set.hpp>

Public 类型

using key_type = typename base_type::key_type
 键类型
using value_type = typename base_type::value_type
 值类型
using hasher = typename base_type::hasher
 哈希函数类型
using key_equal = typename base_type::key_equal
 键相等比较函数类型
using size_type = typename base_type::size_type
 大小类型
using difference_type = typename base_type::difference_type
 差值类型
using pointer = typename base_type::const_pointer
 指针类型
using const_pointer = typename base_type::const_pointer
 常量指针类型
using reference = typename base_type::const_reference
 引用类型
using const_reference = typename base_type::const_reference
 常量引用类型
using iterator = typename base_type::iterator
 迭代器类型
using const_iterator = typename base_type::const_iterator
 常量迭代器类型
using allocator_type = typename base_type::allocator_type
 分配器类型

Public 成员函数

 unordered_set ()
 默认构造函数
 unordered_set (size_type n)
 构造函数,指定初始桶数
 unordered_set (size_type n, const hasher &hf)
 构造函数,指定初始桶数和哈希函数
 unordered_set (size_type n, const hasher &hf, const key_equal &eql)
 构造函数,指定初始桶数、哈希函数和键相等比较函数
 unordered_set (const unordered_set &other)
 拷贝构造函数
unordered_setoperator= (const unordered_set &other)
 拷贝赋值运算符
 unordered_set (unordered_set &&other) noexcept(is_nothrow_move_constructible_v< base_type >)
 移动构造函数
unordered_setoperator= (unordered_set &&other) noexcept(is_nothrow_move_assignable_v< base_type >)
 移动赋值运算符
template<typename Iterator>
 unordered_set (Iterator first, Iterator last)
 范围构造函数
template<typename Iterator>
 unordered_set (Iterator first, Iterator list, size_type n)
 范围构造函数,指定初始桶数
template<typename Iterator>
 unordered_set (Iterator first, Iterator last, size_type n, const hasher &hf)
 范围构造函数,指定初始桶数和哈希函数
template<typename Iterator>
 unordered_set (Iterator first, Iterator last, size_type n, const hasher &hf, const key_equal &eql)
 范围构造函数,指定初始桶数、哈希函数和键相等比较函数
 unordered_set (std::initializer_list< value_type > ilist)
 初始化列表构造函数
 unordered_set (std::initializer_list< value_type > ilist, size_type n)
 初始化列表构造函数,指定初始桶数
 unordered_set (std::initializer_list< value_type > ilist, size_type n, const hasher &hf)
 初始化列表构造函数,指定初始桶数和哈希函数
 unordered_set (std::initializer_list< value_type > ilist, size_type n, const hasher &hf, const key_equal &eql)
 初始化列表构造函数,指定初始桶数、哈希函数和键相等比较函数
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 count (const key_type &key) const noexcept(noexcept(ht_.count(key)))
 统计具有指定键的元素数量
NEFORCE_NODISCARD size_type buckets_size () const noexcept
 获取桶数量
NEFORCE_NODISCARD size_type max_bucket_count () const noexcept
 获取最大桶数量
NEFORCE_NODISCARD size_type bucket_size (size_type n) const noexcept
 获取指定桶的大小
NEFORCE_NODISCARD hasher hash_funct () const noexcept(noexcept(ht_.hash_func()))
 获取哈希函数对象
NEFORCE_NODISCARD key_equal key_eq () const noexcept(noexcept(ht_.key_eql()))
 获取键相等比较函数对象
NEFORCE_NODISCARD float load_factor () const noexcept
 获取当前负载因子
NEFORCE_NODISCARD float max_load_factor () const noexcept
 获取最大负载因子
void max_load_factor (float lf) noexcept
 设置最大负载因子
void rehash (size_type n)
 重新哈希,调整桶数量
void reserve (size_type n)
 预留空间
template<typename... Args>
pair< iterator, bool > emplace (Args &&... args)
 在unordered_set中就地构造元素
pair< iterator, bool > insert (const value_type &value)
 拷贝插入元素
pair< iterator, bool > insert (value_type &&value)
 移动插入元素
template<typename Iterator>
void insert (Iterator first, Iterator last)
 范围插入元素
size_type erase (const key_type &key) noexcept
 删除所有具有指定键的元素
void erase (iterator position) noexcept
 删除指定位置的元素
void erase (iterator first, iterator last) noexcept
 删除指定范围内的元素
void clear () noexcept
 清空unordered_set
NEFORCE_NODISCARD iterator find (const key_type &key)
 查找具有指定键的元素
NEFORCE_NODISCARD const_iterator find (const key_type &key) const
 查找具有指定键的常量元素
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 (unordered_set &other) noexcept(is_nothrow_swappable_v< base_type >)
 交换两个unordered_set的内容
NEFORCE_NODISCARD bool operator== (const unordered_set &rhs) const noexcept(noexcept(ht_==rhs.ht_))
 相等比较操作符
NEFORCE_NODISCARD bool operator< (const unordered_set &rhs) const noexcept(noexcept(ht_< rhs.ht_))
 小于比较操作符

详细描述

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
class unordered_set< Value, HashFcn, EqualKey, Alloc >

无序集合容器

模板参数
Value值类型
HashFcn哈希函数类型,默认为hash<Value>
EqualKey键相等比较函数类型,默认为equal_to<Value>
Alloc分配器类型

unordered_set是一种关联容器,存储唯一的键值,每个键在容器中唯一。 元素无序存储,由哈希函数将键映射到桶中。 支持快速的键查找。底层使用哈希表实现。

在文件 unordered_set.hpp37 行定义.

构造及析构函数说明

◆ unordered_set() [1/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( )
inline

默认构造函数

构造一个空unordered_set,默认初始桶数为100。

在文件 unordered_set.hpp71 行定义.

被这些函数引用 operator<(), operator=(), operator=(), operator==(), swap(), unordered_set(), unordered_set(), unordered_set(), unordered_set(), unordered_set() , 以及 unordered_set().

◆ unordered_set() [2/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( size_type n)
inlineexplicit

构造函数,指定初始桶数

参数
n初始桶数

在文件 unordered_set.hpp78 行定义.

◆ unordered_set() [3/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( size_type n,
const hasher & hf )
inline

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

参数
n初始桶数
hf哈希函数

在文件 unordered_set.hpp86 行定义.

◆ unordered_set() [4/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( size_type n,
const hasher & hf,
const key_equal & eql )
inline

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

参数
n初始桶数
hf哈希函数
eql键相等比较函数

在文件 unordered_set.hpp95 行定义.

◆ unordered_set() [5/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( const unordered_set< Value, HashFcn, EqualKey, Alloc > & other)
inline

拷贝构造函数

参数
other源unordered_set

在文件 unordered_set.hpp102 行定义.

引用了 unordered_set().

◆ unordered_set() [6/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( unordered_set< Value, HashFcn, EqualKey, Alloc > && other)
inlinenoexcept

移动构造函数

参数
other源unordered_set

在文件 unordered_set.hpp119 行定义.

引用了 is_nothrow_move_constructible_v, move() , 以及 unordered_set().

◆ unordered_set() [7/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename Iterator>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( Iterator first,
Iterator last )
inline

范围构造函数

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

在文件 unordered_set.hpp139 行定义.

◆ unordered_set() [8/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename Iterator>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( Iterator first,
Iterator list,
size_type n )
inline

范围构造函数,指定初始桶数

模板参数
Iterator迭代器类型
参数
first起始迭代器
list结束迭代器
n初始桶数

在文件 unordered_set.hpp152 行定义.

◆ unordered_set() [9/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename Iterator>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( Iterator first,
Iterator last,
size_type n,
const hasher & hf )
inline

范围构造函数,指定初始桶数和哈希函数

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器
n初始桶数
hf哈希函数

在文件 unordered_set.hpp166 行定义.

◆ unordered_set() [10/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename Iterator>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( Iterator first,
Iterator last,
size_type n,
const hasher & hf,
const key_equal & eql )
inline

范围构造函数,指定初始桶数、哈希函数和键相等比较函数

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器
n初始桶数
hf哈希函数
eql键相等比较函数

在文件 unordered_set.hpp181 行定义.

◆ unordered_set() [11/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( std::initializer_list< value_type > ilist)
inline

初始化列表构造函数

参数
ilist初始化列表

在文件 unordered_set.hpp190 行定义.

引用了 begin(), end() , 以及 unordered_set().

◆ unordered_set() [12/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( std::initializer_list< value_type > ilist,
size_type n )
inline

初始化列表构造函数,指定初始桶数

参数
ilist初始化列表
n初始桶数

在文件 unordered_set.hpp198 行定义.

引用了 begin(), end() , 以及 unordered_set().

◆ unordered_set() [13/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( std::initializer_list< value_type > ilist,
size_type n,
const hasher & hf )
inline

初始化列表构造函数,指定初始桶数和哈希函数

参数
ilist初始化列表
n初始桶数
hf哈希函数

在文件 unordered_set.hpp207 行定义.

引用了 begin(), end() , 以及 unordered_set().

◆ unordered_set() [14/14]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set< Value, HashFcn, EqualKey, Alloc >::unordered_set ( std::initializer_list< value_type > ilist,
size_type n,
const hasher & hf,
const key_equal & eql )
inline

初始化列表构造函数,指定初始桶数、哈希函数和键相等比较函数

参数
ilist初始化列表
n初始桶数
hf哈希函数
eql键相等比较函数

在文件 unordered_set.hpp217 行定义.

引用了 begin(), end() , 以及 unordered_set().

成员函数说明

◆ begin() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD const_iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::begin ( ) const
inlinenoexcept

获取常量起始迭代器

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

在文件 unordered_set.hpp236 行定义.

◆ begin() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::begin ( )
inlinenoexcept

获取起始迭代器

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

在文件 unordered_set.hpp224 行定义.

被这些函数引用 unordered_set(), unordered_set(), unordered_set() , 以及 unordered_set().

◆ bucket_size()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::bucket_size ( size_type n) const
inlinenoexcept

获取指定桶的大小

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

在文件 unordered_set.hpp300 行定义.

◆ buckets_size()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::buckets_size ( ) const
inlinenoexcept

获取桶数量

返回
桶数量

在文件 unordered_set.hpp287 行定义.

◆ cbegin()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD const_iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::cbegin ( ) const
inlinenoexcept

获取常量起始迭代器

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

在文件 unordered_set.hpp248 行定义.

◆ cend()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD const_iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::cend ( ) const
inlinenoexcept

获取常量结束迭代器

返回
指向最后一个元素之后位置的常量迭代器

在文件 unordered_set.hpp254 行定义.

◆ count()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::count ( const key_type & key) const
inlinenoexcept

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

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

在文件 unordered_set.hpp279 行定义.

◆ emplace()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename... Args>
pair< iterator, bool > unordered_set< Value, HashFcn, EqualKey, Alloc >::emplace ( Args &&... args)
inline

在unordered_set中就地构造元素

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

在文件 unordered_set.hpp353 行定义.

引用了 forward().

◆ empty()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD bool unordered_set< Value, HashFcn, EqualKey, Alloc >::empty ( ) const
inlinenoexcept

检查是否为空

返回
是否为空

在文件 unordered_set.hpp272 行定义.

◆ end() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD const_iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::end ( ) const
inlinenoexcept

获取常量结束迭代器

返回
指向最后一个元素之后位置的常量迭代器

在文件 unordered_set.hpp242 行定义.

◆ end() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::end ( )
inlinenoexcept

获取结束迭代器

返回
指向最后一个元素之后位置的迭代器

在文件 unordered_set.hpp230 行定义.

被这些函数引用 unordered_set(), unordered_set(), unordered_set() , 以及 unordered_set().

◆ equal_range() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD pair< iterator, iterator > unordered_set< Value, HashFcn, EqualKey, Alloc >::equal_range ( const key_type & key)
inline

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

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

在文件 unordered_set.hpp426 行定义.

◆ equal_range() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD pair< const_iterator, const_iterator > unordered_set< Value, HashFcn, EqualKey, Alloc >::equal_range ( const key_type & key) const
inline

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

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

在文件 unordered_set.hpp433 行定义.

◆ erase() [1/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::erase ( const key_type & key)
inlinenoexcept

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

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

在文件 unordered_set.hpp387 行定义.

◆ erase() [2/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::erase ( iterator first,
iterator last )
inlinenoexcept

删除指定范围内的元素

参数
first起始迭代器
last结束迭代器

在文件 unordered_set.hpp400 行定义.

◆ erase() [3/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::erase ( iterator position)
inlinenoexcept

删除指定位置的元素

参数
position要删除的位置

在文件 unordered_set.hpp393 行定义.

◆ find() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::find ( const key_type & key)
inline

查找具有指定键的元素

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

在文件 unordered_set.hpp412 行定义.

◆ find() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD const_iterator unordered_set< Value, HashFcn, EqualKey, Alloc >::find ( const key_type & key) const
inline

查找具有指定键的常量元素

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

在文件 unordered_set.hpp419 行定义.

◆ hash_funct()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD hasher unordered_set< Value, HashFcn, EqualKey, Alloc >::hash_funct ( ) const
inlinenoexcept

获取哈希函数对象

返回
哈希函数对象的副本

在文件 unordered_set.hpp306 行定义.

◆ insert() [1/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
pair< iterator, bool > unordered_set< Value, HashFcn, EqualKey, Alloc >::insert ( const value_type & value)
inline

拷贝插入元素

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

在文件 unordered_set.hpp362 行定义.

◆ insert() [2/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
template<typename Iterator>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::insert ( Iterator first,
Iterator last )
inline

范围插入元素

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

在文件 unordered_set.hpp378 行定义.

◆ insert() [3/3]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
pair< iterator, bool > unordered_set< Value, HashFcn, EqualKey, Alloc >::insert ( value_type && value)
inline

移动插入元素

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

在文件 unordered_set.hpp369 行定义.

引用了 forward().

◆ key_eq()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD key_equal unordered_set< Value, HashFcn, EqualKey, Alloc >::key_eq ( ) const
inlinenoexcept

获取键相等比较函数对象

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

在文件 unordered_set.hpp312 行定义.

◆ load_factor()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD float unordered_set< Value, HashFcn, EqualKey, Alloc >::load_factor ( ) const
inlinenoexcept

获取当前负载因子

返回
负载因子

在文件 unordered_set.hpp318 行定义.

◆ max_bucket_count()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::max_bucket_count ( ) const
inlinenoexcept

获取最大桶数量

返回
最大桶数量

在文件 unordered_set.hpp293 行定义.

◆ max_load_factor() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD float unordered_set< Value, HashFcn, EqualKey, Alloc >::max_load_factor ( ) const
inlinenoexcept

获取最大负载因子

返回
最大负载因子

在文件 unordered_set.hpp324 行定义.

◆ max_load_factor() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::max_load_factor ( float lf)
inlinenoexcept

设置最大负载因子

参数
lf新的最大负载因子

在文件 unordered_set.hpp330 行定义.

◆ max_size()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::max_size ( ) const
inlinenoexcept

获取最大可能大小

返回
最大元素数量

在文件 unordered_set.hpp266 行定义.

◆ operator<()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD bool unordered_set< Value, HashFcn, EqualKey, Alloc >::operator< ( const unordered_set< Value, HashFcn, EqualKey, Alloc > & rhs) const
inlinenoexcept

小于比较操作符

参数
rhs右侧unordered_set
返回
按字典序比较结果

在文件 unordered_set.hpp457 行定义.

引用了 unordered_set().

◆ operator=() [1/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set & unordered_set< Value, HashFcn, EqualKey, Alloc >::operator= ( const unordered_set< Value, HashFcn, EqualKey, Alloc > & other)
inline

拷贝赋值运算符

参数
other源unordered_set
返回
自身引用

在文件 unordered_set.hpp110 行定义.

引用了 unordered_set().

◆ operator=() [2/2]

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
unordered_set & unordered_set< Value, HashFcn, EqualKey, Alloc >::operator= ( unordered_set< Value, HashFcn, EqualKey, Alloc > && other)
inlinenoexcept

移动赋值运算符

参数
other源unordered_set
返回
自身引用

在文件 unordered_set.hpp127 行定义.

引用了 is_nothrow_move_assignable_v, move() , 以及 unordered_set().

◆ operator==()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD bool unordered_set< Value, HashFcn, EqualKey, Alloc >::operator== ( const unordered_set< Value, HashFcn, EqualKey, Alloc > & rhs) const
inlinenoexcept

相等比较操作符

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

在文件 unordered_set.hpp448 行定义.

引用了 unordered_set().

◆ rehash()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::rehash ( size_type n)
inline

重新哈希,调整桶数量

参数
n目标桶数量

在文件 unordered_set.hpp336 行定义.

◆ reserve()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::reserve ( size_type n)
inline

预留空间

参数
n期望的元素数量

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

在文件 unordered_set.hpp344 行定义.

◆ size()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
NEFORCE_NODISCARD size_type unordered_set< Value, HashFcn, EqualKey, Alloc >::size ( ) const
inlinenoexcept

获取元素数量

返回
unordered_set中的元素数量

在文件 unordered_set.hpp260 行定义.

◆ swap()

template<typename Value, typename HashFcn = hash<Value>, typename EqualKey = equal_to<Value>, typename Alloc = allocator<hashtable_node<Value>>>
void unordered_set< Value, HashFcn, EqualKey, Alloc >::swap ( unordered_set< Value, HashFcn, EqualKey, Alloc > & other)
inlinenoexcept

交换两个unordered_set的内容

参数
other要交换的另一个unordered_set

在文件 unordered_set.hpp441 行定义.

引用了 is_nothrow_swappable_v , 以及 unordered_set().


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