From c717fcab1ccc3e0b0b97499a4d9b04a77084e347 Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Thu, 24 Sep 2026 15:17:01 +0100 Subject: [PATCH] general: More `MEMPTR` operators should be const (#2072) --- src/Common/MemPtr.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Common/MemPtr.h b/src/Common/MemPtr.h index 2dc92040..ecd40203 100644 --- a/src/Common/MemPtr.h +++ b/src/Common/MemPtr.h @@ -98,20 +98,20 @@ class MEMPTR : MEMPTRBase return MEMPTR(this->m_value); } - sint32 operator-(const MEMPTR& ptr) noexcept + sint32 operator-(const MEMPTR& ptr) const noexcept requires(!std::is_void_v) { return static_cast(this->GetMPTR() - ptr.GetMPTR()); } - MEMPTR operator+(sint32 v) noexcept + MEMPTR operator+(sint32 v) const noexcept requires(!std::is_void_v) { // pointer arithmetic return MEMPTR(this->GetMPTR() + v * sizeof(T)); } - MEMPTR operator-(sint32 v) noexcept + MEMPTR operator-(sint32 v) const noexcept requires(!std::is_void_v) { // pointer arithmetic @@ -139,7 +139,7 @@ class MEMPTR : MEMPTRBase template requires(!std::is_void_v) - Q& operator[](int index) noexcept + Q& operator[](int index) const noexcept { return GetPtr()[index]; }