Allow comparing rcp<T> to rcp<U>

This commit is contained in:
josh committed 2026-02-24 17:10:01 -05:00
1 parent 11555ded36
commit 69ecab39f2
2 files changed
+18 -4

No files matched your search

+6 -4
View File
@@ -147,14 +147,16 @@ public:
return ptr != nullptr;
}
bool operator==(const rcp & other) const
template <typename U>
bool operator==(const rcp<U> & other) const
{
return ptr == other.ptr;
return static_cast<const void *>(ptr) == static_cast<const void *>(other.ptr);
}
bool operator!=(const rcp & other) const
template <typename U>
bool operator!=(const rcp<U> & other) const
{
return ptr != other.ptr;
return static_cast<const void *>(ptr) != static_cast<const void *>(other.ptr);
}
bool operator==(std::nullptr_t) const