summaryrefslogtreecommitdiffstats
path: root/src/common/virtual_buffer.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-11-18 02:09:55 +0100
committerLioncash <mathew1800@gmail.com>2020-11-18 02:09:58 +0100
commit0ca91ced2dab3654e78e4c465506d7baad3cbeeb (patch)
tree4165380bb5e6bc44d901e9c93651bc2bb620ef0f /src/common/virtual_buffer.h
parentpage_table: Allow page tables to be moved (diff)
downloadyuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar.gz
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar.bz2
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar.lz
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar.xz
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.tar.zst
yuzu-0ca91ced2dab3654e78e4c465506d7baad3cbeeb.zip
Diffstat (limited to '')
-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 @@
#pragma once
+#include <type_traits>
#include <utility>
namespace Common {
@@ -14,6 +15,11 @@ void FreeMemoryPages(void* base, std::size_t size) noexcept;
template <typename T>
class VirtualBuffer final {
public:
+ static_assert(
+ std::is_trivially_constructible_v<T>,
+ "T must be trivially constructible, as non-trivial constructors will not be executed "
+ "with the current allocator");
+
constexpr VirtualBuffer() = default;
explicit VirtualBuffer(std::size_t count) : alloc_size{count * sizeof(T)} {
base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size));