[ox/std] Fix non-stdlib version of ox_malloca

This commit is contained in:
Gary Talent 2018-05-03 01:32:46 -05:00
parent 87f4964df5
commit 576a05a038

View File

@ -39,7 +39,7 @@ constexpr auto MallocaStackLimit = 1024;
#if defined(OX_USE_STDLIB)
#define ox_malloca(size, Type, ...) ox::MallocaPtr<Type>(size, new (size > MallocaStackLimit ? new uint8_t[size] : ox_alloca(size)) Type(__VA_ARGS__))
#else
#define ox_malloca(size, Type, ...) ox::MallocaPtr<Type>(size, ox_alloca(size))
#define ox_malloca(size, Type, ...) ox::MallocaPtr<Type>(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<T*>(m_val);
}
inline T *get() noexcept {
return reinterpret_cast<T*>(m_val);
}
inline const T *operator->() const noexcept {
return reinterpret_cast<T*>(m_val);
}