mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-09 03:10:46 +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:
parent
b88ff97537
commit
68e23bca3f
|
@ -121,6 +121,9 @@ public:
|
||||||
CALLABLE_WHEN(unconsumed)
|
CALLABLE_WHEN(unconsumed)
|
||||||
operator T*() { return m_ptr; }
|
operator T*() { return m_ptr; }
|
||||||
|
|
||||||
|
operator bool() const = delete;
|
||||||
|
bool operator!() const = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,6 +221,9 @@ public:
|
||||||
return *m_ptr;
|
return *m_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator bool() const = delete;
|
||||||
|
bool operator!() const = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NonnullRefPtr() = delete;
|
NonnullRefPtr() = delete;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user