mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03: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
Notes:
sideshowbarker
2024-07-19 11:20:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/68e23bca3f7
@ -121,6 +121,9 @@ public:
|
||||
CALLABLE_WHEN(unconsumed)
|
||||
operator T*() { return m_ptr; }
|
||||
|
||||
operator bool() const = delete;
|
||||
bool operator!() const = delete;
|
||||
|
||||
private:
|
||||
void clear()
|
||||
{
|
||||
|
@ -221,6 +221,9 @@ public:
|
||||
return *m_ptr;
|
||||
}
|
||||
|
||||
operator bool() const = delete;
|
||||
bool operator!() const = delete;
|
||||
|
||||
private:
|
||||
NonnullRefPtr() = delete;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user