v1
Brett 2024-02-29 10:27:02 -05:00
parent 1732f39a42
commit ffa20e0e51
1 changed files with 19 additions and 0 deletions

View File

@ -529,6 +529,25 @@ namespace blt
allocator.deallocate(v.buffer, size_); allocator.deallocate(v.buffer, size_);
} }
}; };
template<typename T>
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 #define BLT_ALLOCATOR_H