momo  3.12
momo::stdish::unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator > Class Template Reference

momo::stdish::unordered_map is similar to std::unordered_map, but much more efficient in memory usage. The implementation is based on hash table with buckets in the form of small arrays. More...

#include <unordered_map.h>

Inheritance diagram for momo::stdish::unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator >:

Public Member Functions

unordered_mapoperator= (std::initializer_list< typename UnorderedMapAdaptor::value_type > values)
 

Friends

void swap (unordered_map &left, unordered_map &right) noexcept
 

Detailed Description

template<typename TKey, typename TMapped, typename THasher = HashCoder<TKey>, typename TEqualComparer = std::equal_to<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
class momo::stdish::unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator >

momo::stdish::unordered_map is similar to std::unordered_map, but much more efficient in memory usage. The implementation is based on hash table with buckets in the form of small arrays.

Deviations from the std::unordered_map:

  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. Type reference is not the same as value_type&, so for (auto& p : map) is illegal, but for (auto p : map) or for (const auto& p : map) or for (auto&& p : map) is allowed.
  4. Functions clear, begin, cbegin and iterator increment take O(bucket_count) time in worst case.
  5. If ObjectManager<key_type>::isNothrowAnywayAssignable is false or ObjectManager<mapped_type>::isNothrowAnywayAssignable is false, functions erase can throw exceptions.
  6. 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 Function Documentation

◆ operator=()

template<typename TKey , typename TMapped , typename THasher = HashCoder<TKey>, typename TEqualComparer = std::equal_to<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
unordered_map& momo::stdish::unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator >::operator= ( std::initializer_list< typename UnorderedMapAdaptor::value_type values)
inline

Friends And Related Function Documentation

◆ swap

template<typename TKey , typename TMapped , typename THasher = HashCoder<TKey>, typename TEqualComparer = std::equal_to<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
void swap ( unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator > &  left,
unordered_map< TKey, TMapped, THasher, TEqualComparer, TAllocator > &  right 
)
friend

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