(ObjectRef) Added implicit conversion constructor/operator
Former-commit-id: c633956130731e84c6d15d09961cd80c8d24877a
This commit is contained in:
@@ -20,6 +20,7 @@ class NzObjectRef
|
|||||||
NzObjectRef();
|
NzObjectRef();
|
||||||
NzObjectRef(T* object);
|
NzObjectRef(T* object);
|
||||||
NzObjectRef(const NzObjectRef& ref);
|
NzObjectRef(const NzObjectRef& ref);
|
||||||
|
template<typename U> NzObjectRef(const NzObjectRef<U>& ref);
|
||||||
NzObjectRef(NzObjectRef&& ref) noexcept;
|
NzObjectRef(NzObjectRef&& ref) noexcept;
|
||||||
~NzObjectRef();
|
~NzObjectRef();
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ class NzObjectRef
|
|||||||
|
|
||||||
NzObjectRef& operator=(T* object);
|
NzObjectRef& operator=(T* object);
|
||||||
NzObjectRef& operator=(const NzObjectRef& ref);
|
NzObjectRef& operator=(const NzObjectRef& ref);
|
||||||
|
template<typename U> NzObjectRef& operator=(const NzObjectRef<U>& ref);
|
||||||
NzObjectRef& operator=(NzObjectRef&& ref) noexcept;
|
NzObjectRef& operator=(NzObjectRef&& ref) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ m_object(ref.m_object)
|
|||||||
m_object->AddReference();
|
m_object->AddReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
template<typename U>
|
||||||
|
NzObjectRef<T>::NzObjectRef(const NzObjectRef<U>& ref) :
|
||||||
|
NzObjectRef(ref.Get())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
NzObjectRef<T>::NzObjectRef(NzObjectRef&& ref) noexcept :
|
NzObjectRef<T>::NzObjectRef(NzObjectRef&& ref) noexcept :
|
||||||
m_object(ref.m_object)
|
m_object(ref.m_object)
|
||||||
@@ -124,6 +131,15 @@ NzObjectRef<T>& NzObjectRef<T>::operator=(const NzObjectRef& ref)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
template<typename U>
|
||||||
|
NzObjectRef<T>& NzObjectRef<T>::operator=(const NzObjectRef<U>& ref)
|
||||||
|
{
|
||||||
|
Reset(ref.Get());
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
NzObjectRef<T>& NzObjectRef<T>::operator=(NzObjectRef&& ref) noexcept
|
NzObjectRef<T>& NzObjectRef<T>::operator=(NzObjectRef&& ref) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user