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

稀疏向量容器 更多...

#include <sparse_vector.hpp>

类 neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > 继承关系图:
[图例]

Public 类型

using key_type = Key
 键类型
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 compare_type = Compare
 比较器类型
using iterator = sparse_vector_iterator<false, sparse_vector>
 迭代器类型
using const_iterator = sparse_vector_iterator<true, sparse_vector>
 常量迭代器类型
using reverse_iterator = _NEFORCE reverse_iterator<iterator>
 反向迭代器类型
using const_reverse_iterator = _NEFORCE reverse_iterator<const_iterator>
 常量反向迭代器类型
using allocator_type = Alloc
 分配器类型

Public 成员函数

 sparse_vector ()=default
 默认构造函数
 sparse_vector (const Compare &comp)
 构造函数,指定比较函数
 sparse_vector (const sparse_vector &other)
 拷贝构造函数
sparse_vectoroperator= (const sparse_vector &other)
 拷贝赋值运算符
 sparse_vector (sparse_vector &&other) noexcept(is_nothrow_move_constructible_v< container_type > &&is_nothrow_move_constructible_v< Compare > &&is_nothrow_move_constructible_v< KeyOfValue >)
 移动构造函数
sparse_vectoroperator= (sparse_vector &&other) noexcept(is_nothrow_move_assignable_v< container_type >)
 移动赋值运算符
 ~sparse_vector ()=default
 析构函数
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
 获取常量结束迭代器
reverse_iterator rbegin () noexcept
 获取反向起始迭代器
reverse_iterator rend () noexcept
 获取反向结束迭代器
const_reverse_iterator rbegin () const noexcept
 获取常量反向起始迭代器
const_reverse_iterator rend () const noexcept
 获取常量反向结束迭代器
const_reverse_iterator crbegin () const noexcept
 获取常量反向起始迭代器
const_reverse_iterator crend () const noexcept
 获取常量反向结束迭代器
size_type size () const noexcept
 获取元素数量
size_type max_size () const noexcept
 获取最大可能大小
bool empty () const noexcept
 检查是否为空
Compare key_compare () const noexcept(is_nothrow_copy_constructible_v< Compare >)
 获取键比较函数对象
template<typename... Args>
pair< iterator, bool > emplace_unique (Args &&... args)
 插入唯一键元素
pair< iterator, bool > insert_unique (const value_type &value)
 拷贝插入唯一键元素
pair< iterator, bool > insert_unique (value_type &&value)
 移动插入唯一键元素
template<typename... Args>
iterator emplace_unique_hint (iterator position, Args &&... args)
 在提示位置附近构造唯一键元素
iterator insert_unique (iterator position, const value_type &value)
 在提示位置附近拷贝插入唯一键元素
iterator insert_unique (iterator position, value_type &&value)
 在提示位置附近移动插入唯一键元素
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void insert_unique (Iterator first, Iterator last)
 范围插入唯一键元素
template<typename... Args>
iterator emplace_equal (Args &&... args)
 插入允许重复键元素
iterator insert_equal (const value_type &value)
 拷贝插入允许重复键元素
iterator insert_equal (value_type &&value)
 移动插入允许重复键元素
template<typename... Args>
iterator emplace_equal_hint (iterator position, Args &&... args)
 在提示位置附近构造允许重复键元素
iterator insert_equal (iterator position, const value_type &value)
 在提示位置附近拷贝插入允许重复键元素
iterator insert_equal (iterator position, value_type &&value)
 在提示位置附近移动插入允许重复键元素
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void insert_equal (Iterator first, Iterator last)
 范围插入允许重复键元素
size_type erase (const key_type &key)
 删除所有具有指定键的元素
void erase (iterator position)
 删除指定位置的元素
void erase (iterator first, iterator last)
 删除指定范围内的元素
void clear ()
 清空
iterator find (const key_type &key)
 查找具有指定键的元素
const_iterator find (const key_type &key) const
 查找具有指定键的元素(常量版本)
size_type count (const key_type &key) const
 统计具有指定键的元素数量
iterator lower_bound (const key_type &key)
 获取第一个不小于指定键的元素位置
const_iterator lower_bound (const key_type &key) const
 获取第一个不小于指定键的元素位置(常量版本)
iterator upper_bound (const key_type &key)
 获取第一个大于指定键的元素位置
const_iterator upper_bound (const key_type &key) const
 获取第一个大于指定键的元素位置(常量版本)
pair< iterator, iteratorequal_range (const key_type &key)
 获取等于指定键的元素范围
pair< const_iterator, const_iteratorequal_range (const key_type &key) const
 获取等于指定键的元素范围(常量版本)
void reserve (size_type n)
 预留容量
size_type capacity () const noexcept
 获取当前容量
void shrink_to_fit ()
 收缩容量以适应实际大小
void swap (sparse_vector &other) noexcept(is_nothrow_swappable_v< container_type > &&is_nothrow_swappable_v< Compare > &&is_nothrow_swappable_v< KeyOfValue >)
 交换两个稀疏向量的内容
bool equal_to (const sparse_vector &rhs) const noexcept(noexcept(_NEFORCE equal(cbegin(), cend(), rhs.cbegin())))
 相等比较
bool less_than (const sparse_vector &rhs) const noexcept(noexcept(_NEFORCE lexicographical_compare(cbegin(), cend(), rhs.cbegin(), rhs.cend())))
 小于比较

详细描述

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
class neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >

稀疏向量容器

模板参数
Key键类型
Value值类型
KeyOfValue从值中提取键的函数对象
Compare键比较函数对象
Alloc分配器类型

稀疏向量是一种基于有序平坦数组的关联容器底层实现。 使用二分查找提供对数时间复杂度的查找操作。

注解
稀疏向量在插入/删除时需要移动元素,但迭代性能优异,缓存友好,适用于查找频繁、修改较少且需要有序遍历的场景。

在文件 sparse_vector.hpp191 行定义.

构造及析构函数说明

◆ sparse_vector() [1/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::sparse_vector ( const Compare & comp)
inlineexplicit

构造函数,指定比较函数

参数
comp比较函数对象

在文件 sparse_vector.hpp301 行定义.

◆ sparse_vector() [2/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::sparse_vector ( const sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > & other)
inline

拷贝构造函数

参数
other源稀疏向量

在文件 sparse_vector.hpp308 行定义.

◆ sparse_vector() [3/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::sparse_vector ( sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > && other)
inlinenoexcept

移动构造函数

参数
other源稀疏向量

在文件 sparse_vector.hpp332 行定义.

成员函数说明

◆ begin() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::begin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

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

在文件 sparse_vector.hpp375 行定义.

◆ begin() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::begin ( )
inlinenodiscardnoexcept

获取起始迭代器

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

在文件 sparse_vector.hpp363 行定义.

◆ capacity()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
size_type neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::capacity ( ) const
inlinenodiscardnoexcept

获取当前容量

返回
当前分配的容量

在文件 sparse_vector.hpp790 行定义.

◆ cbegin()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::cbegin ( ) const
inlinenodiscardnoexcept

获取常量起始迭代器

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

在文件 sparse_vector.hpp387 行定义.

◆ cend()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::cend ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

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

在文件 sparse_vector.hpp393 行定义.

◆ count()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
size_type neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::count ( const key_type & key) const
inlinenodiscard

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

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

在文件 sparse_vector.hpp726 行定义.

◆ crbegin()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::crbegin ( ) const
inlinenodiscardnoexcept

获取常量反向起始迭代器

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

在文件 sparse_vector.hpp423 行定义.

◆ crend()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::crend ( ) const
inlinenodiscardnoexcept

获取常量反向结束迭代器

返回
指向第一个元素之前位置的常量反向迭代器

在文件 sparse_vector.hpp429 行定义.

◆ emplace_equal()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename... Args>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::emplace_equal ( Args &&... args)
inline

插入允许重复键元素

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

在文件 sparse_vector.hpp564 行定义.

◆ emplace_equal_hint()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename... Args>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::emplace_equal_hint ( iterator position,
Args &&... args )
inline

在提示位置附近构造允许重复键元素

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

在文件 sparse_vector.hpp592 行定义.

◆ emplace_unique()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename... Args>
pair< iterator, bool > neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::emplace_unique ( Args &&... args)
inline

插入唯一键元素

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

在文件 sparse_vector.hpp464 行定义.

◆ emplace_unique_hint()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename... Args>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::emplace_unique_hint ( iterator position,
Args &&... args )
inline

在提示位置附近构造唯一键元素

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

在文件 sparse_vector.hpp495 行定义.

◆ empty()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
bool neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::empty ( ) const
inlinenodiscardnoexcept

检查是否为空

返回
是否为空

在文件 sparse_vector.hpp447 行定义.

◆ end() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::end ( ) const
inlinenodiscardnoexcept

获取常量结束迭代器

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

在文件 sparse_vector.hpp381 行定义.

◆ end() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::end ( )
inlinenodiscardnoexcept

获取结束迭代器

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

在文件 sparse_vector.hpp369 行定义.

◆ equal_range() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
pair< iterator, iterator > neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::equal_range ( const key_type & key)
inlinenodiscard

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

参数
key键值
返回
包含lower_bound和upper_bound的pair

在文件 sparse_vector.hpp767 行定义.

◆ equal_range() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
pair< const_iterator, const_iterator > neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::equal_range ( const key_type & key) const
inlinenodiscard

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

参数
key键值
返回
包含lower_bound和upper_bound的pair

在文件 sparse_vector.hpp776 行定义.

◆ equal_to()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
bool neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::equal_to ( const sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > & rhs) const
inlinenodiscardnoexcept

相等比较

参数
rhs右侧稀疏向量
返回
大小相等且对应元素相等返回true

在文件 sparse_vector.hpp813 行定义.

◆ erase() [1/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
size_type neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::erase ( const key_type & key)
inline

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

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

在文件 sparse_vector.hpp653 行定义.

◆ erase() [2/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::erase ( iterator first,
iterator last )
inline

删除指定范围内的元素

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

在文件 sparse_vector.hpp679 行定义.

◆ erase() [3/3]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::erase ( iterator position)
inline

删除指定位置的元素

参数
position要删除的位置

在文件 sparse_vector.hpp668 行定义.

◆ find() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::find ( const key_type & key)
inlinenodiscard

查找具有指定键的元素

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

在文件 sparse_vector.hpp700 行定义.

◆ find() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::find ( const key_type & key) const
inlinenodiscard

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

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

在文件 sparse_vector.hpp713 行定义.

◆ insert_equal() [1/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_equal ( const value_type & value)
inline

拷贝插入允许重复键元素

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

在文件 sparse_vector.hpp575 行定义.

◆ insert_equal() [2/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_equal ( Iterator first,
Iterator last )
inline

范围插入允许重复键元素

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

在文件 sparse_vector.hpp642 行定义.

◆ insert_equal() [3/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_equal ( iterator position,
const value_type & value )
inline

在提示位置附近拷贝插入允许重复键元素

参数
position插入位置提示
value要插入的值
返回
指向插入元素的迭代器

在文件 sparse_vector.hpp623 行定义.

◆ insert_equal() [4/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_equal ( iterator position,
value_type && value )
inline

在提示位置附近移动插入允许重复键元素

参数
position插入位置提示
value要插入的值
返回
指向插入元素的迭代器

在文件 sparse_vector.hpp631 行定义.

◆ insert_equal() [5/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_equal ( value_type && value)
inline

移动插入允许重复键元素

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

在文件 sparse_vector.hpp582 行定义.

◆ insert_unique() [1/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
pair< iterator, bool > neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_unique ( const value_type & value)
inline

拷贝插入唯一键元素

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

在文件 sparse_vector.hpp478 行定义.

◆ insert_unique() [2/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_unique ( Iterator first,
Iterator last )
inline

范围插入唯一键元素

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

在文件 sparse_vector.hpp551 行定义.

◆ insert_unique() [3/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_unique ( iterator position,
const value_type & value )
inline

在提示位置附近拷贝插入唯一键元素

参数
position插入位置提示
value要插入的值
返回
指向插入元素的迭代器

在文件 sparse_vector.hpp532 行定义.

◆ insert_unique() [4/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_unique ( iterator position,
value_type && value )
inline

在提示位置附近移动插入唯一键元素

参数
position插入位置提示
value要插入的值
返回
指向插入元素的迭代器

在文件 sparse_vector.hpp540 行定义.

◆ insert_unique() [5/5]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
pair< iterator, bool > neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::insert_unique ( value_type && value)
inline

移动插入唯一键元素

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

在文件 sparse_vector.hpp485 行定义.

◆ key_compare()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
Compare neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::key_compare ( ) const
inlinenodiscardnoexcept

获取键比较函数对象

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

在文件 sparse_vector.hpp453 行定义.

◆ less_than()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
bool neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::less_than ( const sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > & rhs) const
inlinenodiscardnoexcept

小于比较

参数
rhs右侧稀疏向量
返回
按字典序比较结果

在文件 sparse_vector.hpp823 行定义.

◆ lower_bound() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::lower_bound ( const key_type & key)
inlinenodiscard

获取第一个不小于指定键的元素位置

参数
key键值
返回
指向第一个不小于key的元素的迭代器

在文件 sparse_vector.hpp735 行定义.

◆ lower_bound() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::lower_bound ( const key_type & key) const
inlinenodiscard

获取第一个不小于指定键的元素位置(常量版本)

参数
key键值
返回
指向第一个不小于key的元素的常量迭代器

在文件 sparse_vector.hpp742 行定义.

◆ max_size()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
size_type neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::max_size ( ) const
inlinenodiscardnoexcept

获取最大可能大小

返回
最大元素数量

在文件 sparse_vector.hpp441 行定义.

◆ operator=() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
sparse_vector & neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::operator= ( const sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > & other)
inline

拷贝赋值运算符

参数
other源稀疏向量
返回
自身引用

在文件 sparse_vector.hpp318 行定义.

◆ operator=() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
sparse_vector & neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::operator= ( sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > && other)
inlinenoexcept

移动赋值运算符

参数
other源稀疏向量
返回
自身引用

在文件 sparse_vector.hpp344 行定义.

◆ rbegin() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::rbegin ( ) const
inlinenodiscardnoexcept

获取常量反向起始迭代器

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

在文件 sparse_vector.hpp411 行定义.

◆ rbegin() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::rbegin ( )
inlinenodiscardnoexcept

获取反向起始迭代器

返回
指向最后一个元素的反向迭代器

在文件 sparse_vector.hpp399 行定义.

◆ rend() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::rend ( ) const
inlinenodiscardnoexcept

获取常量反向结束迭代器

返回
指向第一个元素之前位置的常量反向迭代器

在文件 sparse_vector.hpp417 行定义.

◆ rend() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
reverse_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::rend ( )
inlinenodiscardnoexcept

获取反向结束迭代器

返回
指向第一个元素之前位置的反向迭代器

在文件 sparse_vector.hpp405 行定义.

◆ reserve()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::reserve ( size_type n)
inline

预留容量

参数
n预留的元素数量

在文件 sparse_vector.hpp784 行定义.

◆ size()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
size_type neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::size ( ) const
inlinenodiscardnoexcept

获取元素数量

返回
元素数量

在文件 sparse_vector.hpp435 行定义.

◆ swap()

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
void neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::swap ( sparse_vector< Key, Value, KeyOfValue, Compare, Alloc > & other)
inlinenoexcept

交换两个稀疏向量的内容

参数
other要交换的另一个稀疏向量

在文件 sparse_vector.hpp801 行定义.

◆ upper_bound() [1/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::upper_bound ( const key_type & key)
inlinenodiscard

获取第一个大于指定键的元素位置

参数
key键值
返回
指向第一个大于key的元素的迭代器

在文件 sparse_vector.hpp751 行定义.

◆ upper_bound() [2/2]

template<typename Key, typename Value, typename KeyOfValue, typename Compare, typename Alloc = allocator<Value>>
const_iterator neforce::sparse_vector< Key, Value, KeyOfValue, Compare, Alloc >::upper_bound ( const key_type & key) const
inlinenodiscard

获取第一个大于指定键的元素位置(常量版本)

参数
key键值
返回
指向第一个大于key的元素的常量迭代器

在文件 sparse_vector.hpp758 行定义.


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