diff options
Diffstat (limited to 'core/object/ref_counted.h')
-rw-r--r-- | core/object/ref_counted.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h index 71790fb825..411c589739 100644 --- a/core/object/ref_counted.h +++ b/core/object/ref_counted.h @@ -253,12 +253,14 @@ public: template <class T> struct PtrToArg<Ref<T>> { _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { + // p_ptr points to a RefCounted object return Ref<T>(const_cast<T *>(reinterpret_cast<const T *>(p_ptr))); } typedef Ref<T> EncodeT; _FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) { + // p_ptr points to an EncodeT object which is a Ref<T> object. *(const_cast<Ref<RefCounted> *>(reinterpret_cast<const Ref<RefCounted> *>(p_ptr))) = p_val; } }; @@ -268,6 +270,7 @@ struct PtrToArg<const Ref<T> &> { typedef Ref<T> EncodeT; _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { + // p_ptr points to a RefCounted object return Ref<T>((T *)p_ptr); } }; |