summaryrefslogtreecommitdiff
path: root/asl/memory/allocator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'asl/memory/allocator.hpp')
-rw-r--r--asl/memory/allocator.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/asl/memory/allocator.hpp b/asl/memory/allocator.hpp
index a231558..f2e2dce 100644
--- a/asl/memory/allocator.hpp
+++ b/asl/memory/allocator.hpp
@@ -41,6 +41,21 @@ T* alloc_new(allocator auto& a, auto&&... args)
}
template<typename T>
+T* alloc_uninit(allocator auto& a)
+ requires trivially_default_constructible<T>
+{
+ void* ptr = a.alloc(layout::of<T>());
+ return reinterpret_cast<T*>(ptr); // NOLINT(*-reinterpret-cast)
+}
+
+template<typename T>
+T* alloc_uninit_unsafe(allocator auto& a)
+{
+ void* ptr = a.alloc(layout::of<T>());
+ return reinterpret_cast<T*>(ptr); // NOLINT(*-reinterpret-cast)
+}
+
+template<typename T>
void alloc_delete(allocator auto& a, T* ptr)
{
destroy(ptr);