[ox/std] Fix non-stdlib version of ox_malloca
This commit is contained in:
parent
87f4964df5
commit
576a05a038
10
deps/ox/src/ox/std/new.hpp
vendored
10
deps/ox/src/ox/std/new.hpp
vendored
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user