[ox/std] Make MallocaPtr::operator= delete the old value
This commit is contained in:
parent
99b77e868d
commit
0b86f437f0
9
deps/ox/src/ox/std/new.hpp
vendored
9
deps/ox/src/ox/std/new.hpp
vendored
@ -55,6 +55,8 @@ class MallocaPtr {
|
|||||||
|
|
||||||
inline MallocaPtr(MallocaPtr &other) = delete;
|
inline MallocaPtr(MallocaPtr &other) = delete;
|
||||||
|
|
||||||
|
inline MallocaPtr(const MallocaPtr &other) = delete;
|
||||||
|
|
||||||
inline MallocaPtr(MallocaPtr &&other) noexcept {
|
inline MallocaPtr(MallocaPtr &&other) noexcept {
|
||||||
m_size = other.m_size;
|
m_size = other.m_size;
|
||||||
m_val = other.m_val;
|
m_val = other.m_val;
|
||||||
@ -84,7 +86,14 @@ class MallocaPtr {
|
|||||||
|
|
||||||
inline const T &operator=(MallocaPtr &other) = delete;
|
inline const T &operator=(MallocaPtr &other) = delete;
|
||||||
|
|
||||||
|
inline const T &operator=(const MallocaPtr &other) = delete;
|
||||||
|
|
||||||
inline const T &operator=(MallocaPtr &&other) noexcept {
|
inline const T &operator=(MallocaPtr &&other) noexcept {
|
||||||
|
if constexpr(ox::defines::UseStdLib) {
|
||||||
|
if (m_size > ox::MallocaStackLimit) {
|
||||||
|
delete[] reinterpret_cast<uint8_t*>(m_val);
|
||||||
|
}
|
||||||
|
}
|
||||||
m_size = other.m_size;
|
m_size = other.m_size;
|
||||||
m_val = other.m_val;
|
m_val = other.m_val;
|
||||||
other.m_size = 0;
|
other.m_size = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user