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