diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-12-17 23:30:44 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-12-20 15:35:58 +0100 |
commit | 6d69512c6ff58ee8a7c1266257db5bf94cc91886 (patch) | |
tree | 56107a97d41993417b620b88970c8d6cf7b15127 /asl/maybe_uninit.hpp | |
parent | 7c9e871eb66de64e7a1861fd1faebcd5524fed96 (diff) |
Refactor a bunch of memory utilities
Diffstat (limited to 'asl/maybe_uninit.hpp')
-rw-r--r-- | asl/maybe_uninit.hpp | 7 |
1 files changed, 2 insertions, 5 deletions
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<typename... Args>
constexpr void init_unsafe(Args&&... args) &
{
- new(uninit_ptr()) T(ASL_FWD(args)...);
+ construct_at<T>(uninit_ptr(), ASL_FWD(args)...);
}
// @Safety Must be called only when in initialized state.
constexpr void uninit_unsafe() &
{
- if constexpr (!trivially_destructible<T>)
- {
- init_ptr_unsafe()->~T();
- }
+ destruct(init_ptr_unsafe());
}
};
|