1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-05 20:34:56 +00:00

AK: Delete operator!() and operator bool() from the Nonnull pointers

Since NonnullRefPtr and NonnullOwnPtr cannot be null, it is pointless
to convert them to a bool, since it would always be true.

This patch makes it an error to null-check one of these pointers.
This commit is contained in:
Andreas Kling 2019-11-07 18:00:05 +01:00
parent b88ff97537
commit 68e23bca3f
2 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,9 @@ public:
CALLABLE_WHEN(unconsumed)
operator T*() { return m_ptr; }
operator bool() const = delete;
bool operator!() const = delete;
private:
void clear()
{

View File

@ -221,6 +221,9 @@ public:
return *m_ptr;
}
operator bool() const = delete;
bool operator!() const = delete;
private:
NonnullRefPtr() = delete;