From 76b5466e875dd80f201954afc8e65689e2265506 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 21 Apr 2024 06:53:34 +0100 Subject: [PATCH] [*] fix --- Include/Aurora/Memory/CppHeapWrapper.hpp | 28 ++++++++---------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/Include/Aurora/Memory/CppHeapWrapper.hpp b/Include/Aurora/Memory/CppHeapWrapper.hpp index 3b3a93e8..38107112 100644 --- a/Include/Aurora/Memory/CppHeapWrapper.hpp +++ b/Include/Aurora/Memory/CppHeapWrapper.hpp @@ -152,19 +152,13 @@ namespace Aurora::Memory template void construct(U *p, Args&&... args) { - if constexpr (AuIsClass_v) - { - new ((void *)p) U(AuForward(args)...); - } + new ((void *)p) U(AuForward(args)...); } template void construct_at(U *p, Args&&... args) { - if constexpr (AuIsClass_v) - { - new ((void *)p) U(AuForward(args)...); - } + new ((void *)p) U(AuForward(args)...); } void deallocate(const T *pType, @@ -199,18 +193,14 @@ namespace Aurora::Memory U *new_object(CtorArgs&&... args) { U *p = this->allocate_object(); - if constexpr (AuIsClass_v && - !AuIsTriviallyConstructible_v) + try { - try - { - this->construct(p, AuForward(args)...); - } - catch (...) - { - this->deallocate_object(p); - throw; - } + this->construct(p, AuForward(args)...); + } + catch (...) + { + this->deallocate_object(p); + throw; } return p; }