mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-31 10:01:26 +02:00
Common: add 'clear' function to SmallVector
This commit is contained in:
parent
7ba56bc738
commit
75425ced05
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user