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; }