mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`. Improve hashing function for `Color` (based on values instead of `String`). Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used. Remove now unnecessary `HashableHasher`.
This commit is contained in:
@@ -641,7 +641,7 @@ private:
|
||||
};
|
||||
|
||||
MethodInfo user;
|
||||
HashMap<Callable, Slot, HashableHasher<Callable>> slot_map;
|
||||
HashMap<Callable, Slot> slot_map;
|
||||
bool removable = false;
|
||||
};
|
||||
friend struct _ObjectSignalLock;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/templates/hashfuncs.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
// Class to store an object ID (int64)
|
||||
@@ -54,6 +55,8 @@ public:
|
||||
_ALWAYS_INLINE_ void operator=(int64_t p_int64) { id = p_int64; }
|
||||
_ALWAYS_INLINE_ void operator=(uint64_t p_uint64) { id = p_uint64; }
|
||||
|
||||
uint32_t hash() const { return HashMapHasherDefault::hash(id); }
|
||||
|
||||
_ALWAYS_INLINE_ ObjectID() {}
|
||||
_ALWAYS_INLINE_ explicit ObjectID(const uint64_t p_id) { id = p_id; }
|
||||
_ALWAYS_INLINE_ explicit ObjectID(const int64_t p_id) { id = p_id; }
|
||||
|
||||
@@ -216,6 +216,8 @@ public:
|
||||
ref(memnew(T(p_params...)));
|
||||
}
|
||||
|
||||
uint32_t hash() const { return HashMapHasherDefault::hash(reference); }
|
||||
|
||||
Ref() = default;
|
||||
|
||||
~Ref() {
|
||||
|
||||
Reference in New Issue
Block a user