mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
AK: Return non-const types from Ptr class operators
Even if the pointer value is const, the value they point to is not necessarily const, so these functions should not add the qualifier. This also removes the redundant non-const implementations of these operators.
This commit is contained in:
parent
24caacfe28
commit
3483407ddc
Notes:
sideshowbarker
2024-07-17 04:21:06 +09:00
Author: https://github.com/MacDue
Commit: 3483407ddc
Pull-request: https://github.com/SerenityOS/serenity/pull/16114
5 changed files with 23 additions and 85 deletions
|
@ -93,26 +93,17 @@ public:
|
|||
return exchange(m_ptr, nullptr);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE RETURNS_NONNULL T* ptr()
|
||||
ALWAYS_INLINE RETURNS_NONNULL T* ptr() const
|
||||
{
|
||||
VERIFY(m_ptr);
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE RETURNS_NONNULL const T* ptr() const
|
||||
{
|
||||
VERIFY(m_ptr);
|
||||
return m_ptr;
|
||||
}
|
||||
ALWAYS_INLINE RETURNS_NONNULL T* operator->() const { return ptr(); }
|
||||
|
||||
ALWAYS_INLINE RETURNS_NONNULL T* operator->() { return ptr(); }
|
||||
ALWAYS_INLINE RETURNS_NONNULL const T* operator->() const { return ptr(); }
|
||||
ALWAYS_INLINE T& operator*() const { return *ptr(); }
|
||||
|
||||
ALWAYS_INLINE T& operator*() { return *ptr(); }
|
||||
ALWAYS_INLINE const T& operator*() const { return *ptr(); }
|
||||
|
||||
ALWAYS_INLINE RETURNS_NONNULL operator const T*() const { return ptr(); }
|
||||
ALWAYS_INLINE RETURNS_NONNULL operator T*() { return ptr(); }
|
||||
ALWAYS_INLINE RETURNS_NONNULL operator T*() const { return ptr(); }
|
||||
|
||||
operator bool() const = delete;
|
||||
bool operator!() const = delete;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue