1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:07:35 +00: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:
MacDue 2022-11-19 01:03:48 +00:00 committed by Linus Groh
parent 24caacfe28
commit 3483407ddc
5 changed files with 23 additions and 85 deletions

View file

@ -117,10 +117,8 @@ public:
}
T* ptr() const { return unsafe_ptr(); }
T* operator->() { return unsafe_ptr(); }
const T* operator->() const { return unsafe_ptr(); }
operator const T*() const { return unsafe_ptr(); }
operator T*() { return unsafe_ptr(); }
T* operator->() const { return unsafe_ptr(); }
operator T*() const { return unsafe_ptr(); }
[[nodiscard]] T* unsafe_ptr() const
{