From ffa20e0e51a8b308458e0b3ca2946af4eef4bae6 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 29 Feb 2024 10:27:02 -0500 Subject: [PATCH] lovely --- include/blt/std/allocator.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/blt/std/allocator.h b/include/blt/std/allocator.h index 7ef1b25..9276ecf 100644 --- a/include/blt/std/allocator.h +++ b/include/blt/std/allocator.h @@ -529,6 +529,25 @@ namespace blt allocator.deallocate(v.buffer, size_); } }; + + template + class constexpr_allocator + { + public: + constexpr constexpr_allocator() = default; + + constexpr T* allocate(blt::size_t n) + { + return ::new T[n]; + } + + constexpr void deallocate(T* t, blt::size_t) + { + ::delete[] t; + } + + constexpr ~constexpr_allocator() = default; + }; } #define BLT_ALLOCATOR_H