mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Merge pull request #111358 from Ivorforce/no-variant-hasher
Remove `VariantHasher` and `VariantComparator` in favour of specialising `HashMapHasherDefault` and `HashMapComparatorDefault`.
This commit is contained in:
@@ -47,7 +47,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, String);
|
||||
struct DictionaryPrivate {
|
||||
SafeRefCount refcount;
|
||||
Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values.
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator> variant_map;
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator> variant_map;
|
||||
ContainerTypeValidate typed_key;
|
||||
ContainerTypeValidate typed_value;
|
||||
Variant *typed_fallback = nullptr; // Allows a typed dictionary to return dummy values when attempting an invalid access.
|
||||
@@ -143,7 +143,7 @@ const Variant *Dictionary::getptr(const Variant &p_key) const {
|
||||
if (unlikely(!_p->typed_key.validate(key, "getptr"))) {
|
||||
return nullptr;
|
||||
}
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>::ConstIterator E(_p->variant_map.find(key));
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::ConstIterator E(_p->variant_map.find(key));
|
||||
if (!E) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ Variant *Dictionary::getptr(const Variant &p_key) {
|
||||
if (unlikely(!_p->typed_key.validate(key, "getptr"))) {
|
||||
return nullptr;
|
||||
}
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>::Iterator E(_p->variant_map.find(key));
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::Iterator E(_p->variant_map.find(key));
|
||||
if (!E) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ Variant *Dictionary::getptr(const Variant &p_key) {
|
||||
Variant Dictionary::get_valid(const Variant &p_key) const {
|
||||
Variant key = p_key;
|
||||
ERR_FAIL_COND_V(!_p->typed_key.validate(key, "get_valid"), Variant());
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>::ConstIterator E(_p->variant_map.find(key));
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::ConstIterator E(_p->variant_map.find(key));
|
||||
|
||||
if (!E) {
|
||||
return Variant();
|
||||
@@ -280,7 +280,7 @@ bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int recursion_c
|
||||
}
|
||||
recursion_count++;
|
||||
for (const KeyValue<Variant, Variant> &this_E : _p->variant_map) {
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>::ConstIterator other_E(p_dictionary._p->variant_map.find(this_E.key));
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::ConstIterator other_E(p_dictionary._p->variant_map.find(this_E.key));
|
||||
if (!other_E || !this_E.value.hash_compare(other_E->value, recursion_count, false)) {
|
||||
return false;
|
||||
}
|
||||
@@ -438,7 +438,7 @@ void Dictionary::assign(const Dictionary &p_dictionary) {
|
||||
}
|
||||
|
||||
int size = p_dictionary._p->variant_map.size();
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator> variant_map = HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>(size);
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator> variant_map = HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>(size);
|
||||
|
||||
Vector<Variant> key_array;
|
||||
key_array.resize(size);
|
||||
@@ -571,7 +571,7 @@ const Variant *Dictionary::next(const Variant *p_key) const {
|
||||
}
|
||||
Variant key = *p_key;
|
||||
ERR_FAIL_COND_V(!_p->typed_key.validate(key, "next"), nullptr);
|
||||
HashMap<Variant, Variant, VariantHasher, StringLikeVariantComparator>::Iterator E = _p->variant_map.find(key);
|
||||
HashMap<Variant, Variant, HashMapHasherDefault, StringLikeVariantComparator>::Iterator E = _p->variant_map.find(key);
|
||||
|
||||
if (!E) {
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user