mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
AK: Use Noncopyable.h
in NonnullRawPtr
This commit is contained in:
parent
501a7dbaa3
commit
bea602f5ed
Notes:
github-actions[bot]
2024-12-04 16:47:36 +00:00
Author: https://github.com/yyny Commit: https://github.com/LadybirdBrowser/ladybird/commit/bea602f5ed6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2454 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 4 additions and 24 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue