AK: Use Noncopyable.h in NonnullRawPtr

This commit is contained in:
Jonne Ransijn 2024-11-15 23:57:23 +01:00
parent b35fbe77c6
commit db28ed8f51
No known key found for this signature in database
GPG key ID: 49DC70026D2C578C

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;