mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
AK: Add equality operators to compare RefPtr to NonNullRefPtr
This commit is contained in:
parent
ce7d868d6b
commit
63d06458ca
1 changed files with 12 additions and 0 deletions
12
AK/RefPtr.h
12
AK/RefPtr.h
|
@ -32,6 +32,8 @@ class [[nodiscard]] RefPtr {
|
|||
friend class RefPtr;
|
||||
template<typename U>
|
||||
friend class WeakPtr;
|
||||
template<typename U>
|
||||
friend class NonnullRefPtr;
|
||||
|
||||
public:
|
||||
enum AdoptTag {
|
||||
|
@ -270,6 +272,16 @@ public:
|
|||
bool operator==(RefPtr& other) { return as_ptr() == other.as_ptr(); }
|
||||
bool operator!=(RefPtr& other) { return as_ptr() != other.as_ptr(); }
|
||||
|
||||
template<typename U>
|
||||
bool operator==(NonnullRefPtr<U> const& other) const { return as_ptr() == other.m_ptr; }
|
||||
template<typename U>
|
||||
bool operator!=(NonnullRefPtr<U> const& other) const { return as_ptr() != other.m_ptr; }
|
||||
|
||||
template<typename U>
|
||||
bool operator==(NonnullRefPtr<U>& other) { return as_ptr() == other.m_ptr; }
|
||||
template<typename U>
|
||||
bool operator!=(NonnullRefPtr<U>& other) { return as_ptr() != other.m_ptr; }
|
||||
|
||||
bool operator==(const T* other) const { return as_ptr() == other; }
|
||||
bool operator!=(const T* other) const { return as_ptr() != other; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue