summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ref_ptr.cpp8
-rw-r--r--core/ref_ptr.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/core/ref_ptr.cpp b/core/ref_ptr.cpp
index 961f143e5c..6da73ca41a 100644
--- a/core/ref_ptr.cpp
+++ b/core/ref_ptr.cpp
@@ -49,6 +49,14 @@ bool RefPtr::operator==(const RefPtr &p_other) const {
return *ref == *ref_other;
}
+bool RefPtr::operator!=(const RefPtr &p_other) const {
+
+ Ref<Reference> *ref = reinterpret_cast<Ref<Reference> *>(&data[0]);
+ Ref<Reference> *ref_other = reinterpret_cast<Ref<Reference> *>(const_cast<char *>(&p_other.data[0]));
+
+ return *ref != *ref_other;
+}
+
RefPtr::RefPtr(const RefPtr &p_other) {
memnew_placement(&data[0], Ref<Reference>);
diff --git a/core/ref_ptr.h b/core/ref_ptr.h
index f745ababa1..320cf35609 100644
--- a/core/ref_ptr.h
+++ b/core/ref_ptr.h
@@ -50,6 +50,7 @@ public:
bool is_null() const;
void operator=(const RefPtr &p_other);
bool operator==(const RefPtr &p_other) const;
+ bool operator!=(const RefPtr &p_other) const;
RID get_rid() const;
void unref();
_FORCE_INLINE_ void *get_data() const { return data; }