summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2022-09-07 19:34:24 +0800
committerXusheng <xusheng@vector35.com>2022-09-08 12:50:17 +0800
commitcdc840a8f6588f656713bdb5a890f8b71787b387 (patch)
tree1757c7920ceae9d322f69bf955bd426ff6cdce76 /binaryninjaapi.h
parent5e9ed278cd437743d32f42094a8fb94228e8e17e (diff)
Fix comparison operator for BinaryNinja::Ref
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 1a0f1550..6f0ca20a 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -101,6 +101,15 @@ namespace BinaryNinja {
return obj->GetObject();
}
+ // This is needed by code like
+ // bool operator==(const T* obj) const { return T::GetObject(m_obj) == T::GetObject(obj); }
+ static T* GetObject(const CoreRefCountObject* obj)
+ {
+ if (!obj)
+ return nullptr;
+ return obj->GetObject();
+ }
+
void AddRef()
{
if (m_object && (m_refs != 0))