From 576a05a038618b7365c3f9fe625ca11403305dfe Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 3 May 2018 01:32:46 -0500 Subject: [PATCH] [ox/std] Fix non-stdlib version of ox_malloca --- deps/ox/src/ox/std/new.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/std/new.hpp b/deps/ox/src/ox/std/new.hpp index 67d0e12b5..1f61a3e11 100644 --- a/deps/ox/src/ox/std/new.hpp +++ b/deps/ox/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); }