summaryrefslogtreecommitdiff
path: root/asl/option.hpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-12-17 23:30:44 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-12-20 15:35:58 +0100
commit6d69512c6ff58ee8a7c1266257db5bf94cc91886 (patch)
tree56107a97d41993417b620b88970c8d6cf7b15127 /asl/option.hpp
parent7c9e871eb66de64e7a1861fd1faebcd5524fed96 (diff)
Refactor a bunch of memory utilities
Diffstat (limited to 'asl/option.hpp')
-rw-r--r--asl/option.hpp9
1 files changed, 3 insertions, 6 deletions
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<T>(&m_payload, ASL_FWD(args)...);
}
else
{
@@ -389,11 +389,8 @@ public:
}
else
{
- if constexpr (!trivially_destructible<T>)
- {
- (&m_payload)->~T();
- }
- new (&m_payload) T(niche{});
+ destruct(&m_payload);
+ construct_at<T>(&m_payload, niche{});
}
}
else