mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +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
Notes:
sideshowbarker
2024-07-19 11:20:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/68e23bca3f7
2 changed files with 6 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue