summaryrefslogtreecommitdiff
path: root/asl/memory/allocator.hpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-05-26 00:47:54 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-05-26 00:48:06 +0200
commita1db1cd9e22e77041d5f1360f1d1ccdc52b86306 (patch)
treec1cc6dc9c17885a0789028f7a55c7126f33beee7 /asl/memory/allocator.hpp
parent54b95b16629f0cd4bc30e6899e00019b3ab94012 (diff)
Implement chunked_buffer
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);