diff --git a/src/ox/std/new.hpp b/src/ox/std/new.hpp index 67d0e12b5..1f61a3e11 100644 --- a/src/ox/std/new.hpp +++ b/src/ox/std/new.hpp @@ -39,7 +39,7 @@ constexpr auto MallocaStackLimit = 1024; #if defined(OX_USE_STDLIB) #define ox_malloca(size, Type, ...) ox::MallocaPtr(size, new (size > MallocaStackLimit ? new uint8_t[size] : ox_alloca(size)) Type(__VA_ARGS__)) #else -#define ox_malloca(size, Type, ...) ox::MallocaPtr(size, ox_alloca(size)) +#define ox_malloca(size, Type, ...) ox::MallocaPtr(size, new (ox_alloca(size)) Type(__VA_ARGS__)) #endif namespace ox { @@ -77,6 +77,14 @@ class MallocaPtr { } } + inline const T *get() const noexcept { + return reinterpret_cast(m_val); + } + + inline T *get() noexcept { + return reinterpret_cast(m_val); + } + inline const T *operator->() const noexcept { return reinterpret_cast(m_val); }