Go to the documentation of this file.
17 #ifndef MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
18 #define MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
21 # if __has_include(<momo/Utility.h>)
25 #ifndef MOMO_PARENT_HEADER
26 # include "../Utility.h"
29 #include MOMO_PARENT_HEADER(HashMap)
64 template<
typename TKey,
typename TMapped,
65 typename THasher = HashCoder<TKey>,
66 typename TEqualComparer = std::equal_to<TKey>,
67 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>,
68 typename THashMap = HashMap<TKey, TMapped, HashTraitsStd<TKey, THasher, TEqualComparer>,
69 MemManagerStd<TAllocator>>>
73 typedef THashMap HashMap;
91 typedef std::pair<const key_type, mapped_type>
value_type;
113 template<
typename KeyArg>
114 struct IsValidKeyArg :
public HashTraits::template IsValidKeyArg<KeyArg>
125 struct IteratorProxy :
public iterator
156 : mHashMap(HashTraits(), MemManager(alloc))
161 : mHashMap(HashTraits(bucketCount), MemManager(alloc))
167 : mHashMap(HashTraits(bucketCount, hashFunc), MemManager(alloc))
173 : mHashMap(HashTraits(bucketCount, hashFunc, equalComp), MemManager(alloc))
177 template<
typename Iterator>
183 template<
typename Iterator>
191 template<
typename Iterator>
199 template<
typename Iterator>
231 #ifdef MOMO_HAS_CONTAINERS_RANGES
232 template<std::ranges::input_range Range>
233 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
236 insert_range(std::forward<Range>(values));
239 template<std::ranges::input_range Range>
240 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
245 insert_range(std::forward<Range>(values));
248 template<std::ranges::input_range Range>
249 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
254 insert_range(std::forward<Range>(values));
257 template<std::ranges::input_range Range>
258 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
263 insert_range(std::forward<Range>(values));
265 #endif // MOMO_HAS_CONTAINERS_RANGES
273 : mHashMap(right.mHashMap.GetHashTraits(), MemManager(alloc))
275 if (right.get_allocator() == alloc)
277 mHashMap.Swap(right.mHashMap);
281 mHashMap.MergeFrom(right.mHashMap);
287 : mHashMap(right.mHashMap)
292 : mHashMap(right.mHashMap, MemManager(alloc))
311 mHashMap = HashMap(values, mHashMap.GetHashTraits(), MemManager(
get_allocator()));
337 return ConstIteratorProxy(mHashMap.GetBegin());
342 return IteratorProxy(mHashMap.GetBegin());
347 return ConstIteratorProxy(mHashMap.GetEnd());
352 return IteratorProxy(mHashMap.GetEnd());
375 throw std::out_of_range(
"invalid load factor");
376 HashTraits hashTraits(mHashMap.GetHashTraits(), maxLoadFactor);
378 hashMap.Reserve(
size());
380 mHashMap = std::move(hashMap);
385 return mHashMap.GetHashTraits().GetHasher();
390 return mHashMap.GetHashTraits().GetEqualComparer();
395 return allocator_type(mHashMap.GetMemManager().GetByteAllocator());
400 return std::allocator_traits<allocator_type>::max_size(
get_allocator());
405 return mHashMap.GetCount();
410 return mHashMap.IsEmpty();
420 bucketCount = std::minmax(bucketCount,
size_t{2}).second;
422 bucketCount =
size_t{1} << logBucketCount;
428 mHashMap.Reserve(
count);
433 return ConstIteratorProxy(mHashMap.Find(key));
438 return IteratorProxy(mHashMap.Find(key));
441 template<
typename KeyArg>
445 return ConstIteratorProxy(mHashMap.Find(key));
448 template<
typename KeyArg>
452 return IteratorProxy(mHashMap.Find(key));
460 template<
typename KeyArg>
469 return mHashMap.ContainsKey(key);
472 template<
typename KeyArg>
476 return mHashMap.ContainsKey(key);
489 template<
typename KeyArg>
491 std::pair<const_iterator, const_iterator>>
equal_range(
const KeyArg& key)
const
496 template<
typename KeyArg>
503 template<
typename ValueArg = std::pair<key_type, mapped_type>>
505 std::pair<iterator, bool>>
insert(ValueArg&& valueArg)
507 return emplace(std::forward<ValueArg>(valueArg));
510 template<
typename ValueArg = std::pair<key_type, mapped_type>>
514 return emplace_hint(hint, std::forward<ValueArg>(valueArg));
522 std::move(NodeTypeProxy::GetExtractedPair(node)));
529 #ifdef MOMO_USE_UNORDERED_HINT_ITERATORS
532 return IteratorProxy(mHashMap.Add(ConstIteratorProxy::GetBaseIterator(hint),
533 std::move(NodeTypeProxy::GetExtractedPair(node))));
536 return insert(std::move(node)).position;
540 template<
typename Iterator>
541 void insert(Iterator first, Iterator last)
543 pvInsertRange(first, last);
546 void insert(std::initializer_list<value_type> values)
548 mHashMap.Insert(values.begin(), values.end());
551 #ifdef MOMO_HAS_CONTAINERS_RANGES
552 template<std::ranges::input_range Range>
553 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
554 void insert_range(Range&& values)
556 pvInsertRange(std::ranges::begin(values), std::ranges::end(values));
558 #endif // MOMO_HAS_CONTAINERS_RANGES
562 return pvEmplace(
nullptr, std::tuple<>(), std::tuple<>());
567 return pvEmplace(hint, std::tuple<>(), std::tuple<>()).first;
570 template<
typename ValueArg>
571 std::pair<iterator, bool>
emplace(ValueArg&& valueArg)
573 return pvEmplace(
nullptr,
574 std::forward_as_tuple(std::get<0>(std::forward<ValueArg>(valueArg))),
575 std::forward_as_tuple(std::get<1>(std::forward<ValueArg>(valueArg))));
578 template<
typename ValueArg>
581 return pvEmplace(hint,
582 std::forward_as_tuple(std::get<0>(std::forward<ValueArg>(valueArg))),
583 std::forward_as_tuple(std::get<1>(std::forward<ValueArg>(valueArg)))).first;
586 template<
typename KeyArg,
typename MappedArg>
587 std::pair<iterator, bool>
emplace(KeyArg&& keyArg, MappedArg&& mappedArg)
589 return pvEmplace(
nullptr, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
590 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
593 template<
typename KeyArg,
typename MappedArg>
596 return pvEmplace(hint, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
597 std::forward_as_tuple(std::forward<MappedArg>(mappedArg))).first;
600 template<
typename... KeyArgs,
typename... MappedArgs>
601 std::pair<iterator, bool>
emplace(std::piecewise_construct_t,
602 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
604 return pvEmplace(
nullptr, std::move(keyArgs), std::move(mappedArgs));
607 template<
typename... KeyArgs,
typename... MappedArgs>
609 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
611 return pvEmplace(hint, std::move(keyArgs), std::move(mappedArgs)).first;
616 return IteratorProxy(mHashMap.Remove(ConstIteratorProxy::GetBaseIterator(where)));
626 if (first ==
begin() && last ==
end())
633 return IteratorProxy(mHashMap.MakeMutableIterator(
634 ConstIteratorProxy::GetBaseIterator(first)));
636 if (first !=
end() && std::next(first) == last)
638 throw std::invalid_argument(
"invalid unordered_map erase arguments");
643 return mHashMap.Remove(key) ? 1 : 0;
646 template<
typename ValueFilter>
651 return cont.mHashMap.Remove(pairFilter);
656 return mHashMap[std::move(key)];
661 return mHashMap[key];
668 throw std::out_of_range(
"invalid unordered_map key");
676 throw std::out_of_range(
"invalid unordered_map key");
680 template<
typename... MappedArgs>
683 return pvEmplace(
nullptr, std::forward_as_tuple(std::move(key)),
684 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
687 template<
typename... MappedArgs>
690 return pvEmplace(hint, std::forward_as_tuple(std::move(key)),
691 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
694 template<
typename... MappedArgs>
697 return pvEmplace(
nullptr, std::forward_as_tuple(key),
698 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
701 template<
typename... MappedArgs>
704 return pvEmplace(hint, std::forward_as_tuple(key),
705 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
708 template<
typename MappedArg>
711 return pvInsertOrAssign(
nullptr, std::move(key), std::forward<MappedArg>(mappedArg));
714 template<
typename MappedArg>
717 return pvInsertOrAssign(hint, std::move(key), std::forward<MappedArg>(mappedArg)).first;
720 template<
typename MappedArg>
723 return pvInsertOrAssign(
nullptr, key, std::forward<MappedArg>(mappedArg));
726 template<
typename MappedArg>
729 return pvInsertOrAssign(hint, key, std::forward<MappedArg>(mappedArg)).first;
743 template<
typename Map>
746 mHashMap.MergeFrom(
map.get_nested_container());
757 return mHashMap.GetBucketCount();
762 return mHashMap.GetBucketBounds(bucketIndex).GetCount();
767 return LocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetBegin());
772 return ConstLocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetBegin());
777 return LocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetEnd());
782 return ConstLocalIteratorProxy(mHashMap.GetBucketBounds(bucketIndex).GetEnd());
787 return begin(bucketIndex);
792 return end(bucketIndex);
797 return mHashMap.GetBucketIndex(key);
804 if (
count == 0 && bucketCount == 0)
806 return static_cast<float>(
count) /
static_cast<float>(bucketCount);
816 if (iter == right.
end())
818 if (!(iter->second == ref.second))
826 return !(left == right);
830 template<
typename Hint,
typename... KeyArgs,
typename... MappedArgs>
831 std::pair<iterator, bool> pvEmplace(Hint hint, std::tuple<KeyArgs...>&& keyArgs,
832 std::tuple<MappedArgs...>&& mappedArgs)
834 typedef typename HashMap::KeyValueTraits
835 ::template ValueCreator<MappedArgs...> MappedCreator;
836 return pvInsert(hint, std::move(keyArgs),
837 MappedCreator(mHashMap.GetMemManager(), std::move(mappedArgs)));
840 template<
typename Hint,
typename... KeyArgs,
typename MappedCreator>
841 std::pair<iterator, bool> pvInsert(Hint , std::tuple<KeyArgs...>&& keyArgs,
842 MappedCreator&& mappedCreator)
844 MemManager& memManager = mHashMap.GetMemManager();
847 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
849 KeyCreator(memManager, std::move(keyArgs))(keyBuffer.GetPtr());
850 key_type* keyPtr = keyBuffer.template GetPtr<true>();
856 KeyManager::Destroy(memManager, *keyPtr);
858 return { IteratorProxy(pos),
false };
860 auto valueCreator = [&memManager, &keyPtr, &mappedCreator]
863 KeyManager::Relocate(memManager, *keyPtr, newKey);
867 std::forward<MappedCreator>(mappedCreator)(newMapped);
871 KeyManager::Destroy(memManager, *newKey);
876 return { IteratorProxy(resPos),
true };
880 if (keyPtr !=
nullptr)
881 KeyManager::Destroy(memManager, *keyPtr);
886 template<
typename Hint,
typename RKey,
typename MappedCreator,
887 typename Key =
typename std::decay<RKey>::type>
889 std::pair<iterator, bool>> pvInsert(Hint , std::tuple<RKey>&& key,
890 MappedCreator&& mappedCreator)
893 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
894 return { IteratorProxy(res.position), res.inserted };
897 #ifdef MOMO_USE_UNORDERED_HINT_ITERATORS
898 template<
typename... KeyArgs,
typename MappedCreator>
899 std::pair<iterator, bool> pvInsert(
const_iterator hint, std::tuple<KeyArgs...>&& keyArgs,
900 MappedCreator&& mappedCreator)
902 MemManager& memManager = mHashMap.GetMemManager();
904 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
905 auto valueCreator = [&memManager, &keyArgs, &mappedCreator]
908 KeyCreator(memManager, std::move(keyArgs))(newKey);
911 std::forward<MappedCreator>(mappedCreator)(newMapped);
915 KeyManager::Destroy(memManager, *newKey);
920 ConstIteratorProxy::GetBaseIterator(hint), valueCreator);
921 return { IteratorProxy(resPos),
true };
924 template<
typename RKey,
typename MappedCreator,
925 typename Key =
typename std::decay<RKey>::type>
927 std::pair<iterator, bool>> pvInsert(
const_iterator hint, std::tuple<RKey>&& key,
928 MappedCreator&& mappedCreator)
930 typename HashMap::Position resPos = mHashMap.AddCrt(ConstIteratorProxy::GetBaseIterator(hint),
931 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
932 return { IteratorProxy(resPos),
true };
934 #endif // MOMO_USE_UNORDERED_HINT_ITERATORS
936 template<
typename Iterator,
typename Sentinel>
938 void> pvInsertRange(Iterator
begin, Sentinel
end)
940 mHashMap.Insert(std::move(
begin), std::move(
end));
943 template<
typename Iterator,
typename Sentinel>
945 void> pvInsertRange(Iterator
begin, Sentinel
end)
947 for (Iterator iter = std::move(
begin); iter !=
end; ++iter)
951 template<
typename H
int,
typename RKey,
typename MappedArg>
952 std::pair<iterator, bool> pvInsertOrAssign(Hint hint, RKey&& key, MappedArg&& mappedArg)
954 std::pair<iterator, bool> res = pvEmplace(hint,
955 std::forward_as_tuple(std::forward<RKey>(key)),
956 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
958 res.first->second = std::forward<MappedArg>(mappedArg);
975 template<
typename TKey,
typename TMapped,
976 typename THasher = HashCoder<TKey>,
977 typename TEqualComparer = std::equal_to<TKey>,
978 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
980 HashMap<TKey, TMapped, HashTraitsStd<TKey, THasher, TEqualComparer, HashBucketOpenDefault>,
981 MemManagerStd<TAllocator>>>
984 typedef unordered_map<TKey, TMapped, THasher, TEqualComparer, TAllocator,
996 using UnorderedMap::UnorderedMap;
1009 template<
typename ValueFilter>
1014 return cont.get_nested_container().Remove(pairFilter);
1018 #ifdef MOMO_HAS_DEDUCTION_GUIDES
1020 #define MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map) \
1021 template<typename Iterator, \
1022 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1023 typename Key = std::decay_t<typename Value::first_type>, \
1024 typename Mapped = std::decay_t<typename Value::second_type>> \
1025 unordered_map(Iterator, Iterator) \
1026 -> unordered_map<Key, Mapped>; \
1027 template<typename Iterator, \
1028 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1029 typename Key = std::decay_t<typename Value::first_type>, \
1030 typename Mapped = std::decay_t<typename Value::second_type>, \
1031 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1032 typename = internal::unordered_checker<Key, Allocator, HashCoder<Key>>> \
1033 unordered_map(Iterator, Iterator, size_t, Allocator = Allocator()) \
1034 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1035 template<typename Iterator, typename Hasher, \
1036 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1037 typename Key = std::decay_t<typename Value::first_type>, \
1038 typename Mapped = std::decay_t<typename Value::second_type>, \
1039 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1040 typename = internal::unordered_checker<Key, Allocator, Hasher>> \
1041 unordered_map(Iterator, Iterator, size_t, Hasher, Allocator = Allocator()) \
1042 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1043 template<typename Iterator, typename Hasher, typename EqualComparer, \
1044 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1045 typename Key = std::decay_t<typename Value::first_type>, \
1046 typename Mapped = std::decay_t<typename Value::second_type>, \
1047 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1048 typename = internal::unordered_checker<Key, Allocator, Hasher, EqualComparer>> \
1049 unordered_map(Iterator, Iterator, size_t, Hasher, EqualComparer, Allocator = Allocator()) \
1050 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>; \
1051 template<typename QKey, typename Mapped, \
1052 typename Key = std::remove_const_t<QKey>> \
1053 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>) \
1054 -> unordered_map<Key, Mapped>; \
1055 template<typename QKey, typename Mapped, \
1056 typename Key = std::remove_const_t<QKey>, \
1057 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1058 typename = internal::unordered_checker<Key, Allocator, HashCoder<Key>>> \
1059 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, Allocator = Allocator()) \
1060 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1061 template<typename QKey, typename Mapped, typename Hasher, \
1062 typename Key = std::remove_const_t<QKey>, \
1063 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1064 typename = internal::unordered_checker<Key, Allocator, Hasher>> \
1065 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, Hasher, Allocator = Allocator()) \
1066 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1067 template<typename QKey, typename Mapped, typename Hasher, typename EqualComparer, \
1068 typename Key = std::remove_const_t<QKey>, \
1069 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1070 typename = internal::unordered_checker<Key, Allocator, Hasher, EqualComparer>> \
1071 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, Hasher, EqualComparer, Allocator = Allocator()) \
1072 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>;
1074 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map)
1075 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map_open)
1077 #undef MOMO_DECLARE_DEDUCTION_GUIDES
1079 #ifdef MOMO_HAS_CONTAINERS_RANGES
1081 #define MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map) \
1082 template<std::ranges::input_range Range, \
1083 typename Value = std::ranges::range_value_t<Range>, \
1084 typename Key = std::decay_t<typename Value::first_type>, \
1085 typename Mapped = std::decay_t<typename Value::second_type>> \
1086 unordered_map(std::from_range_t, Range&&) \
1087 -> unordered_map<Key, Mapped>; \
1088 template<std::ranges::input_range Range, \
1089 typename Value = std::ranges::range_value_t<Range>, \
1090 typename Key = std::decay_t<typename Value::first_type>, \
1091 typename Mapped = std::decay_t<typename Value::second_type>, \
1092 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1093 typename = internal::unordered_checker<Key, Allocator, HashCoder<Key>>> \
1094 unordered_map(std::from_range_t, Range&&, size_t, Allocator = Allocator()) \
1095 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1096 template<std::ranges::input_range Range, typename Hasher, \
1097 typename Value = std::ranges::range_value_t<Range>, \
1098 typename Key = std::decay_t<typename Value::first_type>, \
1099 typename Mapped = std::decay_t<typename Value::second_type>, \
1100 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1101 typename = internal::unordered_checker<Key, Allocator, Hasher>> \
1102 unordered_map(std::from_range_t, Range&&, size_t, Hasher, Allocator = Allocator()) \
1103 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1104 template<std::ranges::input_range Range, typename Hasher, typename EqualComparer, \
1105 typename Value = std::ranges::range_value_t<Range>, \
1106 typename Key = std::decay_t<typename Value::first_type>, \
1107 typename Mapped = std::decay_t<typename Value::second_type>, \
1108 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1109 typename = internal::unordered_checker<Key, Allocator, Hasher, EqualComparer>> \
1110 unordered_map(std::from_range_t, Range&&, size_t, Hasher, EqualComparer, Allocator = Allocator()) \
1111 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>;
1113 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map)
1114 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map_open)
1116 #undef MOMO_DECLARE_DEDUCTION_GUIDES_RANGES
1118 #endif // MOMO_HAS_CONTAINERS_RANGES
1120 #endif // MOMO_HAS_DEDUCTION_GUIDES
1126 #endif // MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
unordered_map(std::initializer_list< momo::internal::Identity< value_type >> values, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:218
Definition: ObjectManager.h:240
Definition: HashMap.h:104
Position position
Definition: IteratorUtility.h:168
node_type extract(const_iterator where)
Definition: unordered_map.h:732
static const size_t maxSize
Definition: Utility.h:457
std::pair< iterator, bool > emplace(KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:587
const_local_iterator begin(size_type bucketIndex) const
Definition: unordered_map.h:770
size_type erase(const key_type &key)
Definition: unordered_map.h:641
momo::internal::HashDerivedIterator< typename HashMap::BucketBounds::Iterator, momo::internal::MapReferenceStd > local_iterator
Definition: unordered_map.h:109
TReference< typename BaseIterator::Reference > Reference
Definition: IteratorUtility.h:381
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, size_type > count(const KeyArg &key) const
Definition: unordered_map.h:462
momo::stdish::map is similar to std::map, but much more efficient in memory usage....
Definition: map.h:824
HashMapIterator< typename HashSetBucketBounds::Iterator, isConst > Iterator
Definition: HashMap.h:218
MOMO_FORCEINLINE HashMap::ValueReferenceCKey operator[](const key_type &key)
Definition: unordered_map.h:659
MOMO_FORCEINLINE size_type count(const key_type &key) const
Definition: unordered_map.h:455
unordered_map(std::initializer_list< momo::internal::Identity< value_type >> values, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:212
friend void swap(unordered_map &left, unordered_map &right) noexcept
Definition: unordered_map.h:320
unordered_map & operator=(unordered_map &&right) noexcept(momo::internal::ContainerAssignerStd::IsNothrowMoveAssignable< unordered_map >::value)
Definition: unordered_map.h:298
void max_load_factor(float maxLoadFactor)
Definition: unordered_map.h:370
size_type max_bucket_count() const noexcept
Definition: unordered_map.h:749
float max_load_factor() const noexcept
Definition: unordered_map.h:365
local_iterator begin(size_type bucketIndex)
Definition: unordered_map.h:765
std::pair< const key_type, mapped_type > value_type
Definition: unordered_map.h:91
const_iterator cbegin() const noexcept
Definition: unordered_map.h:355
ValueReferencer::template ValueReference< const Key & > ValueReferenceCKey
Definition: HashMap.h:405
allocator_type get_allocator() const noexcept
Definition: unordered_map.h:393
unordered_map(const unordered_map &right)
Definition: unordered_map.h:286
const nested_container_type & get_nested_container() const noexcept
Definition: unordered_map.h:325
Definition: set_map_utility.h:202
momo::stdish::unordered_map_open is similar to std::unordered_map, but much more efficient in operati...
Definition: unordered_map.h:982
TMapped mapped_type
Definition: unordered_map.h:81
const_local_iterator cend(size_type bucketIndex) const
Definition: unordered_map.h:790
size_type max_size() const noexcept
Definition: unordered_map.h:398
ptrdiff_t difference_type
Definition: unordered_map.h:89
internal::InsertResult< Position > InsertResult
Definition: HashMap.h:391
void reserve(size_type count)
Definition: unordered_map.h:426
static UInt Log2(UInt value) noexcept
Definition: Utility.h:395
size_t size_type
Definition: unordered_map.h:88
iterator emplace_hint(const_iterator hint, std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:608
iterator::Reference reference
Definition: unordered_map.h:97
void merge(Map &&map)
Definition: unordered_map.h:744
unordered_map(size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:165
std::pair< iterator, bool > try_emplace(key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:681
Definition: HashMap.h:362
unordered_map()
Definition: unordered_map.h:151
MemManagerStd uses allocator<unsigned char>::allocate and deallocate
Definition: MemManager.h:177
iterator try_emplace(const_iterator hint, key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:688
size_type bucket(const key_type &key) const
Definition: unordered_map.h:795
size_type size() const noexcept
Definition: unordered_map.h:403
const_local_iterator end(size_type bucketIndex) const
Definition: unordered_map.h:780
local_iterator end(size_type bucketIndex)
Definition: unordered_map.h:775
unordered_map(unordered_map &&right)
Definition: unordered_map.h:267
TEqualComparer key_equal
Definition: unordered_map.h:83
MOMO_FORCEINLINE bool contains(const key_type &key) const
Definition: unordered_map.h:467
HashMap nested_container_type
Definition: unordered_map.h:86
TMapped mapped_type
Definition: unordered_map.h:81
std::pair< iterator, bool > insert_or_assign(key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:709
iterator::ConstIterator const_iterator
Definition: unordered_map.h:95
std::pair< iterator, bool > emplace(std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:601
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, bool > contains(const KeyArg &key) const
Definition: unordered_map.h:474
static Container & Move(Container &&srcCont, Container &dstCont) noexcept(IsNothrowMoveAssignable< Container >::value)
Definition: Utility.h:496
Definition: IteratorUtility.h:136
iterator emplace_hint(const_iterator hint)
Definition: unordered_map.h:565
const_iterator::Reference const_reference
Definition: unordered_map.h:98
iterator emplace_hint(const_iterator hint, KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:594
void swap(unordered_map &right) noexcept
Definition: unordered_map.h:315
MOMO_NODISCARD bool empty() const noexcept
Definition: unordered_map.h:408
Definition: set_map_utility.h:112
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< iterator, iterator > > equal_range(const KeyArg &key)
Definition: unordered_map.h:498
typename std::enable_if< value, Type >::type EnableIf
Definition: Utility.h:209
size_type bucket_count() const noexcept
Definition: unordered_map.h:755
MOMO_FORCEINLINE mapped_type & at(const key_type &key)
Definition: unordered_map.h:672
momo::internal::EnableIf< std::is_constructible< value_type, ValueArg && >::value, std::pair< iterator, bool > > insert(ValueArg &&valueArg)
Definition: unordered_map.h:505
iterator emplace_hint(const_iterator hint, ValueArg &&valueArg)
Definition: unordered_map.h:579
momo::stdish::unordered_map is similar to std::unordered_map, but much more efficient in memory usage...
Definition: unordered_map.h:71
iterator begin() noexcept
Definition: unordered_map.h:340
unordered_map(std::initializer_list< momo::internal::Identity< value_type >> values, size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:224
BoolConstant< std::is_empty< Allocator >::value||std::allocator_traits< Allocator >::propagate_on_container_move_assignment::value > IsNothrowMoveAssignable
Definition: Utility.h:492
std::pair< iterator, bool > try_emplace(const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:695
local_iterator::ConstIterator const_local_iterator
Definition: unordered_map.h:110
friend bool operator==(const unordered_map &left, const unordered_map &right)
Definition: unordered_map.h:809
iterator erase(const_iterator where)
Definition: unordered_map.h:614
Definition: IteratorUtility.h:264
size_type bucket_size(size_type bucketIndex) const
Definition: unordered_map.h:760
bool inserted
Definition: IteratorUtility.h:171
THasher hasher
Definition: unordered_map.h:82
EnableIf< true, Type > Identity
Definition: Utility.h:212
unordered_map_open & operator=(std::initializer_list< value_type > values)
Definition: unordered_map.h:998
const_iterator::Pointer const_pointer
Definition: unordered_map.h:101
unordered_map(const allocator_type &alloc)
Definition: unordered_map.h:155
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > find(const KeyArg &key) const
Definition: unordered_map.h:443
const_local_iterator cbegin(size_type bucketIndex) const
Definition: unordered_map.h:785
MOMO_FORCEINLINE const mapped_type & at(const key_type &key) const
Definition: unordered_map.h:664
iterator erase(iterator where)
Definition: unordered_map.h:619
void rehash(size_type bucketCount)
Definition: unordered_map.h:418
MOMO_FORCEINLINE iterator find(const key_type &key)
Definition: unordered_map.h:436
THashTraits HashTraits
Definition: HashMap.h:366
unordered_map & operator=(const unordered_map &right)
Definition: unordered_map.h:304
unordered_map(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:200
const_iterator cend() const noexcept
Definition: unordered_map.h:360
unordered_map(Iterator first, Iterator last)
Definition: unordered_map.h:178
MOMO_FORCEINLINE HashMap::ValueReferenceRKey operator[](key_type &&key)
Definition: unordered_map.h:654
hasher hash_function() const
Definition: unordered_map.h:383
iterator erase(const_iterator first, const_iterator last)
Definition: unordered_map.h:624
#define MOMO_DECLARE_PROXY_CONSTRUCTOR(Object)
Definition: Utility.h:118
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, iterator > find(const KeyArg &key)
Definition: unordered_map.h:450
iterator insert_or_assign(const_iterator hint, const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:727
const_iterator begin() const noexcept
Definition: unordered_map.h:335
void insert(std::initializer_list< value_type > values)
Definition: unordered_map.h:546
unordered_map(size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:171
static const size_t bucketMaxItemCount
Definition: HashMap.h:398
friend void swap(unordered_map_open &left, unordered_map_open &right) noexcept
Definition: unordered_map.h:1004
unordered_map(std::initializer_list< momo::internal::Identity< value_type >> values)
Definition: unordered_map.h:207
friend bool operator!=(const unordered_map &left, const unordered_map &right)
Definition: unordered_map.h:824
std::pair< iterator, bool > insert_or_assign(const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:721
Definition: IteratorUtility.h:376
unordered_map(const unordered_map &right, const momo::internal::Identity< allocator_type > &alloc)
Definition: unordered_map.h:291
TKey key_type
Definition: unordered_map.h:80
unordered_map(size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:160
friend size_type erase_if(unordered_map &cont, const ValueFilter &valueFilter)
Definition: unordered_map.h:647
#define MOMO_DECLARE_PROXY_FUNCTION(Object, Func)
Definition: Utility.h:126
const_iterator::Reference const_reference
Definition: unordered_map.h:98
node_type extract(const key_type &key)
Definition: unordered_map.h:737
Definition: ObjectManager.h:189
internal::map_node_handle< typename HashMap::ExtractedPair > node_type
Definition: unordered_map.h:105
void insert(Iterator first, Iterator last)
Definition: unordered_map.h:541
std::pair< iterator, bool > emplace(ValueArg &&valueArg)
Definition: unordered_map.h:571
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< const_iterator, const_iterator > > equal_range(const KeyArg &key) const
Definition: unordered_map.h:491
#define MOMO_FORCEINLINE
Definition: UserSettings.h:119
void clear() noexcept
Definition: unordered_map.h:413
insert_return_type insert(node_type &&node)
Definition: unordered_map.h:517
TAllocator allocator_type
Definition: unordered_map.h:84
MOMO_FORCEINLINE std::pair< iterator, iterator > equal_range(const key_type &key)
Definition: unordered_map.h:484
iterator::Pointer pointer
Definition: unordered_map.h:100
nested_container_type & get_nested_container() noexcept
Definition: unordered_map.h:330
unordered_map(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:192
TKey key_type
Definition: unordered_map.h:80
MOMO_FORCEINLINE std::pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition: unordered_map.h:479
iterator end() noexcept
Definition: unordered_map.h:350
const_iterator end() const noexcept
Definition: unordered_map.h:345
iterator try_emplace(const_iterator hint, const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:702
unordered_map & operator=(std::initializer_list< value_type > values)
Definition: unordered_map.h:309
key_equal key_eq() const
Definition: unordered_map.h:388
iterator insert_or_assign(const_iterator hint, key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:715
internal::HashMapPosition< HashSetConstPosition > Position
Definition: HashMap.h:388
MOMO_FORCEINLINE const_iterator find(const key_type &key) const
Definition: unordered_map.h:431
friend size_type erase_if(unordered_map_open &cont, const ValueFilter &valueFilter)
Definition: unordered_map.h:1010
static Container & Copy(const Container &srcCont, Container &dstCont)
Definition: Utility.h:512
std::pair< iterator, bool > emplace()
Definition: unordered_map.h:560
TMemManager MemManager
Definition: HashMap.h:367
ValueReferencer::template ValueReference< Key && > ValueReferenceRKey
Definition: HashMap.h:404
momo::internal::HashDerivedIterator< HashMapIterator, momo::internal::MapReferenceStd > iterator
Definition: unordered_map.h:94
unordered_map(Iterator first, Iterator last, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:184
static void Swap(Container &cont1, Container &cont2) noexcept
Definition: Utility.h:527
size_t size_type
Definition: unordered_map.h:88
iterator insert(const_iterator hint, node_type &&node)
Definition: unordered_map.h:527
unordered_map(unordered_map &&right, const momo::internal::Identity< allocator_type > &alloc)
Definition: unordered_map.h:272
float load_factor() const noexcept
Definition: unordered_map.h:800
#define MOMO_NODISCARD
Definition: UserSettings.h:217
internal::insert_return_type< iterator, node_type > insert_return_type
Definition: unordered_map.h:106
Definition: MapUtility.h:68
momo::internal::EnableIf< std::is_constructible< value_type, ValueArg && >::value, iterator > insert(const_iterator hint, ValueArg &&valueArg)
Definition: unordered_map.h:512