Go to the documentation of this file.
17 #ifndef MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
18 #define MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
20 #include "../HashMap.h"
55 template<
typename TKey,
typename TMapped,
56 typename THashFunc = HashCoder<TKey>,
57 typename TEqualFunc = std::equal_to<TKey>,
58 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>,
59 typename THashMap = HashMap<TKey, TMapped, HashTraitsStd<TKey, THashFunc, TEqualFunc>,
60 MemManagerStd<TAllocator>>>
64 typedef THashMap HashMap;
82 typedef std::pair<const key_type, mapped_type>
value_type;
104 template<
typename KeyArg>
105 struct IsValidKeyArg :
public HashTraits::template IsValidKeyArg<KeyArg>
117 struct IteratorProxy :
public iterator
149 : mHashMap(HashTraits(), MemManager(alloc))
154 : mHashMap(HashTraits(bucketCount), MemManager(alloc))
160 : mHashMap(HashTraits(bucketCount, hashFunc), MemManager(alloc))
166 : mHashMap(HashTraits(bucketCount, hashFunc, equalFunc), MemManager(alloc))
170 template<
typename Iterator>
176 template<
typename Iterator>
184 template<
typename Iterator>
192 template<
typename Iterator>
225 : mHashMap(std::move(right.mHashMap))
230 noexcept(std::is_empty<allocator_type>::value)
231 : mHashMap(pvCreateMap(
std::move(right), alloc))
236 : mHashMap(right.mHashMap)
241 : mHashMap(right.mHashMap, MemManager(alloc))
248 noexcept(std::is_empty<allocator_type>::value ||
249 std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value)
253 bool propagate = std::is_empty<allocator_type>::value ||
254 std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value;
256 mHashMap = pvCreateMap(std::move(right), alloc);
265 bool propagate = std::is_empty<allocator_type>::value ||
266 std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value;
268 mHashMap = HashMap(right.mHashMap, MemManager(alloc));
275 HashMap hashMap(mHashMap.GetHashTraits(), MemManager(
get_allocator()));
276 hashMap.Insert(values.begin(), values.end());
277 mHashMap = std::move(hashMap);
283 MOMO_ASSERT(std::allocator_traits<allocator_type>::propagate_on_container_swap::value
285 mHashMap.Swap(right.mHashMap);
305 return ConstIteratorProxy(mHashMap.GetBegin());
310 return IteratorProxy(mHashMap.GetBegin());
315 return ConstIteratorProxy(mHashMap.GetEnd());
320 return IteratorProxy(mHashMap.GetEnd());
343 throw std::out_of_range(
"invalid load factor");
344 HashTraits hashTraits(mHashMap.GetHashTraits(), maxLoadFactor);
346 hashMap.Reserve(
size());
348 mHashMap = std::move(hashMap);
353 return mHashMap.GetHashTraits().GetHashFunc();
358 return mHashMap.GetHashTraits().GetEqualFunc();
363 return allocator_type(mHashMap.GetMemManager().GetByteAllocator());
368 return std::allocator_traits<allocator_type>::max_size(
get_allocator());
373 return mHashMap.GetCount();
378 return mHashMap.IsEmpty();
388 bucketCount = std::minmax(bucketCount,
size_t{2}).second;
390 bucketCount =
size_t{1} << logBucketCount;
396 mHashMap.Reserve(
count);
401 return ConstIteratorProxy(mHashMap.Find(key));
406 return IteratorProxy(mHashMap.Find(key));
409 template<
typename KeyArg>
413 return ConstIteratorProxy(mHashMap.Find(key));
416 template<
typename KeyArg>
420 return IteratorProxy(mHashMap.Find(key));
428 template<
typename KeyArg>
437 return mHashMap.ContainsKey(key);
440 template<
typename KeyArg>
444 return mHashMap.ContainsKey(key);
457 template<
typename KeyArg>
459 std::pair<const_iterator, const_iterator>>
equal_range(
const KeyArg& key)
const
464 template<
typename KeyArg>
487 std::pair<iterator, bool>
insert(std::pair<key_type, mapped_type>&& value)
489 return pvEmplace(
nullptr, std::forward_as_tuple(std::move(value.first)),
490 std::forward_as_tuple(std::move(value.second)));
495 return pvEmplace(hint, std::forward_as_tuple(std::move(value.first)),
496 std::forward_as_tuple(std::move(value.second))).first;
499 template<
typename First,
typename Second>
501 && std::is_constructible<mapped_type, const Second&>::value,
502 std::pair<iterator, bool>>
insert(
const std::pair<First, Second>& value)
504 return pvEmplace(
nullptr, std::forward_as_tuple(value.first),
505 std::forward_as_tuple(value.second));
508 template<
typename First,
typename Second>
510 && std::is_constructible<mapped_type, const Second&>::value,
513 return pvEmplace(hint, std::forward_as_tuple(value.first),
514 std::forward_as_tuple(value.second)).first;
517 template<
typename First,
typename Second>
519 && std::is_constructible<mapped_type, Second&&>::value,
520 std::pair<iterator, bool>>
insert(std::pair<First, Second>&& value)
522 return pvEmplace(
nullptr, std::forward_as_tuple(std::forward<First>(value.first)),
523 std::forward_as_tuple(std::forward<Second>(value.second)));
526 template<
typename First,
typename Second>
528 && std::is_constructible<mapped_type, Second&&>::value,
531 return pvEmplace(hint, std::forward_as_tuple(std::forward<First>(value.first)),
532 std::forward_as_tuple(std::forward<Second>(value.second))).first;
540 std::move(NodeTypeProxy::GetExtractedPair(node)));
547 #ifdef MOMO_USE_UNORDERED_HINT_ITERATORS
550 return IteratorProxy(mHashMap.Add(ConstIteratorProxy::GetBaseIterator(hint),
551 std::move(NodeTypeProxy::GetExtractedPair(node))));
554 return insert(std::move(node)).position;
558 template<
typename Iterator>
559 void insert(Iterator first, Iterator last)
564 void insert(std::initializer_list<value_type> values)
566 mHashMap.Insert(values.begin(), values.end());
571 return pvEmplace(
nullptr, std::tuple<>(), std::tuple<>());
576 return pvEmplace(hint, std::tuple<>(), std::tuple<>()).first;
579 template<
typename ValueArg>
580 std::pair<iterator, bool>
emplace(ValueArg&& valueArg)
582 return insert(std::forward<ValueArg>(valueArg));
585 template<
typename ValueArg>
588 return insert(hint, std::forward<ValueArg>(valueArg));
591 template<
typename KeyArg,
typename MappedArg>
592 std::pair<iterator, bool>
emplace(KeyArg&& keyArg, MappedArg&& mappedArg)
594 return pvEmplace(
nullptr, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
595 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
598 template<
typename KeyArg,
typename MappedArg>
601 return pvEmplace(hint, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
602 std::forward_as_tuple(std::forward<MappedArg>(mappedArg))).first;
605 template<
typename... KeyArgs,
typename... MappedArgs>
606 std::pair<iterator, bool>
emplace(std::piecewise_construct_t,
607 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
609 return pvEmplace(
nullptr, std::move(keyArgs), std::move(mappedArgs));
612 template<
typename... KeyArgs,
typename... MappedArgs>
614 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
616 return pvEmplace(hint, std::move(keyArgs), std::move(mappedArgs)).first;
621 return IteratorProxy(mHashMap.Remove(ConstIteratorProxy::GetBaseIterator(where)));
631 if (first ==
begin() && last ==
end())
638 return IteratorProxy(mHashMap.MakeMutableIterator(
639 ConstIteratorProxy::GetBaseIterator(first)));
641 if (first !=
end() && std::next(first) == last)
643 throw std::invalid_argument(
"invalid unordered_map erase arguments");
648 return mHashMap.Remove(key) ? 1 : 0;
651 template<
typename ValueFilter>
656 return cont.mHashMap.Remove(pairFilter);
661 return mHashMap[std::move(key)];
666 return mHashMap[key];
673 throw std::out_of_range(
"invalid unordered_map key");
681 throw std::out_of_range(
"invalid unordered_map key");
685 template<
typename... MappedArgs>
688 return pvEmplace(
nullptr, std::forward_as_tuple(std::move(key)),
689 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
692 template<
typename... MappedArgs>
695 return pvEmplace(hint, std::forward_as_tuple(std::move(key)),
696 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
699 template<
typename... MappedArgs>
702 return pvEmplace(
nullptr, std::forward_as_tuple(key),
703 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
706 template<
typename... MappedArgs>
709 return pvEmplace(hint, std::forward_as_tuple(key),
710 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
713 template<
typename MappedArg>
716 return pvInsertOrAssign(
nullptr, std::move(key), std::forward<MappedArg>(mappedArg));
719 template<
typename MappedArg>
722 return pvInsertOrAssign(hint, std::move(key), std::forward<MappedArg>(mappedArg)).first;
725 template<
typename MappedArg>
728 return pvInsertOrAssign(
nullptr, key, std::forward<MappedArg>(mappedArg));
731 template<
typename MappedArg>
734 return pvInsertOrAssign(hint, key, std::forward<MappedArg>(mappedArg)).first;
748 template<
typename Map>
751 mHashMap.MergeFrom(
map.get_nested_container());
762 return mHashMap.GetBucketCount();
767 return mHashMap.GetBucketBounds(bucketIndex).GetCount();
772 return LocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetBegin());
777 return ConstLocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetBegin());
782 return LocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetEnd());
787 return ConstLocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetEnd());
792 return begin(bucketIndex);
797 return end(bucketIndex);
802 return mHashMap.GetBucketIndex(key);
809 if (
count == 0 && bucketCount == 0)
811 return static_cast<float>(
count) /
static_cast<float>(bucketCount);
821 if (iter == right.
end())
823 if (!(iter->second == ref.second))
831 return !(*
this == right);
837 if (right.get_allocator() == alloc)
838 return std::move(right.mHashMap);
839 HashMap hashMap(right.mHashMap.GetHashTraits(), MemManager(alloc));
840 hashMap.MergeFrom(right.mHashMap);
844 template<
typename Hint,
typename... KeyArgs,
typename... MappedArgs>
845 std::pair<iterator, bool> pvEmplace(Hint hint, std::tuple<KeyArgs...>&& keyArgs,
846 std::tuple<MappedArgs...>&& mappedArgs)
848 typedef typename HashMap::KeyValueTraits
849 ::template ValueCreator<MappedArgs...> MappedCreator;
850 return pvInsert(hint, std::move(keyArgs),
851 MappedCreator(mHashMap.GetMemManager(), std::move(mappedArgs)));
854 template<
typename Hint,
typename... KeyArgs,
typename MappedCreator>
855 std::pair<iterator, bool> pvInsert(Hint , std::tuple<KeyArgs...>&& keyArgs,
856 MappedCreator&& mappedCreator)
858 MemManager& memManager = mHashMap.GetMemManager();
861 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
863 KeyCreator(memManager, std::move(keyArgs))(&keyBuffer);
864 bool keyDestroyed =
false;
870 KeyManager::Destroy(memManager, *&keyBuffer);
872 return { IteratorProxy(pos),
false };
874 auto valueCreator = [&memManager, &keyBuffer, &mappedCreator, &keyDestroyed]
877 KeyManager::Relocate(memManager, *&keyBuffer, newKey);
881 std::forward<MappedCreator>(mappedCreator)(newMapped);
885 KeyManager::Destroy(memManager, *newKey);
890 return { IteratorProxy(resPos),
true };
895 KeyManager::Destroy(memManager, *&keyBuffer);
900 template<
typename Hint,
typename RKey,
typename MappedCreator,
901 typename Key =
typename std::decay<RKey>::type>
903 std::pair<iterator, bool>> pvInsert(Hint , std::tuple<RKey>&& key,
904 MappedCreator&& mappedCreator)
907 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
908 return { IteratorProxy(res.position), res.inserted };
911 #ifdef MOMO_USE_UNORDERED_HINT_ITERATORS
912 template<
typename... KeyArgs,
typename MappedCreator>
913 std::pair<iterator, bool> pvInsert(
const_iterator hint, std::tuple<KeyArgs...>&& keyArgs,
914 MappedCreator&& mappedCreator)
916 MemManager& memManager = mHashMap.GetMemManager();
918 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
919 auto valueCreator = [&memManager, &keyArgs, &mappedCreator]
922 KeyCreator(memManager, std::move(keyArgs))(newKey);
925 std::forward<MappedCreator>(mappedCreator)(newMapped);
929 KeyManager::Destroy(memManager, *newKey);
934 ConstIteratorProxy::GetBaseIterator(hint), valueCreator);
935 return { IteratorProxy(resPos),
true };
938 template<
typename RKey,
typename MappedCreator,
939 typename Key =
typename std::decay<RKey>::type>
941 std::pair<iterator, bool>> pvInsert(
const_iterator hint, std::tuple<RKey>&& key,
942 MappedCreator&& mappedCreator)
944 typename HashMap::Position resPos = mHashMap.AddCrt(ConstIteratorProxy::GetBaseIterator(hint),
945 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
946 return { IteratorProxy(resPos),
true };
948 #endif // MOMO_USE_UNORDERED_HINT_ITERATORS
950 template<
typename Iterator>
951 void pvInsert(Iterator first, Iterator last, std::true_type )
953 mHashMap.Insert(first, last);
956 template<
typename Iterator>
957 void pvInsert(Iterator first, Iterator last, std::false_type )
959 for (Iterator iter = first; iter != last; ++iter)
963 template<
typename H
int,
typename RKey,
typename MappedArg>
964 std::pair<iterator, bool> pvInsertOrAssign(Hint hint, RKey&& key, MappedArg&& mappedArg)
966 std::pair<iterator, bool> res = pvEmplace(hint,
967 std::forward_as_tuple(std::forward<RKey>(key)),
968 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
970 res.first->second = std::forward<MappedArg>(mappedArg);
987 template<
typename TKey,
typename TMapped,
988 typename THashFunc = HashCoder<TKey>,
989 typename TEqualFunc = std::equal_to<TKey>,
990 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
992 HashMap<TKey, TMapped, HashTraitsStd<TKey, THashFunc, TEqualFunc, HashBucketOpenDefault>,
993 MemManagerStd<TAllocator>>>
996 typedef unordered_map<TKey, TMapped, THashFunc, TEqualFunc, TAllocator,
1008 using UnorderedMap::UnorderedMap;
1023 template<
typename ValueFilter>
1028 return cont.get_nested_container().Remove(pairFilter);
1032 #ifdef MOMO_HAS_DEDUCTION_GUIDES
1034 #define MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map) \
1035 template<typename Iterator, \
1036 typename Key = std::remove_const_t<typename std::iterator_traits<Iterator>::value_type::first_type>, \
1037 typename Mapped = typename std::iterator_traits<Iterator>::value_type::second_type> \
1038 unordered_map(Iterator, Iterator) \
1039 -> unordered_map<Key, Mapped>; \
1040 template<typename Iterator, \
1041 typename Key = std::remove_const_t<typename std::iterator_traits<Iterator>::value_type::first_type>, \
1042 typename Mapped = typename std::iterator_traits<Iterator>::value_type::second_type, \
1043 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1044 typename = decltype(std::declval<Allocator&>().allocate(size_t{}))> \
1045 unordered_map(Iterator, Iterator, size_t, Allocator = Allocator()) \
1046 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1047 template<typename Iterator, typename HashFunc, \
1048 typename Key = std::remove_const_t<typename std::iterator_traits<Iterator>::value_type::first_type>, \
1049 typename Mapped = typename std::iterator_traits<Iterator>::value_type::second_type, \
1050 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1051 typename = decltype(std::declval<HashFunc&>()(std::declval<const Key&>())), \
1052 typename = decltype(std::declval<Allocator&>().allocate(size_t{}))> \
1053 unordered_map(Iterator, Iterator, size_t, HashFunc, Allocator = Allocator()) \
1054 -> unordered_map<Key, Mapped, HashFunc, std::equal_to<Key>, Allocator>; \
1055 template<typename Iterator, typename HashFunc, typename EqualFunc, \
1056 typename Key = std::remove_const_t<typename std::iterator_traits<Iterator>::value_type::first_type>, \
1057 typename Mapped = typename std::iterator_traits<Iterator>::value_type::second_type, \
1058 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1059 typename = decltype(std::declval<HashFunc&>()(std::declval<const Key&>())), \
1060 typename = decltype(std::declval<EqualFunc&>()(std::declval<const Key&>(), std::declval<const Key&>()))> \
1061 unordered_map(Iterator, Iterator, size_t, HashFunc, EqualFunc, Allocator = Allocator()) \
1062 -> unordered_map<Key, Mapped, HashFunc, EqualFunc, Allocator>; \
1063 template<typename Key, typename Mapped> \
1064 unordered_map(std::initializer_list<std::pair<Key, Mapped>>) \
1065 -> unordered_map<Key, Mapped>; \
1066 template<typename Key, typename Mapped, \
1067 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1068 typename = decltype(std::declval<Allocator&>().allocate(size_t{}))> \
1069 unordered_map(std::initializer_list<std::pair<Key, Mapped>>, size_t, Allocator = Allocator()) \
1070 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1071 template<typename Key, typename Mapped, typename HashFunc, \
1072 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1073 typename = decltype(std::declval<HashFunc&>()(std::declval<const Key&>())), \
1074 typename = decltype(std::declval<Allocator&>().allocate(size_t{}))> \
1075 unordered_map(std::initializer_list<std::pair<Key, Mapped>>, size_t, HashFunc, Allocator = Allocator()) \
1076 -> unordered_map<Key, Mapped, HashFunc, std::equal_to<Key>, Allocator>; \
1077 template<typename Key, typename Mapped, typename HashFunc, typename EqualFunc, \
1078 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1079 typename = decltype(std::declval<HashFunc&>()(std::declval<const Key&>())), \
1080 typename = decltype(std::declval<EqualFunc&>()(std::declval<const Key&>(), std::declval<const Key&>()))> \
1081 unordered_map(std::initializer_list<std::pair<Key, Mapped>>, size_t, HashFunc, EqualFunc, Allocator = Allocator()) \
1082 -> unordered_map<Key, Mapped, HashFunc, EqualFunc, Allocator>;
1084 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map)
1085 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map_open)
1087 #undef MOMO_DECLARE_DEDUCTION_GUIDES
1089 #endif // MOMO_HAS_DEDUCTION_GUIDES
1095 #endif // MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
Definition: ObjectManager.h:196
unordered_map(const unordered_map &right)
Definition: unordered_map.h:235
Position position
Definition: IteratorUtility.h:183
iterator end() noexcept
Definition: unordered_map.h:318
static const size_t maxSize
Definition: Utility.h:384
size_t size_type
Definition: unordered_map.h:79
allocator_type get_allocator() const noexcept
Definition: unordered_map.h:361
TReference< typename BaseIterator::Reference > Reference
Definition: IteratorUtility.h:396
std::pair< iterator, bool > emplace(std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:606
HashMap nested_container_type
Definition: unordered_map.h:77
momo::stdish::map is similar to std::map, but much more efficient in memory usage....
Definition: map.h:869
MOMO_FORCEINLINE HashMap::ValueReferenceCKey operator[](const key_type &key)
Definition: unordered_map.h:664
float max_load_factor() const noexcept
Definition: unordered_map.h:333
HashMapIterator< typename HashSetBucketBounds::Iterator, isConst > Iterator
Definition: HashMap.h:219
local_iterator begin(size_type bucketIndex)
Definition: unordered_map.h:770
iterator insert_or_assign(const_iterator hint, key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:720
friend void swap(unordered_map &left, unordered_map &right) noexcept
Definition: unordered_map.h:288
iterator emplace_hint(const_iterator hint, std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:613
Definition: MapUtility.h:1004
unordered_map(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:185
ValueReferencer::template ValueReference< const Key & > ValueReferenceCKey
Definition: HashMap.h:406
const nested_container_type & get_nested_container() const noexcept
Definition: unordered_map.h:293
momo::internal::HashDerivedIterator< HashMapIterator, momo::internal::MapReferenceStd > iterator
Definition: unordered_map.h:85
iterator emplace_hint(const_iterator hint, KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:599
iterator erase(const_iterator first, const_iterator last)
Definition: unordered_map.h:629
internal::insert_return_type< iterator, node_type > insert_return_type
Definition: unordered_map.h:97
unordered_map(std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:211
Definition: node_handle.h:190
momo::stdish::unordered_map_open is similar to std::unordered_map, but much more efficient in operati...
Definition: unordered_map.h:994
internal::InsertResult< Position > InsertResult
Definition: HashMap.h:392
static UInt Log2(UInt value) noexcept
Definition: Utility.h:322
iterator try_emplace(const_iterator hint, const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:707
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< iterator, iterator > > equal_range(const KeyArg &key)
Definition: unordered_map.h:466
iterator try_emplace(const_iterator hint, key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:693
iterator erase(iterator where)
Definition: unordered_map.h:624
std::pair< const key_type, mapped_type > value_type
Definition: unordered_map.h:82
key_equal key_eq() const
Definition: unordered_map.h:356
Definition: HashMap.h:363
MemManagerStd uses allocator<unsigned char>::allocate and deallocate
Definition: MemManager.h:176
void swap(unordered_map &right) noexcept
Definition: unordered_map.h:281
const_local_iterator cend(size_type bucketIndex) const
Definition: unordered_map.h:795
const_iterator::Reference const_reference
Definition: unordered_map.h:89
iterator insert_or_assign(const_iterator hint, const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:732
TMapped mapped_type
Definition: unordered_map.h:72
float load_factor() const noexcept
Definition: unordered_map.h:805
iterator begin() noexcept
Definition: unordered_map.h:308
unordered_map_open & operator=(std::initializer_list< value_type > values)
Definition: unordered_map.h:1012
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< const_iterator, const_iterator > > equal_range(const KeyArg &key) const
Definition: unordered_map.h:459
unordered_map & operator=(const unordered_map &right)
Definition: unordered_map.h:261
iterator emplace_hint(const_iterator hint)
Definition: unordered_map.h:574
Definition: IteratorUtility.h:151
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, iterator > find(const KeyArg &key)
Definition: unordered_map.h:418
TMapExtractedPair MapExtractedPair
Definition: node_handle.h:101
const_iterator::Reference const_reference
Definition: unordered_map.h:89
void merge(Map &&map)
Definition: unordered_map.h:749
MOMO_FORCEINLINE mapped_type & at(const key_type &key)
Definition: unordered_map.h:677
iterator insert(const_iterator hint, std::pair< key_type, mapped_type > &&value)
Definition: unordered_map.h:493
Definition: node_handle.h:99
unordered_map(Iterator first, Iterator last, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:177
momo::internal::EnableIf< std::is_constructible< key_type, First && >::value &&std::is_constructible< mapped_type, Second && >::value, iterator > insert(const_iterator hint, std::pair< First, Second > &&value)
Definition: unordered_map.h:529
typename std::enable_if< value, Type >::type EnableIf
Definition: Utility.h:174
MOMO_FORCEINLINE bool contains(const key_type &key) const
Definition: unordered_map.h:435
size_type bucket_count() const noexcept
Definition: unordered_map.h:760
local_iterator end(size_type bucketIndex)
Definition: unordered_map.h:780
unordered_map(size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:164
unordered_map(const allocator_type &alloc)
Definition: unordered_map.h:148
MOMO_FORCEINLINE HashMap::ValueReferenceRKey operator[](key_type &&key)
Definition: unordered_map.h:659
momo::stdish::unordered_map is similar to std::unordered_map, but much more efficient in memory usage...
Definition: unordered_map.h:62
unordered_map(const unordered_map &right, const momo::internal::Identity< allocator_type > &alloc)
Definition: unordered_map.h:240
TKey key_type
Definition: unordered_map.h:71
std::pair< iterator, bool > emplace(KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:592
MOMO_NODISCARD bool empty() const noexcept
Definition: unordered_map.h:376
momo::internal::EnableIf< std::is_constructible< key_type, const First & >::value &&std::is_constructible< mapped_type, const Second & >::value, iterator > insert(const_iterator hint, const std::pair< First, Second > &value)
Definition: unordered_map.h:511
unordered_map(Iterator first, Iterator last)
Definition: unordered_map.h:171
Definition: IteratorUtility.h:279
size_type bucket_size(size_type bucketIndex) const
Definition: unordered_map.h:765
bool inserted
Definition: IteratorUtility.h:186
unordered_map(unordered_map &&right) noexcept
Definition: unordered_map.h:224
EnableIf< true, Type > Identity
Definition: Utility.h:177
std::pair< iterator, bool > insert(std::pair< key_type, mapped_type > &&value)
Definition: unordered_map.h:487
ptrdiff_t difference_type
Definition: unordered_map.h:80
momo::internal::EnableIf< std::is_constructible< key_type, First && >::value &&std::is_constructible< mapped_type, Second && >::value, std::pair< iterator, bool > > insert(std::pair< First, Second > &&value)
Definition: unordered_map.h:520
size_type max_bucket_count() const noexcept
Definition: unordered_map.h:754
unordered_map(size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:153
size_t size_type
Definition: unordered_map.h:79
TBaseIterator BaseIterator
Definition: IteratorUtility.h:393
momo::internal::EnableIf< std::is_constructible< key_type, const First & >::value &&std::is_constructible< mapped_type, const Second & >::value, std::pair< iterator, bool > > insert(const std::pair< First, Second > &value)
Definition: unordered_map.h:502
void max_load_factor(float maxLoadFactor)
Definition: unordered_map.h:338
std::pair< iterator, bool > try_emplace(key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:686
const_local_iterator cbegin(size_type bucketIndex) const
Definition: unordered_map.h:790
THashTraits HashTraits
Definition: HashMap.h:367
const_iterator begin() const noexcept
Definition: unordered_map.h:303
unordered_map & operator=(std::initializer_list< value_type > values)
Definition: unordered_map.h:273
iterator::Reference reference
Definition: unordered_map.h:88
internal::map_node_handle< typename HashMap::ExtractedPair > node_type
Definition: unordered_map.h:96
bool operator!=(const unordered_map &right) const
Definition: unordered_map.h:829
#define MOMO_DECLARE_PROXY_CONSTRUCTOR(Object)
Definition: Utility.h:85
MOMO_FORCEINLINE const mapped_type & at(const key_type &key) const
Definition: unordered_map.h:669
void insert(Iterator first, Iterator last)
Definition: unordered_map.h:559
static const size_t bucketMaxItemCount
Definition: HashMap.h:399
friend void swap(unordered_map_open &left, unordered_map_open &right) noexcept
Definition: unordered_map.h:1018
iterator erase(const_iterator where)
Definition: unordered_map.h:619
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, bool > contains(const KeyArg &key) const
Definition: unordered_map.h:442
MOMO_FORCEINLINE size_type count(const key_type &key) const
Definition: unordered_map.h:423
const_local_iterator begin(size_type bucketIndex) const
Definition: unordered_map.h:775
void insert(std::initializer_list< value_type > values)
Definition: unordered_map.h:564
Definition: IteratorUtility.h:391
iterator emplace_hint(const_iterator hint, ValueArg &&valueArg)
Definition: unordered_map.h:586
size_type bucket(const key_type &key) const
Definition: unordered_map.h:800
hasher hash_function() const
Definition: unordered_map.h:351
friend size_type erase_if(unordered_map &cont, const ValueFilter &valueFilter)
Definition: unordered_map.h:652
THashFunc hasher
Definition: unordered_map.h:73
unordered_map(std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:217
momo::internal::HashDerivedIterator< typename HashMap::BucketBounds::Iterator, momo::internal::MapReferenceStd > local_iterator
Definition: unordered_map.h:100
MOMO_FORCEINLINE const_iterator find(const key_type &key) const
Definition: unordered_map.h:399
Definition: ObjectManager.h:161
std::pair< iterator, bool > emplace()
Definition: unordered_map.h:569
TKey key_type
Definition: unordered_map.h:71
unordered_map(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const key_equal &equalFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:193
const_iterator end() const noexcept
Definition: unordered_map.h:313
MOMO_FORCEINLINE std::pair< iterator, iterator > equal_range(const key_type &key)
Definition: unordered_map.h:452
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, size_type > count(const KeyArg &key) const
Definition: unordered_map.h:430
Definition: ArrayUtility.h:299
iterator::ConstIterator const_iterator
Definition: unordered_map.h:86
void clear() noexcept
Definition: unordered_map.h:381
#define MOMO_FORCEINLINE
Definition: UserSettings.h:114
bool operator==(const unordered_map &right) const
Definition: unordered_map.h:814
unordered_map(std::initializer_list< value_type > values, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:205
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > find(const KeyArg &key) const
Definition: unordered_map.h:411
const_iterator cbegin() const noexcept
Definition: unordered_map.h:323
unordered_map()
Definition: unordered_map.h:144
MOMO_FORCEINLINE std::pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition: unordered_map.h:447
node_type extract(const_iterator where)
Definition: unordered_map.h:737
size_type size() const noexcept
Definition: unordered_map.h:371
std::pair< iterator, bool > insert_or_assign(key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:714
TMapped mapped_type
Definition: unordered_map.h:72
internal::HashMapPosition< HashSetConstPosition > Position
Definition: HashMap.h:389
std::pair< iterator, bool > try_emplace(const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:700
friend size_type erase_if(unordered_map_open &cont, const ValueFilter &valueFilter)
Definition: unordered_map.h:1024
unordered_map & operator=(unordered_map &&right) noexcept(std::is_empty< allocator_type >::value||std::allocator_traits< allocator_type >::propagate_on_container_move_assignment::value)
Definition: unordered_map.h:247
node_type extract(const key_type &key)
Definition: unordered_map.h:742
unordered_map(unordered_map &&right, const momo::internal::Identity< allocator_type > &alloc) noexcept(std::is_empty< allocator_type >::value)
Definition: unordered_map.h:229
unordered_map(size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:158
const_local_iterator end(size_type bucketIndex) const
Definition: unordered_map.h:785
TMemManager MemManager
Definition: HashMap.h:368
ValueReferencer::template ValueReference< Key && > ValueReferenceRKey
Definition: HashMap.h:405
nested_container_type & get_nested_container() noexcept
Definition: unordered_map.h:298
unordered_map(std::initializer_list< value_type > values)
Definition: unordered_map.h:200
local_iterator::ConstIterator const_local_iterator
Definition: unordered_map.h:101
TAllocator allocator_type
Definition: unordered_map.h:75
std::pair< iterator, bool > insert_or_assign(const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:726
void reserve(size_type count)
Definition: unordered_map.h:394
size_type erase(const key_type &key)
Definition: unordered_map.h:646
std::pair< iterator, bool > emplace(ValueArg &&valueArg)
Definition: unordered_map.h:580
iterator::Pointer pointer
Definition: unordered_map.h:91
#define MOMO_ASSERT(expr)
Definition: UserSettings.h:162
const_iterator::Pointer const_pointer
Definition: unordered_map.h:92
#define MOMO_DECLARE_PROXY_FUNCTION(Object, Func, Result)
Definition: Utility.h:94
insert_return_type insert(node_type &&node)
Definition: unordered_map.h:535
#define MOMO_NODISCARD
Definition: UserSettings.h:192
const_iterator cend() const noexcept
Definition: unordered_map.h:328
MOMO_FORCEINLINE iterator find(const key_type &key)
Definition: unordered_map.h:404
void rehash(size_type bucketCount)
Definition: unordered_map.h:386
iterator insert(const_iterator hint, node_type &&node)
Definition: unordered_map.h:545
TEqualFunc key_equal
Definition: unordered_map.h:74
size_type max_size() const noexcept
Definition: unordered_map.h:366
unordered_map_open()
Definition: unordered_map.h:1010
Definition: MapUtility.h:68