From fbfc078e9f44c1c1e95c9c484f1d5650bcf631b7 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 27 Jul 2024 16:57:39 -0400 Subject: lots and lots of userspace stuff --- euler/include/std/allocator.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 euler/include/std/allocator.hpp (limited to 'euler/include/std/allocator.hpp') diff --git a/euler/include/std/allocator.hpp b/euler/include/std/allocator.hpp new file mode 100644 index 0000000..32ba005 --- /dev/null +++ b/euler/include/std/allocator.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +namespace std { + + template + struct allocator { + + using value_type = T; + + constexpr allocator() noexcept {} + constexpr allocator(const allocator &other) noexcept {} + + template + constexpr allocator(const allocator &other) noexcept {} + + constexpr ~allocator() {} + + constexpr T *allocate(size_t n) { + return (T *)euler::heap::get_block(n * sizeof(T)); + } + + constexpr void deallocate(T *p, size_t n) { + euler::heap::return_block(p, n * sizeof(T)); + } + + }; + +} -- cgit v1.2.3