weakref hash from sleepyut

This commit is contained in:
altalk23 2024-09-10 21:09:09 +03:00
parent 67814ece83
commit 2d9ce8f3e3

View file

@ -401,6 +401,9 @@ namespace geode {
WeakRef(std::shared_ptr<WeakRefController> obj) : m_controller(obj) {}
friend class std::hash<WeakRef<T>>;
public:
/**
* Construct a WeakRef of an object. A weak reference is one that will
@ -972,6 +975,13 @@ namespace std {
return std::hash<T*>()(ref.data());
}
};
template <typename T>
struct std::hash<geode::WeakRef<T>> {
size_t operator()(geode::WeakRef<T> const& ref) const {
return hash{}(ref.m_controller);
}
};
}
// more utils