summaryrefslogtreecommitdiff
path: root/core/reference.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/reference.h')
-rw-r--r--core/reference.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/reference.h b/core/reference.h
index f3fcc922c7..9105dbbd58 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -197,6 +197,19 @@ public:
r.reference = NULL;
}
+ template <class T_Other>
+ void reference_ptr(T_Other *p_ptr) {
+ if (reference == p_ptr) {
+ return;
+ }
+ unref();
+
+ T *r = Object::cast_to<T>(p_ptr);
+ if (r) {
+ ref_pointer(r);
+ }
+ }
+
Ref(const Ref &p_from) {
reference = NULL;