Go to the documentation of this file.
18 #ifndef MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
19 #define MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
22 #include MOMO_PARENT_HEADER(HashMap)
30 template<
typename THashMap>
34 typedef THashMap HashMap;
43 typedef typename HashTraits::Hasher
hasher;
44 typedef typename HashTraits::EqualComparer
key_equal;
51 typedef std::pair<const key_type, mapped_type>
value_type;
52 typedef typename std::allocator_traits<typename MemManager::ByteAllocator>
75 template<
typename KeyArg>
76 struct IsValidKeyArg :
public HashTraits::template IsValidKeyArg<KeyArg>
86 struct IteratorProxy :
private iterator
104 : mHashMap(HashTraits(), MemManager(alloc))
109 : mHashMap(HashTraits(bucketCount), MemManager(alloc))
115 : mHashMap(HashTraits(bucketCount, hashFunc), MemManager(alloc))
121 : mHashMap(HashTraits(bucketCount, hashFunc, equalComp), MemManager(alloc))
125 template<
typename Iterator>
131 template<
typename Iterator>
139 template<
typename Iterator>
147 template<
typename Iterator>
178 #ifdef MOMO_HAS_CONTAINERS_RANGES
179 template<std::ranges::input_range Range>
180 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
183 insert_range(std::forward<Range>(values));
186 template<std::ranges::input_range Range>
187 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
192 insert_range(std::forward<Range>(values));
195 template<std::ranges::input_range Range>
196 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
201 insert_range(std::forward<Range>(values));
204 template<std::ranges::input_range Range>
205 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
210 insert_range(std::forward<Range>(values));
212 #endif // MOMO_HAS_CONTAINERS_RANGES
220 : mHashMap(right.mHashMap.GetHashTraits(), MemManager(alloc))
222 if (right.get_allocator() == alloc)
224 mHashMap.Swap(right.mHashMap);
228 mHashMap.MergeFrom(right.mHashMap);
234 : mHashMap(right.mHashMap)
239 : mHashMap(right.mHashMap, MemManager(alloc))
258 mHashMap = HashMap(values, mHashMap.GetHashTraits(), MemManager(
get_allocator()));
322 MOMO_THROW(std::out_of_range(
"invalid load factor"));
323 HashTraits hashTraits(mHashMap.GetHashTraits(), maxLoadFactor);
325 hashMap.Reserve(
size());
327 mHashMap = std::move(hashMap);
332 return mHashMap.GetHashTraits().GetHasher();
337 return mHashMap.GetHashTraits().GetEqualComparer();
342 return allocator_type(mHashMap.GetMemManager().GetByteAllocator());
347 return std::allocator_traits<allocator_type>::max_size(
get_allocator());
352 return mHashMap.GetCount();
357 return mHashMap.IsEmpty();
369 bucketCount =
size_t{1} << logBucketCount;
375 mHashMap.Reserve(
count);
388 template<
typename KeyArg>
395 template<
typename KeyArg>
407 template<
typename KeyArg>
416 return mHashMap.ContainsKey(key);
419 template<
typename KeyArg>
423 return mHashMap.ContainsKey(key);
436 template<
typename KeyArg>
438 std::pair<const_iterator, const_iterator>>
equal_range(
const KeyArg& key)
const
443 template<
typename KeyArg>
450 template<
typename ValueArg = std::pair<key_type, mapped_type>>
452 std::pair<iterator, bool>>
insert(ValueArg&& valueArg)
454 return emplace(std::forward<ValueArg>(valueArg));
457 template<
typename ValueArg = std::pair<key_type, mapped_type>>
461 return emplace_hint(hint, std::forward<ValueArg>(valueArg));
469 std::move(NodeTypeProxy::GetExtractedPair(node)));
481 ConstIteratorProxy::GetBaseIterator(hint),
482 std::move(NodeTypeProxy::GetExtractedPair(node))));
486 return insert(std::move(node)).position;
490 template<
typename Iterator>
491 void insert(Iterator first, Iterator last)
493 pvInsertRange(first, last);
496 void insert(std::initializer_list<value_type> values)
498 mHashMap.Insert(values.begin(), values.end());
501 #ifdef MOMO_HAS_CONTAINERS_RANGES
502 template<std::ranges::input_range Range>
503 requires std::convertible_to<std::ranges::range_reference_t<Range>,
value_type>
504 void insert_range(Range&& values)
506 pvInsertRange(std::ranges::begin(values), std::ranges::end(values));
508 #endif // MOMO_HAS_CONTAINERS_RANGES
512 return pvEmplace(
nullptr, std::tuple<>(), std::tuple<>());
517 return pvEmplace(hint, std::tuple<>(), std::tuple<>()).first;
520 template<
typename ValueArg>
521 std::pair<iterator, bool>
emplace(ValueArg&& valueArg)
523 return pvEmplace(
nullptr,
524 std::forward_as_tuple(std::get<0>(std::forward<ValueArg>(valueArg))),
525 std::forward_as_tuple(std::get<1>(std::forward<ValueArg>(valueArg))));
528 template<
typename ValueArg>
531 return pvEmplace(hint,
532 std::forward_as_tuple(std::get<0>(std::forward<ValueArg>(valueArg))),
533 std::forward_as_tuple(std::get<1>(std::forward<ValueArg>(valueArg)))).first;
536 template<
typename KeyArg,
typename MappedArg>
537 std::pair<iterator, bool>
emplace(KeyArg&& keyArg, MappedArg&& mappedArg)
539 return pvEmplace(
nullptr, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
540 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
543 template<
typename KeyArg,
typename MappedArg>
546 return pvEmplace(hint, std::forward_as_tuple(std::forward<KeyArg>(keyArg)),
547 std::forward_as_tuple(std::forward<MappedArg>(mappedArg))).first;
550 template<
typename... KeyArgs,
typename... MappedArgs>
551 std::pair<iterator, bool>
emplace(std::piecewise_construct_t,
552 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
554 return pvEmplace(
nullptr, std::move(keyArgs), std::move(mappedArgs));
557 template<
typename... KeyArgs,
typename... MappedArgs>
559 std::tuple<KeyArgs...> keyArgs, std::tuple<MappedArgs...> mappedArgs)
561 return pvEmplace(hint, std::move(keyArgs), std::move(mappedArgs)).first;
567 mHashMap.Remove(ConstIteratorProxy::GetBaseIterator(where)));
577 if (first ==
begin() && last ==
end())
585 ConstIteratorProxy::GetBaseIterator(first)));
587 if (first !=
end() && std::next(first) == last)
589 MOMO_THROW(std::invalid_argument(
"invalid unordered_map erase arguments"));
594 return mHashMap.Remove(key) ? 1 : 0;
597 template<
typename ValueFilter>
602 return cont.mHashMap.Remove(pairFilter);
608 return mHashMap[std::move(key)];
614 return mHashMap[key];
621 MOMO_THROW(std::out_of_range(
"invalid unordered_map key"));
629 MOMO_THROW(std::out_of_range(
"invalid unordered_map key"));
633 template<
typename... MappedArgs>
636 return pvEmplace(
nullptr, std::forward_as_tuple(std::move(key)),
637 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
640 template<
typename... MappedArgs>
643 return pvEmplace(hint, std::forward_as_tuple(std::move(key)),
644 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
647 template<
typename... MappedArgs>
650 return pvEmplace(
nullptr, std::forward_as_tuple(key),
651 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...));
654 template<
typename... MappedArgs>
657 return pvEmplace(hint, std::forward_as_tuple(key),
658 std::forward_as_tuple(std::forward<MappedArgs>(mappedArgs)...)).first;
661 template<
typename MappedArg>
664 return pvInsertOrAssign(
nullptr, std::move(key), std::forward<MappedArg>(mappedArg));
667 template<
typename MappedArg>
670 return pvInsertOrAssign(hint, std::move(key), std::forward<MappedArg>(mappedArg)).first;
673 template<
typename MappedArg>
676 return pvInsertOrAssign(
nullptr, key, std::forward<MappedArg>(mappedArg));
679 template<
typename MappedArg>
682 return pvInsertOrAssign(hint, key, std::forward<MappedArg>(mappedArg)).first;
696 template<
typename Map>
699 mHashMap.MergeFrom(
map.get_nested_container());
710 return mHashMap.GetBucketCount();
715 return mHashMap.GetBucketBounds(bucketIndex).GetCount();
721 mHashMap.GetBucketBounds(bucketIndex).GetBegin());
727 mHashMap.GetBucketBounds(bucketIndex).GetBegin());
733 mHashMap.GetBucketBounds(bucketIndex).GetEnd());
739 mHashMap.GetBucketBounds(bucketIndex).GetEnd());
744 return begin(bucketIndex);
749 return end(bucketIndex);
754 return mHashMap.GetBucketIndex(key);
761 if (
count == 0 && bucketCount == 0)
763 return static_cast<float>(
count) /
static_cast<float>(bucketCount);
773 if (iter == right.
end())
775 if (!(iter->second == ref.second))
783 return !(left == right);
787 template<
typename Hint,
typename... KeyArgs,
typename... MappedArgs>
788 std::pair<iterator, bool> pvEmplace(Hint hint, std::tuple<KeyArgs...>&& keyArgs,
789 std::tuple<MappedArgs...>&& mappedArgs)
791 typedef typename HashMap::KeyValueTraits
792 ::template ValueCreator<MappedArgs...> MappedCreator;
793 return pvInsert(hint, std::move(keyArgs),
794 MappedCreator(mHashMap.GetMemManager(), std::move(mappedArgs)));
797 template<
typename... KeyArgs,
typename MappedCreator>
798 std::pair<iterator, bool> pvInsert(std::nullptr_t , std::tuple<KeyArgs...>&& keyArgs,
799 MappedCreator&& mappedCreator)
801 MemManager& memManager = mHashMap.GetMemManager();
804 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
806 KeyCreator(memManager, std::move(keyArgs))(keyBuffer.GetPtr());
807 typename KeyManager::DestroyFinalizer keyFin(&memManager, keyBuffer.Get());
813 KeyManager::Relocate(*keyFin.GetMemManager(), *keyFin.GetPtr(), newKey);
815 typename KeyManager::DestroyFinalizer newKeyFin(keyFin.GetMemManager(), *newKey);
816 std::forward<MappedCreator>(mappedCreator)(newMapped);
817 newKeyFin.ResetPtr();
823 template<
typename RKey,
typename MappedCreator,
824 typename Key =
typename std::decay<RKey>::type>
826 std::pair<iterator, bool>> pvInsert(std::nullptr_t , std::tuple<RKey>&& key,
827 MappedCreator&& mappedCreator)
830 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
834 template<
typename... KeyArgs,
typename MappedCreator>
835 std::pair<iterator, bool> pvInsert(
const_iterator hint, std::tuple<KeyArgs...>&& keyArgs,
836 MappedCreator&& mappedCreator)
840 MemManager& memManager = mHashMap.GetMemManager();
842 typedef typename KeyManager::template Creator<KeyArgs...> KeyCreator;
843 auto valueCreator = [&memManager, &keyArgs, &mappedCreator]
846 KeyCreator(memManager, std::move(keyArgs))(newKey);
847 typename KeyManager::DestroyFinalizer keyFin(&memManager, *newKey);
848 std::forward<MappedCreator>(mappedCreator)(newMapped);
852 ConstIteratorProxy::GetBaseIterator(hint), valueCreator);
857 return pvInsert(
nullptr, std::move(keyArgs), std::move(mappedCreator));
861 template<
typename RKey,
typename MappedCreator,
862 typename Key =
typename std::decay<RKey>::type>
864 std::pair<iterator, bool>> pvInsert(
const_iterator hint, std::tuple<RKey>&& key,
865 MappedCreator&& mappedCreator)
870 ConstIteratorProxy::GetBaseIterator(hint),
871 std::forward<RKey>(std::get<0>(key)), std::forward<MappedCreator>(mappedCreator));
876 return pvInsert(
nullptr, std::move(key), std::move(mappedCreator));
880 template<
typename Iterator,
typename Sentinel>
882 void> pvInsertRange(Iterator
begin, Sentinel
end)
884 mHashMap.Insert(std::move(
begin), std::move(
end));
887 template<
typename Iterator,
typename Sentinel>
889 void> pvInsertRange(Iterator
begin, Sentinel
end)
891 for (Iterator iter = std::move(
begin); iter !=
end; ++iter)
895 template<
typename H
int,
typename RKey,
typename MappedArg>
896 std::pair<iterator, bool> pvInsertOrAssign(Hint hint, RKey&& key, MappedArg&& mappedArg)
898 std::pair<iterator, bool> res = pvEmplace(hint,
899 std::forward_as_tuple(std::forward<RKey>(key)),
900 std::forward_as_tuple(std::forward<MappedArg>(mappedArg)));
902 res.first->second = std::forward<MappedArg>(mappedArg);
936 template<
typename TKey,
typename TMapped,
937 typename THasher = HashCoder<TKey>,
938 typename TEqualComparer = std::equal_to<TKey>,
939 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
941 HashTraitsStd<TKey, THasher, TEqualComparer, HashBucketDefault>, MemManagerStd<TAllocator>>>
949 using UnorderedMapAdaptor::UnorderedMapAdaptor;
972 template<
typename TKey,
typename TMapped,
974 typename TEqualComparer = std::equal_to<TKey>,
975 typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>>
977 HashTraitsStd<TKey, THasher, TEqualComparer, HashBucketOpenDefault>, MemManagerStd<TAllocator>>>
985 using UnorderedMapAdaptor::UnorderedMapAdaptor;
999 #ifdef MOMO_HAS_DEDUCTION_GUIDES
1001 #define MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map) \
1002 template<typename Iterator, \
1003 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1004 typename Key = std::decay_t<typename Value::first_type>, \
1005 typename Mapped = std::decay_t<typename Value::second_type>> \
1006 unordered_map(Iterator, Iterator) \
1007 -> unordered_map<Key, Mapped>; \
1008 template<typename Iterator, \
1009 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1010 typename Key = std::decay_t<typename Value::first_type>, \
1011 typename Mapped = std::decay_t<typename Value::second_type>, \
1012 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1013 typename = internal::hash_checker<Key, Allocator, HashCoder<Key>>> \
1014 unordered_map(Iterator, Iterator, size_t, Allocator = Allocator()) \
1015 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1016 template<typename Iterator, typename Hasher, \
1017 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1018 typename Key = std::decay_t<typename Value::first_type>, \
1019 typename Mapped = std::decay_t<typename Value::second_type>, \
1020 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1021 typename = internal::hash_checker<Key, Allocator, Hasher>> \
1022 unordered_map(Iterator, Iterator, size_t, Hasher, Allocator = Allocator()) \
1023 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1024 template<typename Iterator, typename Hasher, typename EqualComparer, \
1025 typename Value = typename std::iterator_traits<Iterator>::value_type, \
1026 typename Key = std::decay_t<typename Value::first_type>, \
1027 typename Mapped = std::decay_t<typename Value::second_type>, \
1028 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1029 typename = internal::hash_checker<Key, Allocator, Hasher, EqualComparer>> \
1030 unordered_map(Iterator, Iterator, size_t, Hasher, EqualComparer, Allocator = Allocator()) \
1031 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>; \
1032 template<typename QKey, typename Mapped, \
1033 typename Key = std::remove_const_t<QKey>> \
1034 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>) \
1035 -> unordered_map<Key, Mapped>; \
1036 template<typename QKey, typename Mapped, \
1037 typename Key = std::remove_const_t<QKey>, \
1038 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1039 typename = internal::hash_checker<Key, Allocator, HashCoder<Key>>> \
1040 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, Allocator = Allocator()) \
1041 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1042 template<typename QKey, typename Mapped, typename Hasher, \
1043 typename Key = std::remove_const_t<QKey>, \
1044 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1045 typename = internal::hash_checker<Key, Allocator, Hasher>> \
1046 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, Hasher, Allocator = Allocator()) \
1047 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1048 template<typename QKey, typename Mapped, typename Hasher, typename EqualComparer, \
1049 typename Key = std::remove_const_t<QKey>, \
1050 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1051 typename = internal::hash_checker<Key, Allocator, Hasher, EqualComparer>> \
1052 unordered_map(std::initializer_list<std::pair<QKey, Mapped>>, size_t, \
1053 Hasher, EqualComparer, Allocator = Allocator()) \
1054 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>; \
1055 template<typename Key, typename Mapped, typename Hasher, typename EqualComparer, typename Allocator> \
1056 unordered_map(unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>, \
1057 momo::internal::Identity<Allocator>) \
1058 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>;
1060 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map)
1061 MOMO_DECLARE_DEDUCTION_GUIDES(unordered_map_open)
1063 #undef MOMO_DECLARE_DEDUCTION_GUIDES
1065 #ifdef MOMO_HAS_CONTAINERS_RANGES
1067 #define MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map) \
1068 template<std::ranges::input_range Range, \
1069 typename Value = std::ranges::range_value_t<Range>, \
1070 typename Key = std::decay_t<typename Value::first_type>, \
1071 typename Mapped = std::decay_t<typename Value::second_type>> \
1072 unordered_map(std::from_range_t, Range&&) \
1073 -> unordered_map<Key, Mapped>; \
1074 template<std::ranges::input_range Range, \
1075 typename Value = std::ranges::range_value_t<Range>, \
1076 typename Key = std::decay_t<typename Value::first_type>, \
1077 typename Mapped = std::decay_t<typename Value::second_type>, \
1078 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1079 typename = internal::hash_checker<Key, Allocator, HashCoder<Key>>> \
1080 unordered_map(std::from_range_t, Range&&, size_t, Allocator = Allocator()) \
1081 -> unordered_map<Key, Mapped, HashCoder<Key>, std::equal_to<Key>, Allocator>; \
1082 template<std::ranges::input_range Range, typename Hasher, \
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 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1087 typename = internal::hash_checker<Key, Allocator, Hasher>> \
1088 unordered_map(std::from_range_t, Range&&, size_t, Hasher, Allocator = Allocator()) \
1089 -> unordered_map<Key, Mapped, Hasher, std::equal_to<Key>, Allocator>; \
1090 template<std::ranges::input_range Range, typename Hasher, typename EqualComparer, \
1091 typename Value = std::ranges::range_value_t<Range>, \
1092 typename Key = std::decay_t<typename Value::first_type>, \
1093 typename Mapped = std::decay_t<typename Value::second_type>, \
1094 typename Allocator = std::allocator<std::pair<const Key, Mapped>>, \
1095 typename = internal::hash_checker<Key, Allocator, Hasher, EqualComparer>> \
1096 unordered_map(std::from_range_t, Range&&, size_t, Hasher, EqualComparer, Allocator = Allocator()) \
1097 -> unordered_map<Key, Mapped, Hasher, EqualComparer, Allocator>;
1099 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map)
1100 MOMO_DECLARE_DEDUCTION_GUIDES_RANGES(unordered_map_open)
1102 #undef MOMO_DECLARE_DEDUCTION_GUIDES_RANGES
1104 #endif // MOMO_HAS_CONTAINERS_RANGES
1106 #endif // MOMO_HAS_DEDUCTION_GUIDES
1112 #endif // MOMO_INCLUDE_GUARD_STDISH_UNORDERED_MAP
Definition: ObjectManager.h:394
ptrdiff_t difference_type
Definition: unordered_map.h:49
std::allocator_traits< typename MemManager::ByteAllocator >::template rebind_alloc< value_type > allocator_type
Definition: unordered_map.h:53
Position position
Definition: IteratorUtility.h:132
static const size_t maxSize
Definition: Utility.h:476
const nested_container_type & get_nested_container() const noexcept
Definition: unordered_map.h:272
iterator erase(const_iterator where)
Definition: unordered_map.h:564
#define MOMO_DECLARE_PROXY_FUNCTION(Class, Func)
Definition: Utility.h:116
TReference< typename BaseIterator::Reference > Reference
Definition: IteratorUtility.h:340
void insert(Iterator first, Iterator last)
Definition: unordered_map.h:491
std::pair< iterator, bool > emplace(KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:537
#define MOMO_THROW(exception)
Definition: UserSettings.h:191
momo::stdish::map is similar to std::map, but much more efficient in memory usage....
Definition: map.h:1012
static constexpr UInt Max(UInt value1, UInt value2) noexcept
Definition: Utility.h:352
unordered_map_adaptor(size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:119
HashMapIterator< typename HashSetBucketBounds::Iterator, isConst > Iterator
Definition: HashMap.h:207
momo::internal::HashDerivedIterator< HashMapIterator, momo::internal::MapReferenceStd > iterator
Definition: unordered_map.h:56
internal::map_node_handle< typename HashMap::ExtractedPair > node_type
Definition: unordered_map.h:67
friend size_type erase_if(unordered_map_adaptor &cont, const ValueFilter &valueFilter)
Definition: unordered_map.h:598
unordered_map_adaptor(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:140
iterator erase(iterator where)
Definition: unordered_map.h:570
friend void swap(unordered_map &left, unordered_map &right) noexcept
Definition: unordered_map.h:957
nested_container_type & get_nested_container() noexcept
Definition: unordered_map.h:277
void merge(Map &&map)
Definition: unordered_map.h:697
~unordered_map_adaptor()=default
friend bool operator==(const unordered_map_adaptor &left, const unordered_map_adaptor &right)
Definition: unordered_map.h:766
momo::internal::EnableIf< std::is_constructible< value_type, ValueArg && >::value, iterator > insert(const_iterator hint, ValueArg &&valueArg)
Definition: unordered_map.h:459
size_type size() const noexcept
Definition: unordered_map.h:350
unordered_map_adaptor & operator=(const unordered_map_adaptor &right)
Definition: unordered_map.h:251
const_local_iterator cend(size_type bucketIndex) const
Definition: unordered_map.h:747
std::pair< iterator, bool > emplace(ValueArg &&valueArg)
Definition: unordered_map.h:521
unordered_map_adaptor(const unordered_map_adaptor &right)
Definition: unordered_map.h:233
internal::InsertResult< Position > InsertResult
Definition: HashMap.h:363
Definition: HashMap.h:334
MOMO_FORCEINLINE iterator find(const key_type &key)
Definition: unordered_map.h:383
unordered_map_adaptor(size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:108
local_iterator end(size_type bucketIndex)
Definition: unordered_map.h:730
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:978
unordered_map_adaptor(Iterator first, Iterator last, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:132
iterator emplace_hint(const_iterator hint, std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:558
std::pair< iterator, bool > emplace()
Definition: unordered_map.h:510
MOMO_FORCEINLINE size_type count(const key_type &key) const
Definition: unordered_map.h:402
unordered_map_adaptor()
Definition: unordered_map.h:99
static UInt Log2(UInt value) noexcept
Definition: Utility.h:414
Definition: Utility.h:238
size_type bucket_size(size_type bucketIndex) const
Definition: unordered_map.h:713
static const size_t bucketMaxItemCount
Definition: HashMap.h:370
size_type max_bucket_count() const noexcept
Definition: unordered_map.h:702
iterator emplace_hint(const_iterator hint, KeyArg &&keyArg, MappedArg &&mappedArg)
Definition: unordered_map.h:544
KeyValueTraits::Key Key
Definition: HashMap.h:339
MOMO_FORCEINLINE const mapped_type & at(const key_type &key) const
Definition: unordered_map.h:617
MemManagerStd uses allocator<unsigned char>::allocate and deallocate
Definition: MemManager.h:179
void reserve(size_type count)
Definition: unordered_map.h:373
key_equal key_eq() const
Definition: unordered_map.h:335
MOMO_FORCEINLINE std::pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition: unordered_map.h:426
unordered_map_adaptor(std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:172
iterator insert(const_iterator hint, node_type &&node)
Definition: unordered_map.h:474
const_iterator begin() const noexcept
Definition: unordered_map.h:282
float load_factor() const noexcept
Definition: unordered_map.h:757
KeyValueTraits::MemManager MemManager
Definition: HashMap.h:341
MOMO_FORCEINLINE mapped_type & at(const key_type &key)
Definition: unordered_map.h:625
static Container & Move(Container &&srcCont, Container &dstCont) noexcept(IsNothrowMoveAssignable< Container >::value)
Definition: Utility.h:515
Definition: IteratorUtility.h:100
size_type bucket_count() const noexcept
Definition: unordered_map.h:708
unordered_map_adaptor(size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:113
node_type extract(const_iterator where)
Definition: unordered_map.h:685
internal::insert_return_type< iterator, node_type > insert_return_type
Definition: unordered_map.h:68
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< const_iterator, const_iterator > > equal_range(const KeyArg &key) const
Definition: unordered_map.h:438
size_t size_type
Definition: unordered_map.h:48
Definition: set_map_utility.h:112
unordered_map_adaptor(std::initializer_list< value_type > values)
Definition: unordered_map.h:155
iterator insert_or_assign(const_iterator hint, key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:668
unordered_map_adaptor & operator=(unordered_map_adaptor &&right) noexcept(momo::internal::ContainerAssignerStd::IsNothrowMoveAssignable< unordered_map_adaptor >::value)
Definition: unordered_map.h:245
typename std::enable_if< value, Type >::type EnableIf
Definition: Utility.h:199
HashTraits::EqualComparer key_equal
Definition: unordered_map.h:44
THashTraits HashTraits
Definition: HashMap.h:337
iterator::Reference reference
Definition: unordered_map.h:59
momo::stdish::unordered_map is similar to std::unordered_map, but much more efficient in memory usage...
Definition: unordered_map.h:942
void rehash(size_type bucketCount)
Definition: unordered_map.h:365
iterator::ConstIterator const_iterator
Definition: unordered_map.h:57
const_iterator cend() const noexcept
Definition: unordered_map.h:307
BoolConstant< std::is_empty< Allocator >::value||std::allocator_traits< Allocator >::propagate_on_container_move_assignment::value > IsNothrowMoveAssignable
Definition: Utility.h:511
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, size_type > count(const KeyArg &key) const
Definition: unordered_map.h:409
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, iterator > find(const KeyArg &key)
Definition: unordered_map.h:397
std::pair< iterator, bool > insert_or_assign(const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:674
const_local_iterator cbegin(size_type bucketIndex) const
Definition: unordered_map.h:742
Definition: IteratorUtility.h:228
unordered_map_adaptor(const unordered_map_adaptor &right, const allocator_type &alloc)
Definition: unordered_map.h:238
const_iterator::Reference const_reference
Definition: unordered_map.h:60
iterator insert_or_assign(const_iterator hint, const key_type &key, MappedArg &&mappedArg)
Definition: unordered_map.h:680
bool inserted
Definition: IteratorUtility.h:135
MOMO_FORCEINLINE HashMap::template ValueReference< const key_type & > operator[](const key_type &key)
Definition: unordered_map.h:611
Definition: unordered_map.h:32
size_type bucket(const key_type &key) const
Definition: unordered_map.h:752
HashMap nested_container_type
Definition: unordered_map.h:46
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, const_iterator > find(const KeyArg &key) const
Definition: unordered_map.h:390
momo::internal::EnableIf< std::is_constructible< value_type, ValueArg && >::value, std::pair< iterator, bool > > insert(ValueArg &&valueArg)
Definition: unordered_map.h:452
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, std::pair< iterator, iterator > > equal_range(const KeyArg &key)
Definition: unordered_map.h:445
friend void swap(unordered_map_open &left, unordered_map_open &right) noexcept
Definition: unordered_map.h:993
const_iterator::Pointer const_pointer
Definition: unordered_map.h:63
allocator_type get_allocator() const noexcept
Definition: unordered_map.h:340
Definition: HashTraits.h:196
Definition: IteratorUtility.h:335
unordered_map_open & operator=(std::initializer_list< typename UnorderedMapAdaptor::value_type > values)
Definition: unordered_map.h:987
unordered_map_adaptor(std::initializer_list< value_type > values, size_type bucketCount, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:160
MOMO_FORCEINLINE std::pair< iterator, iterator > equal_range(const key_type &key)
Definition: unordered_map.h:431
friend bool operator!=(const unordered_map_adaptor &left, const unordered_map_adaptor &right)
Definition: unordered_map.h:781
std::pair< iterator, bool > try_emplace(const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:648
MOMO_FORCEINLINE HashMap::template ValueReference< key_type && > operator[](key_type &&key)
Definition: unordered_map.h:605
insert_return_type insert(node_type &&node)
Definition: unordered_map.h:464
std::pair< iterator, bool > try_emplace(key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:634
unordered_map_adaptor(std::initializer_list< value_type > values, size_type bucketCount, const hasher &hashFunc, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:166
const_iterator end() const noexcept
Definition: unordered_map.h:292
momo::internal::HashDerivedIterator< typename HashMap::BucketBounds::Iterator, momo::internal::MapReferenceStd > local_iterator
Definition: unordered_map.h:71
iterator end() noexcept
Definition: unordered_map.h:297
Definition: ObjectManager.h:190
#define MOMO_CONSTEXPR_IF
Definition: UserSettings.h:228
std::pair< const key_type, mapped_type > value_type
Definition: unordered_map.h:51
node_type extract(const key_type &key)
Definition: unordered_map.h:690
unordered_map_adaptor & operator=(std::initializer_list< value_type > values)
Definition: unordered_map.h:256
#define MOMO_FORCEINLINE
Definition: UserSettings.h:125
unordered_map_adaptor(unordered_map_adaptor &&right)
Definition: unordered_map.h:214
iterator try_emplace(const_iterator hint, key_type &&key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:641
size_type erase(const key_type &key)
Definition: unordered_map.h:592
KeyValueTraits::Value Value
Definition: HashMap.h:340
void insert(std::initializer_list< value_type > values)
Definition: unordered_map.h:496
unordered_map_adaptor(unordered_map_adaptor &&right, const allocator_type &alloc)
Definition: unordered_map.h:219
unordered_map_adaptor(Iterator first, Iterator last, size_type bucketCount, const hasher &hashFunc, const key_equal &equalComp, const allocator_type &alloc=allocator_type())
Definition: unordered_map.h:148
MOMO_NODISCARD bool empty() const noexcept
Definition: unordered_map.h:355
HashTraits::Hasher hasher
Definition: unordered_map.h:43
void max_load_factor(float maxLoadFactor)
Definition: unordered_map.h:317
size_type max_size() const noexcept
Definition: unordered_map.h:345
iterator erase(const_iterator first, const_iterator last)
Definition: unordered_map.h:575
iterator::Pointer pointer
Definition: unordered_map.h:62
std::pair< iterator, bool > emplace(std::piecewise_construct_t, std::tuple< KeyArgs... > keyArgs, std::tuple< MappedArgs... > mappedArgs)
Definition: unordered_map.h:551
HashMap::Key key_type
Definition: unordered_map.h:41
friend void swap(unordered_map_adaptor &left, unordered_map_adaptor &right) noexcept
Definition: unordered_map.h:267
unordered_map_adaptor(Iterator first, Iterator last)
Definition: unordered_map.h:126
iterator try_emplace(const_iterator hint, const key_type &key, MappedArgs &&... mappedArgs)
Definition: unordered_map.h:655
local_iterator begin(size_type bucketIndex)
Definition: unordered_map.h:718
HashMap::Value mapped_type
Definition: unordered_map.h:42
MOMO_FORCEINLINE momo::internal::EnableIf< IsValidKeyArg< KeyArg >::value, bool > contains(const KeyArg &key) const
Definition: unordered_map.h:421
const_local_iterator end(size_type bucketIndex) const
Definition: unordered_map.h:736
const_local_iterator begin(size_type bucketIndex) const
Definition: unordered_map.h:724
void clear() noexcept
Definition: unordered_map.h:360
static Container & Copy(const Container &srcCont, Container &dstCont)
Definition: Utility.h:531
MOMO_FORCEINLINE const_iterator find(const key_type &key) const
Definition: unordered_map.h:378
iterator emplace_hint(const_iterator hint)
Definition: unordered_map.h:515
unordered_map_adaptor(const allocator_type &alloc)
Definition: unordered_map.h:103
float max_load_factor() const noexcept
Definition: unordered_map.h:312
iterator begin() noexcept
Definition: unordered_map.h:287
std::pair< iterator, bool > insert_or_assign(key_type &&key, MappedArg &&mappedArg)
Definition: unordered_map.h:662
local_iterator::ConstIterator const_local_iterator
Definition: unordered_map.h:72
hasher hash_function() const
Definition: unordered_map.h:330
MOMO_FORCEINLINE bool contains(const key_type &key) const
Definition: unordered_map.h:414
static void Swap(Container &cont1, Container &cont2) noexcept
Definition: Utility.h:546
unordered_map & operator=(std::initializer_list< typename UnorderedMapAdaptor::value_type > values)
Definition: unordered_map.h:951
internal::HashMapPosition< HashSetConstPosition > Position
Definition: HashMap.h:360
#define MOMO_NODISCARD
Definition: UserSettings.h:262
const_iterator cbegin() const noexcept
Definition: unordered_map.h:302
void swap(unordered_map_adaptor &right) noexcept
Definition: unordered_map.h:262
iterator emplace_hint(const_iterator hint, ValueArg &&valueArg)
Definition: unordered_map.h:529
Definition: MapUtility.h:68
HashMapCore< HashMapKeyValueTraits< TKey, TValue, TMemManager >, THashTraits > HashMap
Definition: HashMap.h:856