From 6bee2d12d7391e245d7573740482a8fe1cc32332 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 6 Nov 2021 12:55:28 -0500 Subject: [PATCH] [ox/std] Add std::allocator --- deps/ox/src/ox/std/memory.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/deps/ox/src/ox/std/memory.hpp b/deps/ox/src/ox/std/memory.hpp index ab64d1a4..14ade403 100644 --- a/deps/ox/src/ox/std/memory.hpp +++ b/deps/ox/src/ox/std/memory.hpp @@ -8,8 +8,33 @@ #pragma once +#if __has_include() + +#include + +#else + +namespace std { + +template +struct allocator { + [[nodiscard]] + constexpr T *allocate(size_t n) { + return static_cast(::operator new(n * sizeof(T))); + } + + constexpr void deallocate(T *p, std::size_t) { + ::operator delete(p); + } +}; + +} + +#endif + #include "utility.hpp" + namespace ox { template