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

平坦无序映射容器 更多...

#include <flat_unordered_map.hpp>

Public 类型

using key_type = typename base_type::key_type
 键类型
using mapped_type = T
 映射值类型
using value_type = pair<Key, T>
 值类型
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 = value_type*
 指针类型
using const_pointer = const value_type*
 常量指针类型
using reference = value_type&
 引用类型
using const_reference = const value_type&
 常量引用类型
using iterator = typename base_type::iterator
 迭代器类型
using const_iterator = typename base_type::const_iterator
 常量迭代器类型
using allocator_type = typename base_type::allocator_type
 分配器类型

Public 成员函数

 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_mapoperator= (const flat_unordered_map &other)
 拷贝赋值运算符
 flat_unordered_map (flat_unordered_map &&other) noexcept(is_nothrow_move_constructible_v< base_type >)
 移动构造函数
flat_unordered_mapoperator= (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, iteratorequal_range (const key_type &key)
 获取等于指定键的元素范围
pair< const_iterator, const_iteratorequal_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 >

平坦无序映射容器

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

flat_unordered_map 是一种关联容器,存储键值对(key-value pairs),每个键在容器中唯一。 元素无序存储,由哈希函数将键映射到槽位。 底层使用开放寻址平坦哈希表,提供优于链地址法的缓存局部性。

注解
unordered_map 不同,本容器使用 pair<Key, T>(非 const Key)作为值类型, 以适应平坦存储的元素搬移需求。

在文件 flat_unordered_map.hpp41 行定义.

构造及析构函数说明

◆ flat_unordered_map() [1/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( )
default

◆ flat_unordered_map() [2/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( const size_type n)
inlineexplicit

构造函数,指定初始容量

参数
n初始容量提示

在文件 flat_unordered_map.hpp81 行定义.

◆ flat_unordered_map() [3/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( const size_type n,
const hasher & hf )
inline

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

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

在文件 flat_unordered_map.hpp89 行定义.

◆ flat_unordered_map() [4/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( const size_type n,
const hasher & hf,
const key_equal & eql )
inline

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

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

在文件 flat_unordered_map.hpp98 行定义.

◆ flat_unordered_map() [5/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( const flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > & other)
inline

拷贝构造函数

参数
otherflat_unordered_map

在文件 flat_unordered_map.hpp105 行定义.

引用了 flat_unordered_map().

◆ flat_unordered_map() [6/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > && other)
inlinenoexcept

移动构造函数

参数
otherflat_unordered_map

在文件 flat_unordered_map.hpp122 行定义.

引用了 flat_unordered_map(), neforce::is_nothrow_move_constructible_v , 以及 neforce::move().

◆ flat_unordered_map() [7/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( Iterator first,
Iterator last )
inline

范围构造函数

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

在文件 flat_unordered_map.hpp142 行定义.

◆ flat_unordered_map() [8/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( Iterator first,
Iterator last,
const size_type n )
inline

范围构造函数,指定初始容量

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器
n初始容量提示

在文件 flat_unordered_map.hpp155 行定义.

◆ flat_unordered_map() [9/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( Iterator first,
Iterator last,
const size_type n,
const hasher & hf )
inline

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

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

在文件 flat_unordered_map.hpp169 行定义.

◆ flat_unordered_map() [10/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( Iterator first,
Iterator last,
const size_type n,
const hasher & hf,
const key_equal & eql )
inline

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

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

在文件 flat_unordered_map.hpp184 行定义.

◆ flat_unordered_map() [11/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( std::initializer_list< value_type > ilist)
inline

初始化列表构造函数

参数
ilist初始化列表

在文件 flat_unordered_map.hpp193 行定义.

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

◆ flat_unordered_map() [12/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( std::initializer_list< value_type > ilist,
const size_type n )
inline

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

参数
ilist初始化列表
n初始容量提示

在文件 flat_unordered_map.hpp201 行定义.

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

◆ flat_unordered_map() [13/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( std::initializer_list< value_type > ilist,
const size_type n,
const hasher & hf )
inline

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

参数
ilist初始化列表
n初始容量提示
hf哈希函数

在文件 flat_unordered_map.hpp210 行定义.

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

◆ flat_unordered_map() [14/14]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::flat_unordered_map ( std::initializer_list< value_type > ilist,
const size_type n,
const hasher & hf,
const key_equal & eql )
inline

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

参数
ilist初始化列表
n初始容量提示
hf哈希函数
eql键相等比较函数

在文件 flat_unordered_map.hpp220 行定义.

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

成员函数说明

◆ at() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
T & neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::at ( const key_type & key)
inlinenodiscard

带边界检查的访问

参数
key要访问的键
返回
对应键的值的引用
异常
iterator_exception如果键不存在

在文件 flat_unordered_map.hpp499 行定义.

引用了 end().

◆ at() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const T & neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::at ( const key_type & key) const
inlinenodiscard

带边界检查的常量访问

参数
key要访问的键
返回
对应键的值的常量引用
异常
iterator_exception如果键不存在

在文件 flat_unordered_map.hpp485 行定义.

引用了 end().

◆ begin() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::begin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

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

在文件 flat_unordered_map.hpp240 行定义.

◆ begin() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::begin ( )
inlinenodiscardnoexcept

获取起始迭代器

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

在文件 flat_unordered_map.hpp228 行定义.

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

◆ capacity()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
size_type neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::capacity ( ) const
inlinenodiscardnoexcept

获取容量

返回
slot 总数

在文件 flat_unordered_map.hpp282 行定义.

◆ cbegin()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::cbegin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

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

在文件 flat_unordered_map.hpp252 行定义.

◆ cend()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::cend ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

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

在文件 flat_unordered_map.hpp258 行定义.

◆ contains()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
bool neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::contains ( const key_type & key) const
inlinenodiscardnoexcept

检查是否包含指定键

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

在文件 flat_unordered_map.hpp298 行定义.

◆ count()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
size_type neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::count ( const key_type & key) const
inlinenodiscardnoexcept

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

参数
key要统计的键
返回
匹配的元素数量(0 或 1)

在文件 flat_unordered_map.hpp289 行定义.

◆ emplace()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename... Args>
pair< iterator, bool > neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::emplace ( Args &&... args)
inline

在容器中就地构造元素

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

在文件 flat_unordered_map.hpp355 行定义.

引用了 neforce::forward().

◆ empty()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
bool neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::empty ( ) const
inlinenodiscardnoexcept

检查是否为空

返回
是否为空

在文件 flat_unordered_map.hpp276 行定义.

◆ end() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::end ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

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

在文件 flat_unordered_map.hpp246 行定义.

◆ end() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::end ( )
inlinenodiscardnoexcept

获取结束迭代器

返回
指向末尾的迭代器

在文件 flat_unordered_map.hpp234 行定义.

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

◆ equal_range() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
pair< iterator, iterator > neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::equal_range ( const key_type & key)
inlinenodiscard

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

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

在文件 flat_unordered_map.hpp453 行定义.

◆ equal_range() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
pair< const_iterator, const_iterator > neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::equal_range ( const key_type & key) const
inlinenodiscard

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

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

在文件 flat_unordered_map.hpp460 行定义.

◆ equal_to()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
bool neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::equal_to ( const flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > & rhs) const
inlinenodiscardnoexcept

相等比较操作符

参数
rhs右侧容器
返回
是否相等

在文件 flat_unordered_map.hpp518 行定义.

引用了 flat_unordered_map().

◆ erase() [1/5]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::erase ( const const_iterator first,
const const_iterator last )
inlinenoexcept

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

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

在文件 flat_unordered_map.hpp425 行定义.

◆ erase() [2/5]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::erase ( const const_iterator position)
inlinenoexcept

删除指定位置的常量元素

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

在文件 flat_unordered_map.hpp417 行定义.

◆ erase() [3/5]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::erase ( const iterator first,
const iterator last )
inlinenoexcept

删除指定范围内的元素

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

在文件 flat_unordered_map.hpp410 行定义.

◆ erase() [4/5]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::erase ( const iterator position)
inlinenoexcept

删除指定位置的元素

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

在文件 flat_unordered_map.hpp402 行定义.

◆ erase() [5/5]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
size_type neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::erase ( const key_type & key)
inlinenoexcept

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

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

在文件 flat_unordered_map.hpp395 行定义.

◆ find() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::find ( const key_type & key)
inlinenodiscard

查找具有指定键的元素

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

在文件 flat_unordered_map.hpp439 行定义.

◆ find() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
const_iterator neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::find ( const key_type & key) const
inlinenodiscard

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

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

在文件 flat_unordered_map.hpp446 行定义.

◆ hash_function()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
hasher neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::hash_function ( ) const
inlinenodiscardnoexcept

获取哈希函数对象

返回
哈希函数对象的副本

在文件 flat_unordered_map.hpp306 行定义.

引用了 hash_function().

被这些函数引用 hash_function().

◆ insert() [1/4]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
pair< iterator, bool > neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::insert ( const value_type & value)
inline

插入元素(拷贝版本)

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

在文件 flat_unordered_map.hpp364 行定义.

◆ insert() [2/4]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
template<typename Iterator>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::insert ( Iterator first,
Iterator last )
inline

范围插入元素

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

在文件 flat_unordered_map.hpp380 行定义.

◆ insert() [3/4]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::insert ( std::initializer_list< value_type > ilist)
inline

初始化列表插入元素

参数
ilist初始化列表

在文件 flat_unordered_map.hpp388 行定义.

◆ insert() [4/4]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
pair< iterator, bool > neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::insert ( value_type && value)
inline

移动插入元素

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

在文件 flat_unordered_map.hpp371 行定义.

引用了 neforce::move().

◆ key_eql()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
key_equal neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::key_eql ( ) const
inlinenodiscardnoexcept

获取键相等比较函数对象

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

在文件 flat_unordered_map.hpp314 行定义.

引用了 key_eql().

被这些函数引用 key_eql().

◆ less_than()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
bool neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::less_than ( const flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > & rhs) const
inlinenodiscardnoexcept

小于比较操作符

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

在文件 flat_unordered_map.hpp527 行定义.

引用了 flat_unordered_map().

◆ load_factor()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
float neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::load_factor ( ) const
inlinenodiscardnoexcept

获取当前负载因子

返回
负载因子

在文件 flat_unordered_map.hpp320 行定义.

◆ max_load_factor() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
float neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::max_load_factor ( ) const
inlinenodiscardnoexcept

获取最大负载因子

返回
最大负载因子

在文件 flat_unordered_map.hpp326 行定义.

◆ max_load_factor() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::max_load_factor ( const float lf)
inlinenoexcept

设置最大负载因子

参数
lf新的最大负载因子

在文件 flat_unordered_map.hpp332 行定义.

◆ max_size()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
size_type neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::max_size ( ) const
inlinenodiscardnoexcept

获取最大可能大小

返回
最大元素数量

在文件 flat_unordered_map.hpp270 行定义.

◆ operator=() [1/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
flat_unordered_map & neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::operator= ( const flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > & other)
inline

拷贝赋值运算符

参数
otherflat_unordered_map
返回
自身引用

在文件 flat_unordered_map.hpp113 行定义.

引用了 flat_unordered_map().

◆ operator=() [2/2]

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
flat_unordered_map & neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::operator= ( flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > && other)
inlinenoexcept

移动赋值运算符

参数
otherflat_unordered_map
返回
自身引用

在文件 flat_unordered_map.hpp130 行定义.

引用了 flat_unordered_map(), neforce::is_nothrow_move_assignable_v , 以及 neforce::move().

◆ operator[]()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
T & neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::operator[] ( const key_type & key)
inlinenodiscard

下标访问操作符

参数
key要访问的键
返回
对应键的值的引用

如果键不存在,则插入一个默认构造的值并返回其引用。

在文件 flat_unordered_map.hpp471 行定义.

◆ rehash()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::rehash ( const size_type n)
inline

重新哈希,调整容量

参数
n目标容量

在文件 flat_unordered_map.hpp338 行定义.

◆ reserve()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::reserve ( const size_type n)
inline

预留空间

参数
n期望的元素数量

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

在文件 flat_unordered_map.hpp346 行定义.

◆ size()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
size_type neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::size ( ) const
inlinenodiscardnoexcept

获取元素数量

返回
元素数量

在文件 flat_unordered_map.hpp264 行定义.

◆ swap()

template<typename Key, typename T, typename HashFcn = hash<Key>, typename EqualKey = equal_to<Key>, typename Alloc = allocator<pair<Key, T>>>
void neforce::flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc >::swap ( flat_unordered_map< Key, T, HashFcn, EqualKey, Alloc > & other)
inlinenoexcept

交换两个容器

参数
other要交换的容器

在文件 flat_unordered_map.hpp511 行定义.

引用了 flat_unordered_map() , 以及 neforce::is_nothrow_swappable_v.


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