momo  3.9
momo::stdish::unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator > Class Template Reference

momo::stdish::unordered_set_open is similar to std::unordered_set, but much more efficient in operation speed. The implementation is based on open addressing hash table. More...

#include <unordered_set.h>

Inheritance diagram for momo::stdish::unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator >:
momo::stdish::unordered_set< TKey, HashCoder< TKey >, std::equal_to< TKey >, std::allocator< TKey >, HashSet< TKey, HashTraitsStd< TKey, HashCoder< TKey >, std::equal_to< TKey >, HashBucketOpenDefault >, MemManagerStd< std::allocator< TKey > > > >

Public Types

typedef size_t size_type
 
typedef key_type value_type
 
- Public Types inherited from momo::stdish::unordered_set< TKey, HashCoder< TKey >, std::equal_to< TKey >, std::allocator< TKey >, HashSet< TKey, HashTraitsStd< TKey, HashCoder< TKey >, std::equal_to< TKey >, HashBucketOpenDefault >, MemManagerStd< std::allocator< TKey > > > >
typedef TKey key_type
 
typedef HashCoder< TKey > hasher
 
typedef std::equal_to< TKey > key_equal
 
typedef std::allocator< TKey > allocator_type
 
typedef HashSet nested_container_type
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef key_type value_type
 
typedef HashSet::ConstIterator const_iterator
 
typedef HashSet::Iterator iterator
 
typedef value_typereference
 
typedef const_iterator::Reference const_reference
 
typedef value_typepointer
 
typedef const_iterator::Pointer const_pointer
 
typedef internal::set_node_handle< typename HashSet::ExtractedItemnode_type
 
typedef internal::insert_return_type< iterator, node_typeinsert_return_type
 
typedef HashSet::ConstBucketBounds::Iterator const_local_iterator
 
typedef const_local_iterator local_iterator
 

Public Member Functions

 unordered_set_open ()
 
unordered_set_openoperator= (std::initializer_list< value_type > values)
 
- Public Member Functions inherited from momo::stdish::unordered_set< TKey, HashCoder< TKey >, std::equal_to< TKey >, std::allocator< TKey >, HashSet< TKey, HashTraitsStd< TKey, HashCoder< TKey >, std::equal_to< TKey >, HashBucketOpenDefault >, MemManagerStd< std::allocator< TKey > > > >
 unordered_set ()
 
 unordered_set (const allocator_type &alloc)
 
 unordered_set (size_type bucketCount, const allocator_type &alloc=allocator_type())
 
 unordered_set (size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (Iterator first, Iterator last)
 
 unordered_set (Iterator first, Iterator last, size_type bucketCount, const allocator_type &alloc=allocator_type())
 
 unordered_set (Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (std::initializer_list< value_type > values)
 
 unordered_set (std::initializer_list< value_type > values, size_type bucketCount, const allocator_type &alloc=allocator_type())
 
 unordered_set (std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
 
 unordered_set (unordered_set &&right) noexcept
 
 unordered_set (unordered_set &&right, const momo::internal::Identity< allocator_type > &alloc) noexcept(std::is_empty< allocator_type >::value)
 
 unordered_set (const unordered_set &right)
 
 unordered_set (const unordered_set &right, const momo::internal::Identity< allocator_type > &alloc)
 
 ~unordered_set ()=default
 
unordered_setoperator= (unordered_set &&right) noexcept(std::is_empty< allocator_type >::value||std::allocator_traits< allocator_type >::propagate_on_container_move_assignment::value)
 
unordered_setoperator= (const unordered_set &right)
 
unordered_setoperator= (std::initializer_list< value_type > values)
 
void swap (unordered_set &right) noexcept
 
const nested_container_typeget_nested_container () const noexcept
 
nested_container_typeget_nested_container () noexcept
 
const_iterator begin () const noexcept
 
local_iterator begin (size_type bucketIndex)
 
const_local_iterator begin (size_type bucketIndex) const
 
const_iterator end () const noexcept
 
local_iterator end (size_type bucketIndex)
 
const_local_iterator end (size_type bucketIndex) const
 
const_iterator cbegin () const noexcept
 
const_local_iterator cbegin (size_type bucketIndex) const
 
const_iterator cend () const noexcept
 
const_local_iterator cend (size_type bucketIndex) const
 
float max_load_factor () const noexcept
 
void max_load_factor (float maxLoadFactor)
 
hasher hash_function () const
 
key_equal key_eq () const
 
allocator_type get_allocator () const noexcept
 
size_type max_size () const noexcept
 
size_type size () const noexcept
 
MOMO_NODISCARD bool empty () const noexcept
 
void clear () noexcept
 
void rehash (size_type bucketCount)
 
void reserve (size_type count)
 
MOMO_FORCEINLINE const_iterator find (const key_type &key) const
 
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iteratorfind (const KeyArg &key) const
 
MOMO_FORCEINLINE size_type count (const key_type &key) const
 
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, size_typecount (const KeyArg &key) const
 
MOMO_FORCEINLINE bool contains (const key_type &key) const
 
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, bool > contains (const KeyArg &key) const
 
MOMO_FORCEINLINE std::pair< const_iterator, const_iteratorequal_range (const key_type &key) const
 
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< const_iterator, const_iterator > > equal_range (const KeyArg &key) const
 
std::pair< iterator, bool > insert (value_type &&value)
 
iterator insert (const_iterator hint, value_type &&value)
 
std::pair< iterator, bool > insert (const value_type &value)
 
iterator insert (const_iterator hint, const value_type &value)
 
insert_return_type insert (node_type &&node)
 
iterator insert (const_iterator hint, node_type &&node)
 
void insert (Iterator first, Iterator last)
 
void insert (std::initializer_list< value_type > values)
 
std::pair< iterator, bool > emplace (ValueArgs &&... valueArgs)
 
momo::internal::EnableIf< std::is_same< key_type, typename std::decay< ValueArg >::type >::value, std::pair< iterator, bool > > emplace (ValueArg &&valueArg)
 
iterator emplace_hint (const_iterator hint, ValueArgs &&... valueArgs)
 
iterator erase (const_iterator where)
 
iterator erase (const_iterator first, const_iterator last)
 
size_type erase (const key_type &key)
 
node_type extract (const_iterator where)
 
node_type extract (const key_type &key)
 
void merge (Set &&set)
 
size_type max_bucket_count () const noexcept
 
size_type bucket_count () const noexcept
 
size_type bucket_size (size_type bucketIndex) const
 
size_type bucket (const key_type &key) const
 
float load_factor () const noexcept
 
bool operator== (const unordered_set &right) const
 
bool operator!= (const unordered_set &right) const
 

Friends

void swap (unordered_set_open &left, unordered_set_open &right) noexcept
 
template<typename ValueFilter >
size_type erase_if (unordered_set_open &cont, const ValueFilter &valueFilter)
 

Detailed Description

template<typename TKey, typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
class momo::stdish::unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator >

momo::stdish::unordered_set_open is similar to std::unordered_set, but much more efficient in operation speed. The implementation is based on open addressing hash table.

Deviations from the std::unordered_set:

  1. Container items must be movable (preferably without exceptions) or copyable, similar to items of std::vector.
  2. After each addition or removal of the item all iterators and references to items become invalid and should not be used.
  3. Functions clear, begin, cbegin and iterator increment take O(bucket_count) time in worst case.
  4. If ObjectManager<key_type>::isNothrowAnywayAssignable is false, functions erase can throw exceptions.
  5. Functions merge, extract and insert(node_type&&) move items.

It is allowed to pass to functions insert and emplace references to items within the container.

Member Typedef Documentation

◆ size_type

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
typedef size_t momo::stdish::unordered_set< TKey, THashFunc, TEqualFunc, TAllocator, THashSet >::size_type

◆ value_type

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
typedef key_type momo::stdish::unordered_set< TKey, THashFunc, TEqualFunc, TAllocator, THashSet >::value_type

Constructor & Destructor Documentation

◆ unordered_set_open()

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
momo::stdish::unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator >::unordered_set_open ( )
inline

Member Function Documentation

◆ operator=()

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
unordered_set_open& momo::stdish::unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator >::operator= ( std::initializer_list< value_type values)
inline

Friends And Related Function Documentation

◆ erase_if

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
template<typename ValueFilter >
size_type erase_if ( unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator > &  cont,
const ValueFilter &  valueFilter 
)
friend

◆ swap

template<typename TKey , typename THashFunc = HashCoder<TKey>, typename TEqualFunc = std::equal_to<TKey>, typename TAllocator = std::allocator<TKey>>
void swap ( unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator > &  left,
unordered_set_open< TKey, THashFunc, TEqualFunc, TAllocator > &  right 
)
friend

The documentation for this class was generated from the following file: