|
| | sparse_multimap () |
| | 默认构造函数
|
| | sparse_multimap (const key_compare &comp) |
| | 构造函数,指定比较函数
|
| | sparse_multimap (const sparse_multimap &other) |
| | 拷贝构造函数
|
| sparse_multimap & | operator= (const sparse_multimap &other) |
| | 拷贝赋值运算符
|
| | sparse_multimap (sparse_multimap &&other) noexcept(is_nothrow_move_constructible_v< base_type >) |
| | 移动构造函数
|
| sparse_multimap & | operator= (sparse_multimap &&other) noexcept(is_nothrow_move_assignable_v< base_type >) |
| | 移动赋值运算符
|
| template<typename Iterator> |
| | sparse_multimap (Iterator first, Iterator last) |
| | 范围构造函数
|
| template<typename Iterator> |
| | sparse_multimap (Iterator first, Iterator last, const key_compare &comp) |
| | 范围构造函数,指定比较函数
|
| | sparse_multimap (std::initializer_list< value_type > ilist) |
| | 初始化列表构造函数
|
| | sparse_multimap (std::initializer_list< value_type > ilist, const key_compare &comp) |
| | 初始化列表构造函数,指定比较函数
|
| sparse_multimap & | operator= (std::initializer_list< value_type > ilist) |
| | 初始化列表赋值运算符
|
|
| ~sparse_multimap ()=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 |
| | 检查是否为空
|
| key_compare | key_comp () const noexcept |
| | 获取键比较函数对象
|
| value_compare | value_comp () const noexcept |
| | 获取值比较函数对象
|
| template<typename... Args> |
| iterator | emplace (Args &&... args) |
| | 在sparse_multimap中就地构造元素
|
| iterator | insert (const value_type &value) |
| | 拷贝插入元素
|
| iterator | insert (value_type &&value) |
| | 移动插入元素
|
| template<typename... Args> |
| iterator | emplace_hint (iterator position, Args &&... args) |
| | 在提示位置附近就地构造元素
|
| iterator | insert (iterator position, const value_type &value) |
| | 在提示位置附近拷贝插入元素
|
| iterator | insert (iterator position, value_type &&value) |
| | 在提示位置附近移动插入元素
|
| template<typename Iterator> |
| void | insert (Iterator first, Iterator last) |
| | 范围插入元素
|
| void | erase (iterator position) noexcept(noexcept(data_.erase(position))) |
| | 删除指定位置的元素
|
| size_type | erase (const key_type &key) noexcept(noexcept(data_.erase(key))) |
| | 删除所有具有指定键的元素
|
| void | erase (iterator first, iterator last) noexcept(noexcept(data_.erase(first, last))) |
| | 删除指定范围内的元素
|
|
void | clear () noexcept(noexcept(data_.clear())) |
| | 清空sparse_multimap
|
| 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, iterator > | equal_range (const key_type &key) |
| | 获取等于指定键的元素范围
|
| pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
| | 获取等于指定键的常量元素范围
|
| void | reserve (size_type n) |
| | 预留容量
|
| size_type | capacity () const noexcept |
| | 获取当前容量
|
|
void | shrink_to_fit () |
| | 收缩容量以适应实际大小
|
| void | swap (sparse_multimap &other) noexcept(is_nothrow_swappable_v< base_type >) |
| | 交换两个sparse_multimap的内容
|
| bool | equal_to (const sparse_multimap &rhs) const noexcept(noexcept(data_==rhs.data_)) |
| | 相等比较操作符
|
| bool | less_than (const sparse_multimap &rhs) const noexcept(noexcept(data_< rhs.data_)) |
| | 小于比较操作符
|
template<typename Key, typename T, typename Compare = less<Key>, typename Alloc = allocator<pair<Key, T>>>
class neforce::sparse_multimap< Key, T, Compare, Alloc >
稀疏多重映射容器
- 模板参数
-
| Key | 键类型 |
| T | 值类型 |
| Compare | 键比较函数类型,默认为less<Key> |
| Alloc | 分配器类型 |
sparse_multimap是一种关联容器,存储键值对(key-value pairs),允许重复键。 元素按照键的顺序自动排序,排序标准由Compare函数对象指定。 底层使用有序平坦数组实现,查找O(log n),迭代缓存友好。
在文件 sparse_multimap.hpp 第 41 行定义.
template<typename Key, typename T, typename Compare = less<Key>, typename Alloc = allocator<pair<Key, T>>>