summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-01-20 15:50:16 -0600
committerGitHub <noreply@github.com>2025-01-20 15:50:16 -0600
commit4f912000cd1293a22c34e5ae727bcbdae5da320f (patch)
tree44142edfac3d954970fe3ea3249c255bd02185c3 /Source/Core
parent7ba56bc7382216cdfed541b287679d0deba14a30 (diff)
parent75425ced0567fd90c4cd0d95ecf7176f67557f28 (diff)
Merge pull request #13289 from iwubcode/small_vector_clear
Common: add 'clear' function to SmallVector
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/SmallVector.h5
1 files changed, 5 insertions, 0 deletions
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 <array>
#include <cstddef>
+#include <type_traits>
#include <utility>
namespace Common
@@ -13,6 +14,8 @@ namespace Common
template <typename T, size_t MaxSize>
class SmallVector final
{
+ static_assert(std::is_standard_layout_v<T> == 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<T, MaxSize> m_array{};
size_t m_size = 0;