From 75425ced0567fd90c4cd0d95ecf7176f67557f28 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 20 Jan 2025 14:21:12 -0600 Subject: [PATCH] Common: add 'clear' function to SmallVector --- Source/Core/Common/SmallVector.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Common/SmallVector.h b/Source/Core/Common/SmallVector.h index c7018f4741..df50b0c115 100644 --- a/Source/Core/Common/SmallVector.h +++ b/Source/Core/Common/SmallVector.h @@ -4,6 +4,7 @@ #include #include +#include #include namespace Common @@ -13,6 +14,8 @@ namespace Common template class SmallVector final { + static_assert(std::is_standard_layout_v == true, "Type must be a standard layout type"); + public: SmallVector() = default; explicit SmallVector(size_t size) : m_size(size) {} @@ -40,6 +43,8 @@ public: size_t size() const { return m_size; } bool empty() const { return m_size == 0; } + void clear() { m_size = 0; } + private: std::array m_array{}; size_t m_size = 0;