No arithmetic on MEMPTR<void>, as with void*

This commit is contained in:
capitalistspz 2024-10-17 11:24:39 +01:00
parent e94f216088
commit 610e75e067

View File

@ -98,24 +98,24 @@ class MEMPTR : MEMPTRBase
return MEMPTR<X>(this->m_value);
}
sint32 operator-(const MEMPTR& ptr) noexcept
sint32 operator-(const MEMPTR& ptr) noexcept requires (!std::is_void_v<T>)
{
return static_cast<sint32>(this->GetMPTR() - ptr.GetMPTR());
}
MEMPTR operator+(sint32 v) noexcept
MEMPTR operator+(sint32 v) noexcept requires (!std::is_void_v<T>)
{
// pointer arithmetic
return MEMPTR(this->GetMPTR() + v * sizeof(T));
}
MEMPTR operator-(sint32 v) noexcept
MEMPTR operator-(sint32 v) noexcept requires (!std::is_void_v<T>)
{
// pointer arithmetic
return MEMPTR(this->GetMPTR() - v * sizeof(T));
}
MEMPTR& operator+=(sint32 v) noexcept
MEMPTR& operator+=(sint32 v) noexcept requires (!std::is_void_v<T>)
{
m_value += v * sizeof(T);
return *this;