@@ -98,35 +98,36 @@ class MEMPTR : MEMPTRBase
98
98
return MEMPTR<X>(this ->m_value );
99
99
}
100
100
101
- MEMPTR operator +(const MEMPTR& ptr) noexcept
101
+ sint32 operator -(const MEMPTR& ptr) noexcept
102
+ requires (!std::is_void_v<T>)
102
103
{
103
- return MEMPTR (this ->GetMPTR () + ptr.GetMPTR ());
104
- }
105
- MEMPTR operator -(const MEMPTR& ptr) noexcept
106
- {
107
- return MEMPTR (this ->GetMPTR () - ptr.GetMPTR ());
104
+ return static_cast <sint32>(this ->GetMPTR () - ptr.GetMPTR ());
108
105
}
109
106
110
107
MEMPTR operator +(sint32 v) noexcept
108
+ requires (!std::is_void_v<T>)
111
109
{
112
110
// pointer arithmetic
113
- return MEMPTR (this ->GetMPTR () + v * 4 );
111
+ return MEMPTR (this ->GetMPTR () + v * sizeof (T) );
114
112
}
115
113
116
114
MEMPTR operator -(sint32 v) noexcept
115
+ requires (!std::is_void_v<T>)
117
116
{
118
117
// pointer arithmetic
119
- return MEMPTR (this ->GetMPTR () - v * 4 );
118
+ return MEMPTR (this ->GetMPTR () - v * sizeof (T) );
120
119
}
121
120
122
121
MEMPTR& operator +=(sint32 v) noexcept
122
+ requires (!std::is_void_v<T>)
123
123
{
124
124
m_value += v * sizeof (T);
125
125
return *this ;
126
126
}
127
127
128
128
template <typename Q = T>
129
- std::enable_if_t <!std::is_same_v<Q, void >, Q>& operator *() const noexcept
129
+ requires (!std::is_void_v<Q>)
130
+ Q& operator *() const noexcept
130
131
{
131
132
return *GetPtr ();
132
133
}
@@ -137,7 +138,8 @@ class MEMPTR : MEMPTRBase
137
138
}
138
139
139
140
template <typename Q = T>
140
- std::enable_if_t <!std::is_same_v<Q, void >, Q>& operator [](int index) noexcept
141
+ requires (!std::is_void_v<Q>)
142
+ Q& operator [](int index) noexcept
141
143
{
142
144
return GetPtr ()[index ];
143
145
}
0 commit comments