From 6d69512c6ff58ee8a7c1266257db5bf94cc91886 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Tue, 17 Dec 2024 23:30:44 +0100 Subject: Refactor a bunch of memory utilities --- asl/maybe_uninit.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'asl/maybe_uninit.hpp') diff --git a/asl/maybe_uninit.hpp b/asl/maybe_uninit.hpp index 0ab09ee..cedd96f 100644 --- a/asl/maybe_uninit.hpp +++ b/asl/maybe_uninit.hpp @@ -47,16 +47,13 @@ public: template constexpr void init_unsafe(Args&&... args) & { - new(uninit_ptr()) T(ASL_FWD(args)...); + construct_at(uninit_ptr(), ASL_FWD(args)...); } // @Safety Must be called only when in initialized state. constexpr void uninit_unsafe() & { - if constexpr (!trivially_destructible) - { - init_ptr_unsafe()->~T(); - } + destruct(init_ptr_unsafe()); } }; -- cgit