diff --git a/include/td/common/Array.h b/include/td/common/Array.h index 10acb9b..3f20862 100644 --- a/include/td/common/Array.h +++ b/include/td/common/Array.h @@ -3,6 +3,10 @@ #include namespace td { + +/** + * Reflectable std::array + */ template class Array { private: @@ -11,6 +15,15 @@ class Array { public: Array() : m_Data(new T[S]) {} + Array(const Array& a_Other) : Array() { + std::memcpy(m_Data, a_Other.m_Data, S); + } + + Array(Array&& a_Other) { + m_Data = a_Other.m_Data; + a_Other.m_Data = nullptr; + } + Array(const std::initializer_list& args) { std::size_t i = 0; for(const T& element : args) { @@ -19,6 +32,16 @@ class Array { } } + Array& operator=(const Array& a_Other) { + std::memcpy(m_Data, a_Other.m_Data, S); + return *this; + } + + Array& operator=(Array&& a_Other) { + std::swap(m_Data, a_Other.m_Data); + return *this; + } + T& operator[](std::size_t a_Index) { return m_Data[a_Index]; } diff --git a/include/td/game/GameHistory.h b/include/td/game/GameHistory.h index 73cda9c..4aa84e0 100644 --- a/include/td/game/GameHistory.h +++ b/include/td/game/GameHistory.h @@ -1,6 +1,5 @@ #pragma once -#define BOOST_PFR_USE_CPP17 0 #include #include #include