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/option.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'asl/option.hpp') diff --git a/asl/option.hpp b/asl/option.hpp index f2af9ee..b22b295 100644 --- a/asl/option.hpp +++ b/asl/option.hpp @@ -88,7 +88,7 @@ class option if constexpr (kHasInlinePayload) { - new (&m_payload) T(ASL_FWD(args)...); + construct_at(&m_payload, ASL_FWD(args)...); } else { @@ -389,11 +389,8 @@ public: } else { - if constexpr (!trivially_destructible) - { - (&m_payload)->~T(); - } - new (&m_payload) T(niche{}); + destruct(&m_payload); + construct_at(&m_payload, niche{}); } } else -- cgit