From a67935e173aab6f8a6eb4261b2d961e5227104b7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:09:09 +0300 Subject: [PATCH] weakref hash from sleepyut --- loader/include/Geode/utils/cocos.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index 02eba1a09..900fe51c8 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -401,6 +401,9 @@ namespace geode { WeakRef(std::shared_ptr obj) : m_controller(obj) {} + friend class std::hash>; + + public: /** * Construct a WeakRef of an object. A weak reference is one that will @@ -972,6 +975,13 @@ namespace std { return std::hash()(ref.data()); } }; + + template + struct std::hash> { + size_t operator()(geode::WeakRef const& ref) const { + return hash{}(ref.m_controller); + } + }; } // more utils