AK: Use Noncopyable.h in NonnullRawPtr

This commit is contained in:
Jonne Ransijn 2024-11-15 23:57:23 +01:00 committed by Sam Atkins
parent 501a7dbaa3
commit bea602f5ed
Notes: github-actions[bot] 2024-12-04 16:47:36 +00:00

View file

@ -7,12 +7,16 @@
#pragma once
#include <AK/Forward.h>
#include <AK/Noncopyable.h>
#include <AK/Traits.h>
namespace AK {
template<typename T>
requires(!IsLvalueReference<T> && !IsRvalueReference<T>) class [[nodiscard]] NonnullRawPtr {
AK_MAKE_DEFAULT_COPYABLE(NonnullRawPtr);
AK_MAKE_DEFAULT_MOVABLE(NonnullRawPtr);
public:
using ValueType = T;
@ -23,30 +27,6 @@ public:
{
}
NonnullRawPtr(NonnullRawPtr const& other)
: m_ptr(other.m_ptr)
{
}
NonnullRawPtr(NonnullRawPtr&& other)
: m_ptr(other.m_ptr)
{
}
NonnullRawPtr& operator=(NonnullRawPtr const& other)
{
m_ptr = other.m_ptr;
return *this;
}
NonnullRawPtr& operator=(NonnullRawPtr&& other)
{
m_ptr = other.m_ptr;
return *this;
}
operator bool() const = delete;
bool operator!() const = delete;