1#ifndef NEFORCE_CORE_CONTAINER_UNORDERED_MULTISET_HPP__
2#define NEFORCE_CORE_CONTAINER_UNORDERED_MULTISET_HPP__
15NEFORCE_BEGIN_NAMESPACE__
35template <
typename Value,
typename HashFcn = hash<Value>,
typename EqualKey = equal_to<Value>,
36 typename Alloc = allocator<hashtable_node<Value>>>
120 ht_(_NEFORCE
move(other.ht_)) {}
128 ht_ = _NEFORCE
move(other.ht_);
138 template <
typename Iterator>
141 ht_.insert_equal(first, last);
151 template <
typename Iterator>
154 ht_.insert_equal(first,
list);
165 template <
typename Iterator>
168 ht_.insert_equal(first, last);
180 template <
typename Iterator>
183 ht_.insert_equal(first, last);
272 NEFORCE_NODISCARD
bool empty() const noexcept {
return ht_.empty(); }
280 return ht_.count(key);
318 NEFORCE_NODISCARD
float load_factor() const noexcept {
return ht_.load_factor(); }
324 NEFORCE_NODISCARD
float max_load_factor() const noexcept {
return ht_.max_load_factor(); }
352 template <
typename... Args>
377 template <
typename Iterator>
378 void insert(Iterator first, Iterator last) {
379 ht_.insert_equal(first, last);
405 void clear() noexcept { ht_.clear(); }
440 return ht_.equal_range(key);
449 return ht_ == rhs.ht_;
458 return ht_ < rhs.ht_;
462#ifdef NEFORCE_STANDARD_17
463template <
typename Iterator,
typename HashFcn = hash<iter_value_t<Iterator>>,
464 typename Compare = equal_to<iter_value_t<Iterator>>,
typename Alloc = allocator<iter_value_t<Iterator>>>
465unordered_multiset(Iterator, Iterator, HashFcn = HashFcn(), Compare = Compare(), Alloc = Alloc())
468template <
typename Value,
typename HashFcn = hash<Value>,
typename Compare = equal_to<Value>,
469 typename Alloc = allocator<Value>>
470unordered_multiset(std::initializer_list<Value>, HashFcn = HashFcn(), Compare = Compare(), Alloc = Alloc())
473template <
typename Iterator,
typename Alloc>
478template <
typename Iterator,
typename HashFcn,
typename Alloc>
482template <
typename Value,
typename Alloc>
486template <
typename Value,
typename HashFcn,
typename Alloc>
493NEFORCE_END_NAMESPACE__
const Value * const_pointer
ptrdiff_t difference_type
const Value & const_reference
hashtable_iterator< true, hashtable > const_iterator
hashtable_iterator< false, hashtable > iterator
void erase(iterator first, iterator last) noexcept
删除指定范围内的元素
unordered_multiset(size_type n, const hasher &hf)
构造函数,指定初始桶数和哈希函数
void reserve(size_type n)
预留空间
NEFORCE_NODISCARD size_type count(const key_type &key) const noexcept(noexcept(ht_.count(key)))
统计具有指定键的元素数量
NEFORCE_NODISCARD bool operator==(const unordered_multiset &rhs) const noexcept(noexcept(ht_==rhs.ht_))
相等比较操作符
NEFORCE_NODISCARD const_iterator begin() const noexcept
获取常量起始迭代器
typename base_type::const_reference reference
引用类型
unordered_multiset(std::initializer_list< value_type > ilist)
初始化列表构造函数
NEFORCE_NODISCARD bool operator<(const unordered_multiset &rhs) const noexcept(noexcept(ht_< rhs.ht_))
小于比较操作符
NEFORCE_NODISCARD const_iterator end() const noexcept
获取常量结束迭代器
typename base_type::const_iterator const_iterator
常量迭代器类型
typename base_type::const_reference const_reference
常量引用类型
NEFORCE_NODISCARD size_type max_size() const noexcept
获取最大可能大小
unordered_multiset(Iterator first, Iterator last, size_type n, const hasher &hf, const key_equal &eql)
范围构造函数,指定初始桶数、哈希函数和键相等比较函数
unordered_multiset & operator=(const unordered_multiset &other)
拷贝赋值运算符
iterator insert(value_type &&value)
移动插入元素
typename base_type::allocator_type allocator_type
分配器类型
NEFORCE_NODISCARD const_iterator cend() const noexcept
获取常量结束迭代器
NEFORCE_NODISCARD pair< iterator, iterator > equal_range(const key_type &key)
获取等于指定键的元素范围
unordered_multiset(const unordered_multiset &other)
拷贝构造函数
unordered_multiset(std::initializer_list< value_type > ilist, size_type n, const hasher &hf)
初始化列表构造函数,指定初始桶数和哈希函数
unordered_multiset(std::initializer_list< value_type > ilist, size_type n, const hasher &hf, const key_equal &eql)
初始化列表构造函数,指定初始桶数、哈希函数和键相等比较函数
typename base_type::const_pointer pointer
指针类型
typename base_type::size_type size_type
大小类型
void swap(unordered_multiset &other) noexcept(is_nothrow_swappable_v< base_type >)
交换两个unordered_multiset的内容
typename base_type::key_equal key_equal
键相等比较函数类型
NEFORCE_NODISCARD size_type size() const noexcept
获取元素数量
NEFORCE_NODISCARD float load_factor() const noexcept
获取当前负载因子
NEFORCE_NODISCARD size_type buckets_size() const noexcept
获取桶数量
NEFORCE_NODISCARD hasher hash_func() const noexcept(noexcept(ht_.hash_func()))
获取哈希函数对象
NEFORCE_NODISCARD bool empty() const noexcept
检查是否为空
NEFORCE_NODISCARD iterator begin() noexcept
获取起始迭代器
NEFORCE_NODISCARD key_equal key_eql() const noexcept(noexcept(ht_.key_eql()))
获取键相等比较函数对象
NEFORCE_NODISCARD size_type bucket_size(size_type n) const noexcept
获取指定桶的大小
typename base_type::hasher hasher
哈希函数类型
NEFORCE_NODISCARD const_iterator cbegin() const noexcept
获取常量起始迭代器
unordered_multiset(size_type n)
构造函数,指定初始桶数
unordered_multiset(std::initializer_list< value_type > ilist, size_type n)
初始化列表构造函数,指定初始桶数
unordered_multiset(Iterator first, Iterator last)
范围构造函数
void rehash(size_type n)
重新哈希,调整桶数量
typename base_type::difference_type difference_type
差值类型
unordered_multiset(Iterator first, Iterator list, size_type n)
范围构造函数,指定初始桶数
unordered_multiset(size_type n, const hasher &hf, const key_equal &eql)
构造函数,指定初始桶数、哈希函数和键相等比较函数
NEFORCE_NODISCARD size_type buckets_max_count() const noexcept
获取最大桶数量
void clear() noexcept
清空unordered_multiset
typename base_type::value_type value_type
值类型
unordered_multiset(unordered_multiset &&other) noexcept(is_nothrow_move_constructible_v< base_type >)
移动构造函数
typename base_type::key_type key_type
键类型
void erase(iterator position) noexcept
删除指定位置的元素
size_type erase(const key_type &key) noexcept
删除所有具有指定键的元素
typename base_type::iterator iterator
迭代器类型
void max_load_factor(float lf) noexcept
设置最大负载因子
void insert(Iterator first, Iterator last)
范围插入元素
unordered_multiset()
默认构造函数
NEFORCE_NODISCARD iterator end() noexcept
获取结束迭代器
NEFORCE_NODISCARD float max_load_factor() const noexcept
获取最大负载因子
iterator emplace(Args &&... args)
在unordered_multiset中就地构造元素
NEFORCE_NODISCARD pair< const_iterator, const_iterator > equal_range(const key_type &key) const
获取等于指定键的常量元素范围
typename base_type::const_pointer const_pointer
常量指针类型
NEFORCE_NODISCARD const_iterator find(const key_type &key) const
查找具有指定键的常量元素
NEFORCE_NODISCARD iterator find(const key_type &key)
查找具有指定键的元素
iterator insert(const value_type &value)
拷贝插入元素
unordered_multiset & operator=(unordered_multiset &&other) noexcept(is_nothrow_move_assignable_v< base_type >)
移动赋值运算符
unordered_multiset(Iterator first, Iterator last, size_type n, const hasher &hf)
范围构造函数,指定初始桶数和哈希函数
NEFORCE_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
NEFORCE_INLINE17 constexpr bool is_object_v
is_object的便捷变量模板
constexpr bool is_hash_v
is_hash的便捷变量模板
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素
NEFORCE_INLINE17 constexpr bool is_nothrow_swappable_v
is_nothrow_swappable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_allocator_v
is_allocator的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_move_assignable_v
is_nothrow_move_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_move_constructible_v
is_nothrow_move_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_same_v
is_same的便捷变量模板