diff options
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/memory.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/os/memory.h b/core/os/memory.h index 42ba9634e2..0e1afe027e 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -36,6 +36,7 @@ #include <stddef.h> #include <new> +#include <type_traits> #ifndef PAD_ALIGN #define PAD_ALIGN 16 //must always be greater than this at much @@ -104,7 +105,7 @@ void memdelete(T *p_class) { if (!predelete_handler(p_class)) { return; // doesn't want to be deleted } - if (!__has_trivial_destructor(T)) { + if (!std::is_trivially_destructible<T>::value) { p_class->~T(); } @@ -116,7 +117,7 @@ void memdelete_allocator(T *p_class) { if (!predelete_handler(p_class)) { return; // doesn't want to be deleted } - if (!__has_trivial_destructor(T)) { + if (!std::is_trivially_destructible<T>::value) { p_class->~T(); } @@ -146,7 +147,7 @@ T *memnew_arr_template(size_t p_elements) { ERR_FAIL_COND_V(!mem, failptr); *(mem - 1) = p_elements; - if (!__has_trivial_constructor(T)) { + if (!std::is_trivially_constructible<T>::value) { T *elems = (T *)mem; /* call operator new */ @@ -173,7 +174,7 @@ template <typename T> void memdelete_arr(T *p_class) { uint64_t *ptr = (uint64_t *)p_class; - if (!__has_trivial_destructor(T)) { + if (!std::is_trivially_destructible<T>::value) { uint64_t elem_count = *(ptr - 1); for (uint64_t i = 0; i < elem_count; i++) { |