yes
This commit is contained in:
53
Runtime/Includes/Utils/NonOwningPtr.inl
git.filemode.normal_file
53
Runtime/Includes/Utils/NonOwningPtr.inl
git.filemode.normal_file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include <Utils/NonOwningPtr.h>
|
||||
|
||||
namespace Scop
|
||||
{
|
||||
template<typename T>
|
||||
NonOwningPtr<T>::NonOwningPtr(T* ptr) : m_ptr(ptr) {}
|
||||
|
||||
template<typename T>
|
||||
NonOwningPtr<T>::NonOwningPtr(NonOwningPtr<T>&& ptr) noexcept : m_ptr(ptr.m_ptr)
|
||||
{
|
||||
ptr.m_ptr = nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NonOwningPtr<T>& NonOwningPtr<T>::operator=(T* ptr)
|
||||
{
|
||||
m_ptr = ptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NonOwningPtr<T>& NonOwningPtr<T>::operator=(NonOwningPtr&& ptr) noexcept
|
||||
{
|
||||
m_ptr = ptr.m_ptr;
|
||||
ptr.m_ptr = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NonOwningPtr<T>::operator bool() const noexcept
|
||||
{
|
||||
return m_ptr != nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* NonOwningPtr<T>::Get() const noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* NonOwningPtr<T>::operator->() const noexcept
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& NonOwningPtr<T>::operator*() const noexcept
|
||||
{
|
||||
return *m_ptr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user