[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)
|
#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__))
|
#define ox_malloca(size, Type, ...) ox::MallocaPtr<Type>(size, new (size > MallocaStackLimit ? new uint8_t[size] : ox_alloca(size)) Type(__VA_ARGS__))
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
namespace ox {
|
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 {
|
inline const T *operator->() const noexcept {
|
||||||
return reinterpret_cast<T*>(m_val);
|
return reinterpret_cast<T*>(m_val);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user