summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/virtual_buffer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/virtual_buffer.h b/src/common/virtual_buffer.h
index 363913d45..078e61c77 100644
--- a/src/common/virtual_buffer.h
+++ b/src/common/virtual_buffer.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <type_traits>
7#include <utility> 8#include <utility>
8 9
9namespace Common { 10namespace Common {
@@ -14,6 +15,11 @@ void FreeMemoryPages(void* base, std::size_t size) noexcept;
14template <typename T> 15template <typename T>
15class VirtualBuffer final { 16class VirtualBuffer final {
16public: 17public:
18 static_assert(
19 std::is_trivially_constructible_v<T>,
20 "T must be trivially constructible, as non-trivial constructors will not be executed "
21 "with the current allocator");
22
17 constexpr VirtualBuffer() = default; 23 constexpr VirtualBuffer() = default;
18 explicit VirtualBuffer(std::size_t count) : alloc_size{count * sizeof(T)} { 24 explicit VirtualBuffer(std::size_t count) : alloc_size{count * sizeof(T)} {
19 base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size)); 25 base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size));