1
0
mirror of https://github.com/momo5502/hypervisor.git synced 2026-05-22 23:31:43 +00:00

Use containers for ept allocations

This commit is contained in:
Maurice Heumann
2022-12-24 08:36:23 +01:00
parent 33b44f1dc1
commit 1d23c10734
5 changed files with 121 additions and 157 deletions
+6 -1
View File
@@ -6,7 +6,7 @@
namespace utils
{
template <typename T, typename Allocator = NonPagedAllocator>
requires IsAllocator<Allocator>
requires is_allocator<Allocator>
class vector
{
public:
@@ -258,6 +258,11 @@ namespace utils
{
constexpr auto alignment = alignof(T);
auto* memory = this->allocator_.allocate(capacity * sizeof(T) + alignment);
if (!memory)
{
throw std::runtime_error("Failed to allocate memory");
}
return memory;
}