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