mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
weakref hash from sleepyut
This commit is contained in:
parent
67814ece83
commit
2d9ce8f3e3
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue